{"modulePath":"github.com/onflow/flow-go","version":"v0.51.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package storage\n\n## Types\n\n```go\ntype DatastoreManager interface {\n\t// Datastore provides access to the datastore for performing batched\n\t// read and write operations.\n\tDatastore() ds.Batching\n\n\t// DB returns the raw database object, allowing for more direct\n\t// access to the underlying database features and operations.\n\tDB() storage.DB\n\n\t// Close terminates the connection to the datastore and releases\n\t// any associated resources. This method should be called\n\t// when finished using the datastore to ensure proper resource cleanup.\n\tClose() error\n\n\t// CollectGarbage initiates garbage collection on the datastore\n\t// to reclaim unused space and optimize performance.\n\tCollectGarbage(ctx context.Context) error\n}\n```\nDatastoreManager defines the interface for managing a datastore. It provides methods for accessing the datastore, the underlying database, closing the datastore, and performing garbage collection.\n\n```go\nfunc CreateDatastoreManager(\n\tlogger zerolog.Logger,\n\texecutionDataDir string,\n) (DatastoreManager, error)\n```\nCreateDatastoreManager creates a new datastore manager of the specified type. It supports both Badger and Pebble datastores.\n\n```go\ntype PebbleDatastoreManager struct {\n\t// contains filtered or unexported fields\n}\n```\nPebbleDatastoreManager wraps the PebbleDB to implement the StorageDB interface.\n\n```go\nfunc NewPebbleDatastoreManager(logger zerolog.Logger, path string, options *pebble.Options) (*PebbleDatastoreManager, error)\n```\nNewPebbleDatastoreManager 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.\n\nParameters:\n\n  - path: The path to the directory where the PebbleDB files will be stored.\n  - options: Configuration options for the PebbleDB database. If nil, default options are applied.\n\nNo errors are expected during normal operations.\n\n```go\nfunc (p *PebbleDatastoreManager) Close() error\n```\nClose 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.\n\n```go\nfunc (p *PebbleDatastoreManager) CollectGarbage(_ context.Context) error\n```\nCollectGarbage initiates garbage collection on the datastore to reclaim unused space and optimize performance.\n\n```go\nfunc (p *PebbleDatastoreManager) DB() storage.DB\n```\nDB returns the raw database object, allowing for more direct access to the underlying database features and operations.\n\n```go\nfunc (p *PebbleDatastoreManager) Datastore() ds.Batching\n```\nDatastore provides access to the datastore for performing batched read and write operations.\n\n","path":"github.com/onflow/flow-go/module/executiondatasync/storage","name":"storage","synopsis":"","isRedistributable":true}
