// New creates new anchor witness store.
New creates new anchor witness store.
// New creates new anchor witness store .
func New(provider storage.Provider, expiryService *expiry.Service, maxWitnessDelay time.Duration) (*Store, error) {
	store, err := provider.OpenStore(namespace)
	if err != nil {
		return nil, fmt.Errorf("failed to open anchor witness store: %w", err)
	}
	s := &Store{
		store:           store,
		maxWitnessDelay: maxWitnessDelay,
		delta:           defaultDelta,
	}
	err = provider.SetStoreConfig(namespace, storage.StoreConfiguration{TagNames: []string{anchorIndex, expiryTagName}})
	if err != nil {
		return nil, fmt.Errorf("failed to set store configuration: %w", err)
	}
	expiryService.Register(store, expiryTagName, namespace, expiry.WithExpiryHandler(s))
	return s, nil
}
func New ( provider storage . Provider , expiryService * expiry . Service , maxWitnessDelay time . Duration ) ( * Store , error ) { store , err := provider . OpenStore ( namespace ) if err != nil { return nil , fmt . Errorf ( " " , err ) } s := & Store { store : store , maxWitnessDelay : maxWitnessDelay , delta : defaultDelta , } err = provider . SetStoreConfig ( namespace , storage . StoreConfiguration { TagNames : [ ] string { anchorIndex , expiryTagName } } ) if err != nil { return nil , fmt . Errorf ( " " , err ) } expiryService . Register ( store , expiryTagName , namespace , expiry . WithExpiryHandler ( s ) ) return s , nil }
New creates new anchor witness store.
New creates new anchor witness store .