storage

package module
v0.0.0-...-c36b4a8 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: BSD-2-Clause Imports: 9 Imported by: 0

README

Go Reference Code Coverage Telegram EN Telegram RU

go-storage: library to manage centralized configuration storages

Documentation

Overview

Package storage provides a uniform way to handle various types of centralized config storages for Tarantool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*storageOptions)

Option is a function that configures storage options.

func WithRetry

func WithRetry() Option

WithRetry configures retry behavior for failed operations. This is a dummy option for demonstration purposes.

func WithTimeout

func WithTimeout() Option

WithTimeout configures a default timeout for storage operations. This is a dummy option for demonstration purposes.

type RangeOption

type RangeOption func(*rangeOptions)

RangeOption is a function that configures range operation options.

func WithLimit

func WithLimit(limit int) RangeOption

WithLimit configures a range operation to limit the number of results returned.

func WithPrefix

func WithPrefix(prefix string) RangeOption

WithPrefix configures a range operation to filter keys by the specified prefix.

type Storage

type Storage interface {
	// Watch streams changes for a specific key or prefix.
	// Options:
	//   - WithPrefix: watch for changes on keys with the specified prefix
	Watch(ctx context.Context, key []byte, opts ...watch.Option) <-chan watch.Event

	// Tx creates a new transaction.
	// The context manages timeouts and cancellation for the transaction.
	Tx(ctx context.Context) txPkg.Tx

	// Range queries a range of keys with optional filtering.
	// Options:
	//   - WithPrefix: filter keys by prefix
	//   - WithLimit: limit the number of results returned
	Range(ctx context.Context, opts ...RangeOption) ([]kv.KeyValue, error)
}

Storage is the main interface for key-value storage operations. It provides methods for watching changes, transaction management, and range queries.

func NewStorage

func NewStorage(driver driver.Driver, _ ...Option) Storage

NewStorage creates a new Storage instance with the specified driver. Optional StorageOption parameters can be provided to configure the storage.

Directories

Path Synopsis
Package crypto implements crypto interfaces.
Package crypto implements crypto interfaces.
Package driver defines the interface for storage driver implementations.
Package driver defines the interface for storage driver implementations.
etcd
Package etcd provides an etcd implementation of the storage driver interface.
Package etcd provides an etcd implementation of the storage driver interface.
tcs
Package tcs provides a Tarantool config storage driver implementation.
Package tcs provides a Tarantool config storage driver implementation.
Package hasher provides types and interfaces for hash calculating.
Package hasher provides types and interfaces for hash calculating.
internal
mocks
Package mocks provides generated mock implementations for testing.
Package mocks provides generated mock implementations for testing.
testing
Package testing provides a mock implementation of the tarantool.Doer and other interfaces.
Package testing provides a mock implementation of the tarantool.Doer and other interfaces.
Package kv provides key-value data structures and interfaces for storage operations.
Package kv provides key-value data structures and interfaces for storage operations.
Package marshaller represent interface to transformation.
Package marshaller represent interface to transformation.
Package namer represent interface to templates creation.
Package namer represent interface to templates creation.
Package operation provides types and interfaces for storage operations.
Package operation provides types and interfaces for storage operations.
Package predicate provides types and interfaces for conditional operations.
Package predicate provides types and interfaces for conditional operations.
Package tx provides transactional interfaces for atomic storage operations.
Package tx provides transactional interfaces for atomic storage operations.
Package watch provides change notification functionality for storage operations.
Package watch provides change notification functionality for storage operations.

Jump to

Keyboard shortcuts

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