2020-03-12 16:41:30 +03:00
|
|
|
package store
|
|
|
|
|
2020-09-17 15:15:42 +03:00
|
|
|
import "context"
|
|
|
|
|
2020-09-03 15:11:05 +03:00
|
|
|
type noopStore struct {
|
|
|
|
opts Options
|
|
|
|
}
|
|
|
|
|
|
|
|
func newStore(opts ...Option) Store {
|
|
|
|
options := NewOptions()
|
|
|
|
for _, o := range opts {
|
|
|
|
o(&options)
|
|
|
|
}
|
|
|
|
return &noopStore{opts: options}
|
|
|
|
}
|
2020-03-12 16:41:30 +03:00
|
|
|
|
|
|
|
func (n *noopStore) Init(opts ...Option) error {
|
2020-09-03 15:11:05 +03:00
|
|
|
for _, o := range opts {
|
|
|
|
o(&n.opts)
|
|
|
|
}
|
2020-03-12 16:41:30 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopStore) Options() Options {
|
2020-09-03 15:11:05 +03:00
|
|
|
return n.opts
|
2020-03-12 16:41:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopStore) String() string {
|
|
|
|
return "noop"
|
|
|
|
}
|
|
|
|
|
2020-09-17 15:15:42 +03:00
|
|
|
func (n *noopStore) Read(ctx context.Context, key string, opts ...ReadOption) ([]*Record, error) {
|
2020-03-12 16:41:30 +03:00
|
|
|
return []*Record{}, nil
|
|
|
|
}
|
|
|
|
|
2020-09-17 15:15:42 +03:00
|
|
|
func (n *noopStore) Write(ctx context.Context, r *Record, opts ...WriteOption) error {
|
2020-03-12 16:41:30 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-17 15:15:42 +03:00
|
|
|
func (n *noopStore) Delete(ctx context.Context, key string, opts ...DeleteOption) error {
|
2020-03-12 16:41:30 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-17 15:15:42 +03:00
|
|
|
func (n *noopStore) List(ctx context.Context, opts ...ListOption) ([]string, error) {
|
2020-03-12 16:41:30 +03:00
|
|
|
return []string{}, nil
|
|
|
|
}
|
2020-04-08 11:51:10 +03:00
|
|
|
|
|
|
|
func (n *noopStore) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|