volume_sqlite

package
v0.51.4 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ControllerID = "hydra/volume/sqlite"

ControllerID identifies the Sqlite volume controller.

Variables

View Source
var (
	TempStore_name = map[int32]string{
		0: "TempStore_DEFAULT",
		1: "TempStore_FILE",
		2: "TempStore_MEMORY",
	}
	TempStore_value = map[string]int32{
		"TempStore_DEFAULT": 0,
		"TempStore_FILE":    1,
		"TempStore_MEMORY":  2,
	}
)

Enum value maps for TempStore.

View Source
var ConfigID = ControllerID

ConfigID is the id attached to the config objects.

View Source
var Version = semver.MustParse("0.0.1")

Version is the version of the sqlite implementation.

Functions

This section is empty.

Types

type Config

type Config struct {

	// Path is the file to store the data in.
	Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// Table is the table to store the data in.
	// The table will be created on startup if not exists.
	Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`
	// KvKeyOpts are key/value options.
	KvKeyOpts *kvkey.Config `protobuf:"bytes,3,opt,name=kv_key_opts,json=kvKeyOpts,proto3" json:"kvKeyOpts,omitempty"`
	// Verbose indicates we should log every operation.
	Verbose bool `protobuf:"varint,4,opt,name=verbose,proto3" json:"verbose,omitempty"`
	// VolumeConfig is the volume controller config.
	VolumeConfig *controller.Config `protobuf:"bytes,5,opt,name=volume_config,json=volumeConfig,proto3" json:"volumeConfig,omitempty"`
	// StoreConfig is the store configuration for kvtx.
	StoreConfig *kvtx.Config `protobuf:"bytes,6,opt,name=store_config,json=storeConfig,proto3" json:"storeConfig,omitempty"`
	// NoGenerateKey indicates to skip generating a private key.
	// This has no effect if a key already exists.
	NoGenerateKey bool `protobuf:"varint,7,opt,name=no_generate_key,json=noGenerateKey,proto3" json:"noGenerateKey,omitempty"`
	// NoWriteKey indicates the controller should not write a private key to
	// storage if it generates one. This results in an ephemeral volume peer
	// identity if there is no key present in the store already.
	//
	// Has no effect if the store has a peer private key.
	NoWriteKey bool `protobuf:"varint,8,opt,name=no_write_key,json=noWriteKey,proto3" json:"noWriteKey,omitempty"`
	// CacheSize sets the SQLite cache_size pragma. Positive values are pages,
	// negative values are KiB. 0 leaves the SQLite default (-2000, ~2 MiB).
	CacheSize int32 `protobuf:"varint,9,opt,name=cache_size,json=cacheSize,proto3" json:"cacheSize,omitempty"`
	// MmapSize sets the SQLite mmap_size pragma in bytes. 0 leaves the SQLite
	// default (0, mmap disabled). Capped by the compile-time max mmap size.
	MmapSize int64 `protobuf:"varint,10,opt,name=mmap_size,json=mmapSize,proto3" json:"mmapSize,omitempty"`
	// TempStore selects the SQLite temp_store pragma. Defaults to the SQLite
	// compiled default when unset.
	TempStore TempStore `protobuf:"varint,11,opt,name=temp_store,json=tempStore,proto3" json:"tempStore,omitempty"`
	// PageSize sets the SQLite page_size pragma in bytes. Must be a power of
	// two between 512 and 65536. 0 leaves the SQLite default (4096). Only
	// takes effect on a fresh database; ignored if the file already exists.
	PageSize int32 `protobuf:"varint,12,opt,name=page_size,json=pageSize,proto3" json:"pageSize,omitempty"`
	// contains filtered or unexported fields
}

Config is the sqlite volume controller config.

func NewConfig

func NewConfig(path string, table string) *Config

NewConfig constructs the configuration with the path and table.

func (*Config) CloneMessageVT

func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Config) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

EqualsConfig checks if the config is equal to another.

func (*Config) GetCacheSize added in v0.51.0

func (x *Config) GetCacheSize() int32

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type. This string is stored with the encoded config.

func (*Config) GetKvKeyOpts

func (x *Config) GetKvKeyOpts() *kvkey.Config

func (*Config) GetMmapSize added in v0.51.0

func (x *Config) GetMmapSize() int64

func (*Config) GetNoGenerateKey

func (x *Config) GetNoGenerateKey() bool

func (*Config) GetNoWriteKey

func (x *Config) GetNoWriteKey() bool

func (*Config) GetPageSize added in v0.51.0

func (x *Config) GetPageSize() int32

func (*Config) GetPath

func (x *Config) GetPath() string

func (*Config) GetStoreConfig

func (x *Config) GetStoreConfig() *kvtx.Config

func (*Config) GetTable

func (x *Config) GetTable() string

func (*Config) GetTempStore added in v0.51.0

func (x *Config) GetTempStore() TempStore

func (*Config) GetVerbose

func (x *Config) GetVerbose() bool

func (*Config) GetVolumeConfig

func (x *Config) GetVolumeConfig() *controller.Config

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Config to JSON.

func (*Config) MarshalProtoJSON

func (x *Config) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Config message to JSON.

func (*Config) MarshalProtoText

func (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Config from JSON.

func (*Config) UnmarshalProtoJSON

func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Config message from JSON.

func (*Config) UnmarshalVT

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration. This is a cursory validation to see if the values "look correct."

type Factory

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

Factory constructs a sqlite volume.

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds a sqlite volume factory.

func (*Factory) Construct

func (t *Factory) Construct(
	ctx context.Context,
	conf config.Config,
	opts controller.ConstructOpts,
) (controller.Controller, error)

Construct constructs the associated controller given configuration.

func (*Factory) ConstructConfig

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the unique ID for the config.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

GetControllerID returns the unique ID for the controller.

func (*Factory) GetVersion

func (t *Factory) GetVersion() semver.Version

GetVersion returns the version of this controller.

type Sqlite

type Sqlite = kvtx.Volume

Sqlite implements a SqliteDB backed volume.

func NewSqlite

func NewSqlite(
	ctx context.Context,
	le *logrus.Entry,
	conf *Config,
) (*Sqlite, error)

NewSqlite builds a new Sqlite volume, opening the database.

type TempStore added in v0.51.0

type TempStore int32

TempStore selects the SQLite temp_store pragma value.

const (
	// TempStore_DEFAULT uses the SQLite-compiled default (file).
	TempStore_TempStore_DEFAULT TempStore = 0
	// TempStore_FILE forces temp tables and indexes onto disk.
	TempStore_TempStore_FILE TempStore = 1
	// TempStore_MEMORY keeps temp tables and indexes in memory.
	TempStore_TempStore_MEMORY TempStore = 2
)

func (TempStore) Enum added in v0.51.0

func (x TempStore) Enum() *TempStore

func (TempStore) MarshalJSON added in v0.51.0

func (x TempStore) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TempStore to JSON.

func (TempStore) MarshalProtoJSON added in v0.51.0

func (x TempStore) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TempStore to JSON.

func (TempStore) MarshalProtoText added in v0.51.0

func (x TempStore) MarshalProtoText() string

func (TempStore) MarshalText added in v0.51.0

func (x TempStore) MarshalText() ([]byte, error)

MarshalText marshals the TempStore to text.

func (TempStore) String added in v0.51.0

func (x TempStore) String() string

func (*TempStore) UnmarshalJSON added in v0.51.0

func (x *TempStore) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TempStore from JSON.

func (*TempStore) UnmarshalProtoJSON added in v0.51.0

func (x *TempStore) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TempStore from JSON.

func (*TempStore) UnmarshalText added in v0.51.0

func (x *TempStore) UnmarshalText(b []byte) error

UnmarshalText unmarshals the TempStore from text.

Jump to

Keyboard shortcuts

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