micro/store/noop.go
Vasiliy Tolstov c062aab1a9
add noop broker and noop store (#30)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-03 15:11:05 +03:00

49 lines
832 B
Go

package store
type noopStore struct {
opts Options
}
func newStore(opts ...Option) Store {
options := NewOptions()
for _, o := range opts {
o(&options)
}
return &noopStore{opts: options}
}
func (n *noopStore) Init(opts ...Option) error {
for _, o := range opts {
o(&n.opts)
}
return nil
}
func (n *noopStore) Options() Options {
return n.opts
}
func (n *noopStore) String() string {
return "noop"
}
func (n *noopStore) Read(key string, opts ...ReadOption) ([]*Record, error) {
return []*Record{}, nil
}
func (n *noopStore) Write(r *Record, opts ...WriteOption) error {
return nil
}
func (n *noopStore) Delete(key string, opts ...DeleteOption) error {
return nil
}
func (n *noopStore) List(opts ...ListOption) ([]string, error) {
return []string{}, nil
}
func (n *noopStore) Close() error {
return nil
}