persistent

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KeyPrefixLength = 2
)

Variables

View Source
var ErrRegistryNotFound = errors.New("registry not found")

Functions

This section is empty.

Types

type Ledger

type Ledger struct {
	// contains filtered or unexported fields
}

func (*Ledger) Close

func (l *Ledger) Close(delete bool) error

func (*Ledger) Log

func (l *Ledger) Log(t uint32, v []byte) error

type PersistentStorageApi

type PersistentStorageApi interface {
	View(func(txn PersistentStorageTransactionApi) error) error
	Update(func(txn PersistentStorageTransactionApi) error) error
	Delete(key string) error

	Close() error
}

Persistent Storage API provides an interface for interacting with persistent storage

type PersistentStorageIteratorApi

type PersistentStorageIteratorApi interface {
	Rewind()
	Valid() bool
	Next()

	Key() string
	Value() ([]byte, error)

	Close()
}

Persistent Storage Iterator API provides an iterface for interacting with persistent storage iterators

type PersistentStorageProvider

type PersistentStorageProvider interface {
	NewPersistentStorageInterface(path string, readOnly bool) (PersistentStorageApi, error)
}

func NewJsonFilePersistentStorageProvider

func NewJsonFilePersistentStorageProvider(filename string) PersistentStorageProvider

func NewLocalPersistentStorageProvider

func NewLocalPersistentStorageProvider() PersistentStorageProvider

type PersistentStorageTransactionApi

type PersistentStorageTransactionApi interface {
	NewIterator(prefix string) PersistentStorageIteratorApi
	Set(key string, value []byte) error
	Get(key string) ([]byte, error)
}

Persistent Storage Transaction API provides an interface for interacting with persistent storage transactions

func NewBase64PersistentStorageTransaction

func NewBase64PersistentStorageTransaction(data map[string]string) PersistentStorageTransactionApi

type Registry

type Registry interface {
	Prefix() string
	NewReplay(id string) ReplayHandler
}

type ReplayHandler

type ReplayHandler interface {
	Metadata(data []byte) error
	Entry(t uint32, data []byte) error
	Done() (bool, error)
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(path string, readOnly bool) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteKey

func (s *Store) DeleteKey(key string) error

func (*Store) MakeKey

func (s *Store) MakeKey(registry Registry, id string) string

func (*Store) NewKey

func (s *Store) NewKey(key string, metadata []byte) (*Ledger, error)

NewKey will create the provided key with metadata provided. It returns a logger which tracks updates to the key's value.

func (*Store) OpenKey

func (s *Store) OpenKey(key string) (*Ledger, error)

func (*Store) Register

func (s *Store) Register(registries []Registry)

func (*Store) Replay

func (s *Store) Replay() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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