add more context to store
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
8817c110d0
commit
6021edc855
@ -14,7 +14,7 @@ func newStore(opts ...Option) Store {
|
|||||||
return &noopStore{opts: options}
|
return &noopStore{opts: options}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *noopStore) Init(opts ...Option) error {
|
func (n *noopStore) Init(ctx context.Context, opts ...Option) error {
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(&n.opts)
|
o(&n.opts)
|
||||||
}
|
}
|
||||||
@ -45,6 +45,6 @@ func (n *noopStore) List(ctx context.Context, opts ...ListOption) ([]string, err
|
|||||||
return []string{}, nil
|
return []string{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *noopStore) Close() error {
|
func (n *noopStore) Close(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ var (
|
|||||||
// Store is a data storage interface
|
// Store is a data storage interface
|
||||||
type Store interface {
|
type Store interface {
|
||||||
// Init initialises the store. It must perform any required setup on the backing storage implementation and check that it is ready for use, returning any errors.
|
// Init initialises the store. It must perform any required setup on the backing storage implementation and check that it is ready for use, returning any errors.
|
||||||
Init(...Option) error
|
Init(ctx context.Context, opts ...Option) error
|
||||||
// Options allows you to view the current options.
|
// Options allows you to view the current options.
|
||||||
Options() Options
|
Options() Options
|
||||||
// Read takes a single key name and optional ReadOptions. It returns matching []*Record or an error.
|
// Read takes a single key name and optional ReadOptions. It returns matching []*Record or an error.
|
||||||
@ -29,7 +29,7 @@ type Store interface {
|
|||||||
// List returns any keys that match, or an empty list with no error if none matched.
|
// List returns any keys that match, or an empty list with no error if none matched.
|
||||||
List(ctx context.Context, opts ...ListOption) ([]string, error)
|
List(ctx context.Context, opts ...ListOption) ([]string, error)
|
||||||
// Close the store
|
// Close the store
|
||||||
Close() error
|
Close(ctx context.Context) error
|
||||||
// String returns the name of the implementation.
|
// String returns the name of the implementation.
|
||||||
String() string
|
String() string
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user