core

package
v0.0.0-...-b7a7493 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoSuchKey = errors.New("no such key")

Functions

This section is empty.

Types

type Event

type Event struct {
	Sequence  uint64
	EventType EventType
	Key       string
	Value     string
}

type EventType

type EventType byte
const (
	EventDelete EventType = iota // iota == 1
	EventPut                     // iota == 2; implicitly repeat last
)

type KeyValueStore

type KeyValueStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewKeyValueStore

func NewKeyValueStore() *KeyValueStore

func (*KeyValueStore) Delete

func (store *KeyValueStore) Delete(key string) error

func (*KeyValueStore) Get

func (store *KeyValueStore) Get(key string) (string, error)

func (*KeyValueStore) Put

func (store *KeyValueStore) Put(key string, value string) error

func (*KeyValueStore) Restore

func (store *KeyValueStore) Restore() error

func (*KeyValueStore) WithTransactionLogger

func (store *KeyValueStore) WithTransactionLogger(tl TransactionLogger) *KeyValueStore

type TransactionLogger

type TransactionLogger interface {
	WriteDelete(key string)
	WritePut(key, value string)
	Err() <-chan error

	LastSequence() uint64

	Run()
	Wait()
	Close() error

	ReadEvents() (<-chan Event, <-chan error)
}

type ZeroTransactionLogger

type ZeroTransactionLogger struct{}

func (ZeroTransactionLogger) Close

func (z ZeroTransactionLogger) Close() error

func (ZeroTransactionLogger) Err

func (z ZeroTransactionLogger) Err() <-chan error

func (ZeroTransactionLogger) LastSequence

func (z ZeroTransactionLogger) LastSequence() uint64

func (ZeroTransactionLogger) ReadEvents

func (z ZeroTransactionLogger) ReadEvents() (<-chan Event, <-chan error)

func (ZeroTransactionLogger) Run

func (z ZeroTransactionLogger) Run()

func (ZeroTransactionLogger) Wait

func (z ZeroTransactionLogger) Wait()

func (ZeroTransactionLogger) WriteDelete

func (z ZeroTransactionLogger) WriteDelete(key string)

func (ZeroTransactionLogger) WritePut

func (z ZeroTransactionLogger) WritePut(key, value string)

Jump to

Keyboard shortcuts

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