Help us shape the future of Go! Take the 2026 Go Developer Survey

storage

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatastoreManager

type DatastoreManager interface {
	// Datastore provides access to the datastore for performing batched
	// read and write operations.
	Datastore() ds.Batching

	// DB returns the raw database object, allowing for more direct
	// access to the underlying database features and operations.
	DB() storage.DB

	// Close terminates the connection to the datastore and releases
	// any associated resources. This method should be called
	// when finished using the datastore to ensure proper resource cleanup.
	Close() error

	// CollectGarbage initiates garbage collection on the datastore
	// to reclaim unused space and optimize performance.
	CollectGarbage(ctx context.Context) error
}

DatastoreManager defines the interface for managing a datastore. It provides methods for accessing the datastore, the underlying database, closing the datastore, and performing garbage collection.

func CreateDatastoreManager added in v0.43.0

func CreateDatastoreManager(
	logger zerolog.Logger,
	executionDataDir string,
) (DatastoreManager, error)

CreateDatastoreManager creates a new datastore manager of the specified type. It supports both Badger and Pebble datastores.

type PebbleDatastoreManager

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

PebbleDatastoreManager wraps the PebbleDB to implement the StorageDB interface.

func NewPebbleDatastoreManager

func NewPebbleDatastoreManager(logger zerolog.Logger, path string, options *pebble.Options) (*PebbleDatastoreManager, error)

NewPebbleDatastoreManager creates and returns a new instance of PebbleDatastoreManager. It initializes the PebbleDB database with the specified path and options. If no options are provided, default options are used.

Parameters:

  • path: The path to the directory where the PebbleDB files will be stored.
  • options: Configuration options for the PebbleDB database. If nil, default options are applied.

No errors are expected during normal operations.

func (*PebbleDatastoreManager) Close

func (p *PebbleDatastoreManager) Close() error

Close terminates the connection to the datastore and releases any associated resources. This method should be called when finished using the datastore to ensure proper resource cleanup.

func (*PebbleDatastoreManager) CollectGarbage

func (p *PebbleDatastoreManager) CollectGarbage(_ context.Context) error

CollectGarbage initiates garbage collection on the datastore to reclaim unused space and optimize performance.

func (*PebbleDatastoreManager) DB

DB returns the raw database object, allowing for more direct access to the underlying database features and operations.

func (*PebbleDatastoreManager) Datastore

func (p *PebbleDatastoreManager) Datastore() ds.Batching

Datastore provides access to the datastore for performing batched read and write operations.

Jump to

Keyboard shortcuts

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