memdb

package
v1.38.0 Latest Latest
Warning

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

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

README

MemDB Datastore Implementation

The memdb datastore implementation is based on Hashicorp's go-memdb library. Its implementation most closely mimics that of spanner, or crdb, where there is a single immutable datastore that supports querying at any point in time. The memdb datastore is used for validating and rapidly iterating on concepts from consumers of other datastores. It is 100% compliant with the datastore acceptance test suite and it should be possible to use it in place of any other datastore for development purposes. Differences between the memdb datastore and other implementations that manifest themselves as differences visible to the caller should be reported as bugs.

The memdb datastore can NOT be used in a production setting!

Implementation Caveats

No Garbage Collection

This implementation of the datastore has no garbage collection, meaning that memory usage will grow monotonically with mutations.

No Durable Storage

The memdb datastore, as its name implies, stores information entirely in memory, and therefore will lose all data when the host process terminates.

Cannot be used for multi-node dispatch

If you attempt to run SpiceDB with multi-node dispatch enabled using the memory datastore, each independent node will get a separate copy of the datastore, and you will end up very confused.

Documentation

Index

Constants

View Source
const DisableGC = time.Duration(math.MaxInt64)

DisableGC is a convenient constant for setting the garbage collection interval high enough that it will never run.

View Source
const (
	Engine = "memory"
)

Variables

View Source
var ErrSerialization = errors.New("serialization error")

Functions

func NewMemdbDatastore

func NewMemdbDatastore(
	watchBufferLength uint16,
	revisionQuantization,
	gcWindow time.Duration,
) (datastore.Datastore, error)

NewMemdbDatastore creates a new Datastore compliant datastore backed by memdb.

If the watchBufferLength value of 0 is set then a default value of 128 will be used.

func NewSerializationMaxRetriesReachedErr added in v1.26.0

func NewSerializationMaxRetriesReachedErr(baseErr error) error

NewSerializationMaxRetriesReachedErr constructs a new max retries reached error.

Types

type ErrSerializationMaxRetriesReached added in v1.26.0

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

ErrSerializationMaxRetriesReached occurs when a write request has reached its maximum number of retries due to serialization errors.

func (ErrSerializationMaxRetriesReached) GRPCStatus added in v1.26.0

GRPCStatus implements retrieving the gRPC status for the error.

type TryLocker added in v1.8.0

type TryLocker interface {
	TryLock() bool
	Unlock()
}

Jump to

Keyboard shortcuts

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