micro/store/noop.go
Vasiliy Tolstov 14c97d59c1 many improvements with options and noop stuff
* add many options helpers
* fix noop client to allow publish messages to topic in broker
* fix noop server to allow registering in registry
* fix noop server to allow subscribe to topic in broker
* fix new service initialization

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-16 09:38:57 +03:00

47 lines
887 B
Go

package store
import "context"
type NoopStore struct {
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(ctx context.Context, key string, opts ...ReadOption) ([]*Record, error) {
return []*Record{}, nil
}
func (n *NoopStore) Write(ctx context.Context, r *Record, opts ...WriteOption) error {
return nil
}
func (n *NoopStore) Delete(ctx context.Context, key string, opts ...DeleteOption) error {
return nil
}
func (n *NoopStore) List(ctx context.Context, opts ...ListOption) ([]string, error) {
return []string{}, nil
}
func (n *NoopStore) Connect(ctx context.Context) error {
return nil
}
func (n *NoopStore) Disconnect(ctx context.Context) error {
return nil
}