kv_storage

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorStorageLocked = errors.New("storage locked")
)

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// Create new storage
	New(name string) (Lifecycle, error)

	// Close all storages which created thru this factory.
	Close()
}

type Lifecycle

type Lifecycle interface {
	Storage

	// Open KVS storage. Returns ErrorStorageLocked if the storage
	// used by the another process.
	Open(path string) error

	// Update logger
	SetLogger(logger esl.Logger)

	// KVS path
	Path() string

	// Delete this KVS
	Delete() error
}

Storage with lifecycle control

type Storage

type Storage interface {
	// Close KVS storage
	Close()

	// Read only transaction
	View(f func(kvs kv_kvs.Kvs) error) error

	// Read-write transaction
	Update(f func(kvs kv_kvs.Kvs) error) error

	// Use direct operation
	Kvs() kv_kvs.Kvs
}

Storage interface.

Jump to

Keyboard shortcuts

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