persistencekit

package module
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: 10 Imported by: 0

README

Dogma Persistence Toolkit

Abstract persistence primitives for use in Dogma engines, projections, etc.

Documentation Latest Version Build Status Code Coverage

The persistence toolkit provides a set of relatively low-level persistence abstractions that can be used to build higher-level storage systems.

The interfaces are designed to be easy to implement by placing a minimal set of requirements on each implementation.

Abstractions

Drivers

Implementations of the above abstractions are called "drivers". Several built-in drivers are included, each in their own package within the driver directory.

Documentation

Overview

Package persistencekit abstract persistence primitives for use in [Dogma](https://github.com/dogmatiq/dogma) engines, projections, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// NewDriver creates a new [Driver] using this configuration.
	NewDriver(context.Context) (Driver, error)
}

Config describes the connection parameters for a persistence driver.

func FromURL

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

FromURL returns a Config for the backend identified by the URL scheme. See ParseURL for supported URL formats.

func ParseURL

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

ParseURL parses a driver URL string and returns a Config for the backend identified by the URL scheme.

The URL scheme selects the backend driver:

memory

In-memory stores, suitable for testing. Drivers with the same silo name share state for the lifetime of the process.

memory:///<silo>

postgres / postgresql

PostgreSQL-backed stores using a connection pool. Pool settings can be configured via URL query parameters; see [pgxpool.ParseConfig] for the full list.

postgres://user:password@host:port/database
postgresql://user:password@host:port/database?pool_max_conns=10

dynamodb

DynamoDB-backed stores. The path specifies a table name prefix; each primitive uses a separate table ("<prefix>-journal", "<prefix>-kv", "<prefix>-set").

dynamodb:///<table-prefix>
dynamodb://<host>:<port>/<table-prefix>?region=us-east-1&insecure

s3

S3-backed stores. The path specifies the bucket name.

s3:///<bucket>
s3://<endpoint>/<bucket>?region=us-east-1&insecure

The dynamodb and s3 schemes support the following query parameters:

  • region: AWS region (e.g. "us-east-1"); if omitted, resolved from the environment
  • role_arn: ARN of an IAM role to assume via STS
  • insecure: use HTTP instead of HTTPS for a custom endpoint (requires a host)

type Driver

type Driver interface {
	// JournalStore returns the journal store provided by this driver.
	JournalStore() journal.BinaryStore

	// KVStore returns the key/value store provided by this driver.
	KVStore() kv.BinaryStore

	// SetStore returns the set store provided by this driver.
	SetStore() set.BinaryStore

	// Close closes the driver, releasing any resources.
	Close() error
}

Driver provides access to the persistence stores of a specific driver.

Directories

