factory

package
v1.0.0-genesis Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.16.14

type Config struct {
	// The data directory for the database
	Dir string

	// The name of the database
	Name string

	// The engine to use for the database
	Engine Engine

	// Logger to use for the database
	Log log.Logger

	// LevelDB specific configuration
	CacheSize                     int
	WriteBufferSize               int
	HandleCap                     int
	BitsPerKey                    int
	CompactionTableSize           int
	CompactionTableSizeMultiplier float64
	CompactionTotalSize           int
	CompactionTotalSizeMultiplier float64

	// Pebble specific configuration
	BytesPerSync                int
	WALBytesPerSync             int
	MemTableStopWritesThreshold int
	MemTableSize                uint64
	MaxOpenFiles                int
	MaxConcurrentCompactions    func() int
}

Config contains database configuration

type DefaultFactory added in v1.16.14

type DefaultFactory struct{}

DefaultFactory is the default implementation of Factory

func (*DefaultFactory) New added in v1.16.14

func (f *DefaultFactory) New(config *Config) (database.Database, error)

New creates a new database instance based on the configuration

type Engine added in v1.16.14

type Engine int

Engine is the type of database engine

const (
	// LevelDB is a LevelDB database
	LevelDB Engine = iota
	// Memory is an in-memory database
	Memory
	// Pebble is a PebbleDB database
	Pebble
)

type Factory added in v1.16.14

type Factory interface {
	// New returns a new database instance
	New(config *Config) (database.Database, error)
}

Factory creates new database instances

func New

func New() Factory

New returns a new default factory

Jump to

Keyboard shortcuts

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