database

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrefixPeer defines the prefix of the peer db.
	PrefixPeer byte = iota

	// PrefixHealth defines the prefix of the health db.
	PrefixHealth

	// PrefixMesh defines the storage prefix for the mesh.
	PrefixMesh

	// PrefixMarkers defines the storage prefix for the markers used to optimize structural checks in the mesh.
	PrefixMarkers

	// PrefixLedger defines the storage prefix for the ledger package.
	PrefixLedger

	// PrefixIndexer defines the storage prefix for the indexer package.
	PrefixIndexer

	// PrefixConflictDAG defines the storage prefix for the conflictDAG package.
	PrefixConflictDAG

	// PrefixMana defines the storage prefix for the mana package.
	PrefixMana

	// PrefixNotarization defines the storage prefix for the epochs package.
	PrefixNotarization

	// PrefixEpochsStorage defines the storage prefix for the epoch storage plugin.
	PrefixEpochsStorage
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheTimeProvider

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

CacheTimeProvider should be always used to get the CacheTime option for storage It wraps around objectstorage.CacheTime() function and may override the input duration.

func NewCacheTimeProvider

func NewCacheTimeProvider(forceCacheTime time.Duration) *CacheTimeProvider

NewCacheTimeProvider creates an instance that forces cache time to always be a certain value. If the given value is negative, hard coded defaults will be used.

func (*CacheTimeProvider) CacheTime

func (m *CacheTimeProvider) CacheTime(duration time.Duration) objectstorage.Option

CacheTime returns a CacheTime option. Duration may be overridden if CacheTimeProvider parameter is a non-negative integer.

type DB

type DB interface {
	// NewStore creates a new KVStore backed by the database.
	NewStore() kvstore.KVStore
	// Close closes a DB.
	Close() error

	// RequiresGC returns whether the database requires a call of GC() to clean deleted items.
	RequiresGC() bool
	// GC runs the garbage collection to clean deleted database items.
	GC() error
}

DB represents a database abstraction.

func NewDB

func NewDB(dirname string) (DB, error)

NewDB returns a new persisting DB object.

func NewMemDB

func NewMemDB() (DB, error)

NewMemDB returns a new in-memory (not persisted) DB object.

Jump to

Keyboard shortcuts

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