2020-03-12 16:41:30 +03:00
|
|
|
package store
|
|
|
|
|
2020-09-17 15:15:42 +03:00
|
|
|
import "context"
|
|
|
|
|
2020-10-16 09:38:57 +03:00
|
|
|
type NoopStore struct {
|
2020-09-03 15:11:05 +03:00
|
|
|
opts Options
|
|
|
|
}
|
|
|
|
|
2020-10-16 09:38:57 +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
|
|
|
|
}
|
|
|
|
|
2020-10-16 09:38:57 +03:00
|
|
|
func (n *NoopStore) Options() Options {
|
2020-09-03 15:11:05 +03:00
|
|
|
return n.opts
|
2020-03-12 16:41:30 +03:00
|
|
|
}
|
|
|
|
|
2020-10-16 09:38:57 +03:00
|
|
|
func (n *NoopStore) String() string {
|
2020-03-12 16:41:30 +03:00
|
|
|
return "noop"
|
|
|
|
}
|
|
|
|
|
2020-10-16 09:38:57 +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-10-16 09:38:57 +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-10-16 09:38:57 +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-10-16 09:38:57 +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
|
|
|
|
2020-10-16 09:38:57 +03:00
|
|
|
func (n *NoopStore) Connect(ctx context.Context) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *NoopStore) Disconnect(ctx context.Context) error {
|
2020-04-08 11:51:10 +03:00
|
|
|
return nil
|
|
|
|
}
|