volume_block

package
v0.51.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

ControllerID identifies the block volume controller.

Variables

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 KVTxInmem implementation.

Functions

func InitVolume

func InitVolume(
	ctx context.Context,
	le *logrus.Entry,
	conf *Config,
	cursor *bucket_lookup.Cursor,
	nvolPriv crypto.PrivKey,
) (*bucket.ObjectRef, error)

InitVolume initializes a new volume w/ a private key.

Uses the transform config from the cursor.

Types

type Config

type Config struct {

	// KvKeyOpts are key/value key constants.
	KvKeyOpts *kvkey.Config `protobuf:"bytes,1,opt,name=kv_key_opts,json=kvKeyOpts,proto3" json:"kvKeyOpts,omitempty"`
	// Verbose will log all operations to the logger for debugging.
	Verbose bool `protobuf:"varint,2,opt,name=verbose,proto3" json:"verbose,omitempty"`
	// VolumeConfig is the volume controller config.
	VolumeConfig *controller.Config `protobuf:"bytes,3,opt,name=volume_config,json=volumeConfig,proto3" json:"volumeConfig,omitempty"`
	// StoreConfig is the store configuration for kvtx.
	StoreConfig *kvtx.Config `protobuf:"bytes,4,opt,name=store_config,json=storeConfig,proto3" json:"storeConfig,omitempty"`
	// NoGenerateKey indicates the controller should not generate a private key if
	// one is not already present. Setting this to false will cause the system to
	// create a new private key if one is not present in the store at startup. If
	// no key is in the store at startup and this is true, returns an error.
	NoGenerateKey bool `protobuf:"varint,5,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,13,opt,name=no_write_key,json=noWriteKey,proto3" json:"noWriteKey,omitempty"`
	// BucketId is the bucket id to attach to for reading/writing state.
	// If set, overrides the bucket id from init_head_ref and the state.
	// If unset, the bucket id is determined from head_ref.
	BucketId string `protobuf:"bytes,6,opt,name=bucket_id,json=bucketId,proto3" json:"bucketId,omitempty"`
	// VolumeId is the volume id to attach to for writing DB state.
	// If unset, init_head_ref must be set, and the db will be read-only.
	VolumeId string `protobuf:"bytes,7,opt,name=volume_id,json=volumeId,proto3" json:"volumeId,omitempty"`
	// ObjectStoreId is the hydra object store to open to store the HEAD ref.
	// If unset, init_head_ref must be set, and the db will be read-only.
	ObjectStoreId string `protobuf:"bytes,8,opt,name=object_store_id,json=objectStoreId,proto3" json:"objectStoreId,omitempty"`
	// ObjectStorePrefix is the prefix to use for all object store ops.
	ObjectStorePrefix string `protobuf:"bytes,9,opt,name=object_store_prefix,json=objectStorePrefix,proto3" json:"objectStorePrefix,omitempty"`
	// ObjectStoreHeadKey is the key to use in the object store for HEAD ref.
	//
	// Defaults to "volume-head"
	ObjectStoreHeadKey string `protobuf:"bytes,10,opt,name=object_store_head_key,json=objectStoreHeadKey,proto3" json:"objectStoreHeadKey,omitempty"`
	// InitHeadRef is the reference to the initial HEAD state of the database.
	// If the object store is empty, uses this reference to initialize it.
	// BucketId is overridden by BucketId field if it is set.
	InitHeadRef *bucket.ObjectRef `protobuf:"bytes,11,opt,name=init_head_ref,json=initHeadRef,proto3" json:"initHeadRef,omitempty"`
	// StateTransformConf transforms the HEAD ref before storing it in storage.
	StateTransformConf *transform.Config `protobuf:"bytes,12,opt,name=state_transform_conf,json=stateTransformConf,proto3" json:"stateTransformConf,omitempty"`
	// contains filtered or unexported fields
}

Config is the block graph backed hydra volume config.

func NewConfig

func NewConfig(
	volumeID, bucketID, objectStoreID string,
	initHeadRef *bucket.ObjectRef,
	stateTransformConf *block_transform.Config,
) *Config

NewConfig constructs a new block volume config.

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) GetBucketId

func (x *Config) GetBucketId() string

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) GetInitHeadRef

func (x *Config) GetInitHeadRef() *bucket.ObjectRef

func (*Config) GetKvKeyOpts

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

func (*Config) GetNoGenerateKey

func (x *Config) GetNoGenerateKey() bool

func (*Config) GetNoWriteKey

func (x *Config) GetNoWriteKey() bool

func (*Config) GetObjectStoreHeadKey

func (x *Config) GetObjectStoreHeadKey() string

func (*Config) GetObjectStoreId

func (x *Config) GetObjectStoreId() string

func (*Config) GetObjectStorePrefix

func (x *Config) GetObjectStorePrefix() string

func (*Config) GetStateTransformConf

func (x *Config) GetStateTransformConf() *transform.Config

func (*Config) GetStoreConfig

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

func (*Config) GetVerbose

func (x *Config) GetVerbose() bool

func (*Config) GetVolumeConfig

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

func (*Config) GetVolumeId

func (x *Config) GetVolumeId() string

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

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 block graph backed volume.

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds a 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 HeadState

type HeadState struct {

	// HeadRef is the reference to the current HEAD state of the volume.
	HeadRef *bucket.ObjectRef `protobuf:"bytes,1,opt,name=head_ref,json=headRef,proto3" json:"headRef,omitempty"`
	// contains filtered or unexported fields
}

HeadState contains the latest state of the volume.

value of the object stored in object storage.

func (*HeadState) CloneMessageVT

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

func (*HeadState) CloneVT

func (m *HeadState) CloneVT() *HeadState

func (*HeadState) EqualMessageVT

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

func (*HeadState) EqualVT

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

func (*HeadState) GetHeadRef

func (x *HeadState) GetHeadRef() *bucket.ObjectRef

func (*HeadState) MarshalJSON

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

MarshalJSON marshals the HeadState to JSON.

func (*HeadState) MarshalProtoJSON

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

MarshalProtoJSON marshals the HeadState message to JSON.

func (*HeadState) MarshalProtoText

func (x *HeadState) MarshalProtoText() string

func (*HeadState) MarshalToSizedBufferVT

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

func (*HeadState) MarshalToVT

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

func (*HeadState) MarshalVT

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

func (*HeadState) ProtoMessage

func (*HeadState) ProtoMessage()

func (*HeadState) Reset

func (x *HeadState) Reset()

func (*HeadState) SizeVT

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

func (*HeadState) String

func (x *HeadState) String() string

func (*HeadState) UnmarshalJSON

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

UnmarshalJSON unmarshals the HeadState from JSON.

func (*HeadState) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the HeadState message from JSON.

func (*HeadState) UnmarshalVT

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

type Volume

type Volume struct {
	*common_kvtx.Volume
	// contains filtered or unexported fields
}

Volume implements a block-graph kvtx backed volume.

func NewVolume

func NewVolume(
	ctx context.Context,
	le *logrus.Entry,
	b bus.Bus,
	sfs *block_transform.StepFactorySet,
	conf *Config,
) (v *Volume, err error)

NewVolume builds the block-graph volume storing state in a object store.

Jump to

Keyboard shortcuts

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