store

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnimplemented ...
	ErrUnimplemented = errors.New("not implemented")

	// ErrNoNilValue ...
	ErrNoNilValue = errors.New("no nil value")

	// ErrNotExists ...
	ErrNotExists = errors.New("not exists")
)

Functions

This section is empty.

Types

type Sink

type Sink[V any] struct {
	Storage
	codec.Encoder[V]
}

Sink is a storage sink.

func NewSink

func NewSink[V any](store Storage, enc codec.Encoder[V]) *Sink[V]

NewSink is a new storage sink.

func (*Sink[V]) Write

func (n *Sink[V]) Write(messages ...msg.Message[string, V]) error

Write is a storage sink writer.

type Storage

type Storage interface {
	// Open is called when the storage is opened.
	Open() error

	// Close is called when the storage is closed.
	Close() error

	// Has is called to check if a key exists.
	Has(key string) (bool, error)

	// Get is called to get a value.
	Get(key string) ([]byte, error)

	// Set is called to set a value.
	Set(key string, value []byte) error

	// Delete is called to delete a value.
	Delete(key string) error
}

Storage ...

type Unimplemented

type Unimplemented struct{}

Unimplemented ...

func (*Unimplemented) Close

func (s *Unimplemented) Close() error

Close ...

func (*Unimplemented) Delete

func (s *Unimplemented) Delete(_ string) error

Delete ...

func (*Unimplemented) Get

func (s *Unimplemented) Get(_ string) ([]byte, error)

Get ...

func (*Unimplemented) Has

func (s *Unimplemented) Has(_ string) (bool, error)

Has ...

func (*Unimplemented) Open

func (s *Unimplemented) Open() error

Open ...

func (*Unimplemented) Set

func (s *Unimplemented) Set(_ string, value []byte) error

Set ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL