memory

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package memory provides an in-memory persistence Driver.

Data is organized into named silos. A silo is an isolated group of in-memory stores that persists for the lifetime of the process. Multiple drivers that reference the same silo name share the same underlying data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.18.0

type Config struct {
	// Silo is the name of the shared in-memory silo. Drivers with the same
	// silo name share state for the lifetime of the process.
	Silo string
}

Config holds the configuration for an in-memory persistence driver.

func FromURL added in v0.18.0

func FromURL(_ context.Context, u *url.URL) (*Config, error)

FromURL returns a *Config for the given memory:// *url.URL. See ParseURL for the URL format.

func ParseURL added in v0.18.0

func ParseURL(ctx context.Context, u string) (*Config, error)

ParseURL returns a *Config for the given memory:// URL string.

URL format:

memory:///<silo>

func (*Config) NewDriver added in v0.18.0

func (c *Config) NewDriver(context.Context) (*Driver, error)

NewDriver returns a Driver backed by the configured silo.

type Driver added in v0.18.0

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

Driver is a persistence driver backed by a named in-memory silo.

func New added in v0.18.0

func New(name string) *Driver

New returns a Driver backed by the named silo.

func (*Driver) Close added in v0.18.0

func (d *Driver) Close() error

Close is a no-op. The silo's state persists for the lifetime of the process.

func (*Driver) JournalStore added in v0.18.0

func (d *Driver) JournalStore() journal.BinaryStore

JournalStore returns the silo's in-memory journal store.

func (*Driver) KVStore added in v0.18.0

func (d *Driver) KVStore() kv.BinaryStore

KVStore returns the silo's in-memory key/value store.

func (*Driver) SetStore added in v0.18.0

func (d *Driver) SetStore() set.BinaryStore

SetStore returns the silo's in-memory set store.

Directories

Path Synopsis
internal
clone
Package clone provides a protocol-buffers-aware deep clone function.
Package clone provides a protocol-buffers-aware deep clone function.
Package memoryjournal provides an in-memory implementation of journal.Store.
Package memoryjournal provides an in-memory implementation of journal.Store.
Package memorykv provides an in-memory implementation of kv.Store.
Package memorykv provides an in-memory implementation of kv.Store.
Package memoryset provides an in-memory implementation of set.BinaryStore.
Package memoryset provides an in-memory implementation of set.BinaryStore.

Jump to

Keyboard shortcuts

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