cache

package
v1.9.0-RC2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 16 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	IDENTITY_FN = ".identity-"
)
View Source
const STATE_FN = ".state-"

STATE_FN ...

Variables

View Source
var (
	ErrPrevStateNotFound   = errors.New("could not find previous state")
	ErrLocalStateCorrupted = errors.New("local state is corrupted")
	ErrNotImplemented      = errors.New("no implemented")
)
View Source
var ErrCacheAlreadyLocked = errors.New("cache is already locked")
View Source
var ErrCacheNotLocked = errors.New("cache is not locked")
View Source
var ErrServerIdentityValidationFailed = errors.New("failed to validate the identity of the server")

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(serverUUID, db string) (*schema.ImmutableState, error)
	Set(serverUUID, db string, state *schema.ImmutableState) error
	Lock(serverUUID string) error
	Unlock() error

	// ServerIdentityCheck check validates that a server with given identity can use given server uuid
	//
	// `serverIdentity` must uniquely identify given immudb server instance.
	// Go SDK passes `host:port` pair as the server identity however the Cache interface implementation
	// must not do any assumptions about the structure of this data.
	ServerIdentityCheck(serverIdentity, serverUUID string) error
}

Cache the cache interface

func NewFileCache

func NewFileCache(dir string) Cache

NewFileCache returns a new file cache

func NewInMemoryCache added in v0.7.0

func NewInMemoryCache() Cache

NewInMemoryCache returns a new in-memory cache

type HistoryCache

type HistoryCache interface {
	Cache
	Walk(serverUUID string, db string, f func(*schema.ImmutableState) interface{}) ([]interface{}, error)
}

HistoryCache the history cache interface

func NewHistoryFileCache

func NewHistoryFileCache(dir string) HistoryCache

NewHistoryFileCache returns a new history file cache

Jump to

Keyboard shortcuts

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