Path Synopsis
driver
aws/dynamodb
Package dynamodb provides a persistence Driver backed by Amazon DynamoDB.
Package dynamodb provides a persistence Driver backed by Amazon DynamoDB.
aws/dynamodb/dynamojournal
Package dynamojournal provides an implementation of journal.BinaryStore that persists to a DynamoDB table.
Package dynamojournal provides an implementation of journal.BinaryStore that persists to a DynamoDB table.
aws/dynamodb/dynamokv
Package dynamokv provides a kv.BinaryStore implementation that persists to a DynamoDB table.
Package dynamokv provides a kv.BinaryStore implementation that persists to a DynamoDB table.
aws/dynamodb/dynamoset
Package dynamoset provides a set.BinaryStore implementation that persists to a DynamoDB table.
Package dynamoset provides a set.BinaryStore implementation that persists to a DynamoDB table.
aws/internal/x/xaws
Package xaws contains general purpose AWS utilities.
Package xaws contains general purpose AWS utilities.
aws/internal/x/xdynamodb
Package xdynamodb contains DynamoDB utilities.
Package xdynamodb contains DynamoDB utilities.
aws/internal/x/xs3
Package xs3 contains S3 utilities.
Package xs3 contains S3 utilities.
aws/s3
Package s3 provides a persistence Driver backed by Amazon S3.
Package s3 provides a persistence Driver backed by Amazon S3.
aws/s3/s3journal
Package s3journal provides an implementation of journal.BinaryStore that persists to an S3 bucket.
Package s3journal provides an implementation of journal.BinaryStore that persists to an S3 bucket.
aws/s3/s3kv
Package s3kv provides a kv.BinaryStore implementation that persists to an S3 bucket.
Package s3kv provides a kv.BinaryStore implementation that persists to an S3 bucket.
aws/s3/s3set
Package s3set provides a set.BinaryStore implementation that persists to an S3 bucket.
Package s3set provides a set.BinaryStore implementation that persists to an S3 bucket.
memory
Package memory provides an in-memory persistence Driver.
Package memory provides an in-memory persistence Driver.
memory/internal/clone
Package clone provides a protocol-buffers-aware deep clone function.
Package clone provides a protocol-buffers-aware deep clone function.
memory/memoryjournal
Package memoryjournal provides an in-memory implementation of journal.Store.
Package memoryjournal provides an in-memory implementation of journal.Store.
memory/memorykv
Package memorykv provides an in-memory implementation of kv.Store.
Package memorykv provides an in-memory implementation of kv.Store.
memory/memoryset
Package memoryset provides an in-memory implementation of set.BinaryStore.
Package memoryset provides an in-memory implementation of set.BinaryStore.
sql/postgres
Package postgres provides a persistence Driver backed by PostgreSQL.
Package postgres provides a persistence Driver backed by PostgreSQL.
sql/postgres/internal/bigint
Package bigint provides helpers to "bias encode" uint64 values as signed PostgreSQL int8 (bigint) values.
Package bigint provides helpers to "bias encode" uint64 values as signed PostgreSQL int8 (bigint) values.
sql/postgres/internal/pgerror
Package pgerror provides utilities for working with PostgreSQL errors.
Package pgerror provides utilities for working with PostgreSQL errors.
sql/postgres/internal/pgtest
Package pgtest provides utilities for testing code that interacts with PostgreSQL databases.
Package pgtest provides utilities for testing code that interacts with PostgreSQL databases.
sql/postgres/pgjournal
Package pgjournal provides an implementation of journal.BinaryStore that persists to a PostgreSQL database.
Package pgjournal provides an implementation of journal.BinaryStore that persists to a PostgreSQL database.
sql/postgres/pgkv
Package pgkv provides an implementation of kv.BinaryStore that persists to a PostgreSQL database.
Package pgkv provides an implementation of kv.BinaryStore that persists to a PostgreSQL database.
sql/postgres/pgset
Package pgset provides an implementation of set.BinaryStore that persists to a PostgreSQL database.
Package pgset provides an implementation of set.BinaryStore that persists to a PostgreSQL database.
internal
drivertest
Package drivertest provides test helpers that verify a Driver provides access to the expected stores.
Package drivertest provides test helpers that verify a Driver provides access to the expected stores.
kvrevision
Package kvrevision provides helpers for encoding and decoding kv revision generation counters.
Package kvrevision provides helpers for encoding and decoding kv revision generation counters.
x/xerrors
Package xerrors provides utilities for working with errors.
Package xerrors provides utilities for working with errors.
x/xtelemetry
Package xtelemetry provides telemetry utilities.
Package xtelemetry provides telemetry utilities.
x/xtesting
Package xtesting contains utilities for testing.
Package xtesting contains utilities for testing.
Package journal provides an abstraction of an append-only log with optimistic concurrency control.
Package journal provides an abstraction of an append-only log with optimistic concurrency control.
Package kv provides an abstraction of a non-transactional key/value store.
Package kv provides an abstraction of a non-transactional key/value store.
Package marshaler provides marshalers for converting values to and from their binary representations.
Package marshaler provides marshalers for converting values to and from their binary representations.
Package set provides an abstraction of a persisted set data type.
Package set provides an abstraction of a persisted set data type.

Jump to

Keyboard shortcuts

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