volume_controller

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// DisableEventBlockRm disables the block removed event.
	//
	// Optimization: skips exists() before delete.
	DisableEventBlockRm bool `protobuf:"varint,1,opt,name=disable_event_block_rm,json=disableEventBlockRm,proto3" json:"disableEventBlockRm,omitempty"`
	// VolumeIdAlias matches LookupVolume and LookupBlockStore calls for the given ids.
	VolumeIdAlias []string `protobuf:"bytes,2,rep,name=volume_id_alias,json=volumeIdAlias,proto3" json:"volumeIdAlias,omitempty"`
	// DisablePeer disables loading the peer controller from the volume.
	DisablePeer bool `protobuf:"varint,4,opt,name=disable_peer,json=disablePeer,proto3" json:"disablePeer,omitempty"`
	// DisableLookupBlockStore disables resolving LookupBlockStore when using the
	// volume ID for the store_id field.
	DisableLookupBlockStore bool `` /* 132-byte string literal not displayed */
	// BlockStoreId configures using a separate block store for blocks.
	// uses LookupBlockStore to lookup the block store on the bus.
	BlockStoreId string `protobuf:"bytes,5,opt,name=block_store_id,json=blockStoreId,proto3" json:"blockStoreId,omitempty"`
	// BlockStoreOverlayMode indicates the mode to use for the block store.
	// The volume is the lower store, the block store is the upper store.
	// Does nothing if block_store_id is empty.
	BlockStoreOverlayMode block.OverlayMode `` /* 126-byte string literal not displayed */
	// BlockStoreWritebackTimeoutDur is the timeout for writing back blocks.
	// If block_store_id or block_store_overlay_mode do not enable writeback, this is N/A.
	// Example: 30s
	BlockStoreWritebackTimeoutDur string `` /* 150-byte string literal not displayed */
	// BlockStoreWritebackPutOpts are the base put options for writing back blocks.
	// If block_store_id or block_store_overlay_mode do not enable writeback, this is N/A.
	BlockStoreWritebackPutOpts *block.PutOpts `` /* 141-byte string literal not displayed */
	// GcIntervalDur is the interval between GC sweeps.
	// Default: 1m. Set to 0s to disable periodic GC.
	// Example: 1m
	GcIntervalDur string `protobuf:"bytes,10,opt,name=gc_interval_dur,json=gcIntervalDur,proto3" json:"gcIntervalDur,omitempty"`
	// contains filtered or unexported fields
}

Config configures the generic volume controller.

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) GCDisabled added in v0.51.7

func (c *Config) GCDisabled() bool

GCDisabled returns whether volume GC tracking and sweeps are disabled.

func (*Config) GetBlockStoreId

func (x *Config) GetBlockStoreId() string

func (*Config) GetBlockStoreOverlayMode

func (x *Config) GetBlockStoreOverlayMode() block.OverlayMode

func (*Config) GetBlockStoreWritebackPutOpts

func (x *Config) GetBlockStoreWritebackPutOpts() *block.PutOpts

func (*Config) GetBlockStoreWritebackTimeoutDur

func (x *Config) GetBlockStoreWritebackTimeoutDur() string

func (*Config) GetDisableEventBlockRm

func (x *Config) GetDisableEventBlockRm() bool

func (*Config) GetDisableLookupBlockStore

func (x *Config) GetDisableLookupBlockStore() bool

func (*Config) GetDisablePeer

func (x *Config) GetDisablePeer() bool

func (*Config) GetGcIntervalDur

func (x *Config) GetGcIntervalDur() string

func (*Config) GetVolumeIdAlias

func (x *Config) GetVolumeIdAlias() []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) ParseBlockStoreWritebackTimeoutDur

func (c *Config) ParseBlockStoreWritebackTimeoutDur() (time.Duration, error)

ParseBlockStoreWritebackTimeoutDur parses the block store writeback timeout field. Returns 0, nil if empty.

func (*Config) ParseGCIntervalDur

func (c *Config) ParseGCIntervalDur() (time.Duration, error)

ParseGCIntervalDur parses the GC interval duration field. Returns defaultGCInterval if empty.

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 config.

type Controller

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

Controller implements a common volume controller.

The controller manages a volume's lifecycle, including setup, teardown, garbage collection, and background tasks. The volume interface is implemented by many volume types, which then use the common volume controller.

func NewController

func NewController(
	le *logrus.Entry,
	config *Config,
	bus bus.Bus,
	info *controller.Info,
	ctor volume.Constructor,
) *Controller

NewController constructs a new volume controller.

func (*Controller) BuildBucketAPI

func (c *Controller) BuildBucketAPI(
	ctx context.Context,
	bucketID string,
) (bucket.BucketHandle, func(), error)

BuildBucketAPI builds an API handle for the bucket ID in the volume. The handles are valid while ctx is valid. Returns a release function.

func (*Controller) Close

func (c *Controller) Close() error

Close releases any resources used by the controller. Error indicates any issue encountered releasing.

func (*Controller) Execute

func (c *Controller) Execute(ctx context.Context) error

Execute executes the controller goroutine. Returning nil ends execution. Returning an error triggers a retry with backoff.

func (*Controller) GetControllerInfo

func (c *Controller) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

func (*Controller) GetVolume

func (c *Controller) GetVolume(ctx context.Context) (volume.Volume, error)

GetVolume returns the controlled volume. This may wait for the volume to be ready. If construction failed permanently (for example, the browser denied OPFS storage for this profile), it returns that error instead of waiting for a volume that can never be constructed.

func (*Controller) HandleDirective

func (c *Controller) HandleDirective(
	ctx context.Context,
	di directive.Instance,
) ([]directive.Resolver, error)

HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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