Documentation
¶
Index ¶
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) GCDisabled() bool
- func (x *Config) GetBlockStoreId() string
- func (x *Config) GetBlockStoreOverlayMode() block.OverlayMode
- func (x *Config) GetBlockStoreWritebackPutOpts() *block.PutOpts
- func (x *Config) GetBlockStoreWritebackTimeoutDur() string
- func (x *Config) GetDisableEventBlockRm() bool
- func (x *Config) GetDisableLookupBlockStore() bool
- func (x *Config) GetDisablePeer() bool
- func (x *Config) GetGcIntervalDur() string
- func (x *Config) GetVolumeIdAlias() []string
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (c *Config) ParseBlockStoreWritebackTimeoutDur() (time.Duration, error)
- func (c *Config) ParseGCIntervalDur() (time.Duration, error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Controller
- func (c *Controller) BuildBucketAPI(ctx context.Context, bucketID string) (bucket.BucketHandle, func(), error)
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetVolume(ctx context.Context) (volume.Volume, error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
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) EqualMessageVT ¶
func (*Config) GCDisabled ¶ added in v0.51.7
GCDisabled returns whether volume GC tracking and sweeps are disabled.
func (*Config) GetBlockStoreId ¶
func (*Config) GetBlockStoreOverlayMode ¶
func (x *Config) GetBlockStoreOverlayMode() block.OverlayMode
func (*Config) GetBlockStoreWritebackPutOpts ¶
func (*Config) GetBlockStoreWritebackTimeoutDur ¶
func (*Config) GetDisableEventBlockRm ¶
func (*Config) GetDisableLookupBlockStore ¶
func (*Config) GetDisablePeer ¶
func (*Config) GetGcIntervalDur ¶
func (*Config) GetVolumeIdAlias ¶
func (*Config) MarshalJSON ¶
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 (*Config) MarshalToSizedBufferVT ¶
func (*Config) ParseBlockStoreWritebackTimeoutDur ¶
ParseBlockStoreWritebackTimeoutDur parses the block store writeback timeout field. Returns 0, nil if empty.
func (*Config) ParseGCIntervalDur ¶
ParseGCIntervalDur parses the GC interval duration field. Returns defaultGCInterval if empty.
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
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 ¶
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 ¶
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.