Documentation ¶
Index ¶
- type InMemoryStorage
- func (s *InMemoryStorage) Create(ctx context.Context, fqn string, create proto.Message) error
- func (s *InMemoryStorage) Delete(ctx context.Context, fqn string, dest proto.Message) error
- func (s *InMemoryStorage) Get(ctx context.Context, fqn string, dest proto.Message) error
- func (s *InMemoryStorage) List(ctx context.Context, kind protoreflect.Descriptor, options ListOptions, ...) error
- func (s *InMemoryStorage) Update(ctx context.Context, fqn string, update proto.Message) error
- type ListOptions
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryStorage ¶
type InMemoryStorage struct {
// contains filtered or unexported fields
}
InMemoryStorage is a memory-backed (non-persistent) implementation of Storage, useful for tests.
func NewInMemoryStorage ¶
func NewInMemoryStorage() *InMemoryStorage
NewInMemoryStorage constructs an InMemoryStorage
func (*InMemoryStorage) Delete ¶
Delete deletes the object, returning a not found error if it does not exist.
func (*InMemoryStorage) List ¶
func (s *InMemoryStorage) List(ctx context.Context, kind protoreflect.Descriptor, options ListOptions, callback func(obj proto.Message) error) error
List returns all matching objects
type ListOptions ¶
type ListOptions struct { // Prefix ensures that only objects whose key matches the prefix are returned Prefix string }
ListOptions restricts the objects returned by a List
type Storage ¶
type Storage interface { // Create stores the object, erroring if it already exists Create(ctx context.Context, fqn string, create proto.Message) error // Update stores a new version of an object, erroring if it does not already exist Update(ctx context.Context, fqn string, update proto.Message) error // Get returns an existing object. // The error is "ready to return"; we return codes.NotFound if not found. Get(ctx context.Context, fqn string, dest proto.Message) error // List returns all matching objects List(ctx context.Context, kind protoreflect.Descriptor, options ListOptions, callback func(obj proto.Message) error) error // Delete deletes the object, returning a not found error if it does not exist. // The error is "ready to return", e.g. we return codes.NotFound if not found. Delete(ctx context.Context, fqn string, dest proto.Message) error }
Click to show internal directories.
Click to hide internal directories.