volume_rpc_server

package
v0.53.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the config identifier.

View Source
const ControllerID = "hydra/volume/rpc/server"

ControllerID is the rpc volume server controller id.

Variables

View Source
var Version = controller.MustParseVersion("0.0.1")

Version is the controller version.

Functions

func RegisterProxyVolume

func RegisterProxyVolume(mux srpc.Mux, proxyVol *ProxyVolume) error

RegisterProxyVolume registers all ProxyVolume services.

func RegisterProxyVolumeWithPrefix

func RegisterProxyVolumeWithPrefix(mux srpc.Mux, proxyVol *ProxyVolume, prefix string) error

RegisterProxyVolumeWithPrefix registers all ProxyVolume services with a service id prefix.

Types

type Config

type Config struct {

	// ServiceId is the service id to listen on.
	// Usually a prefix with: rpc.volume.AccessVolumes
	// Cannot be empty.
	ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"serviceId,omitempty"`
	// VolumeIdRe is a regex string to match volume IDs.
	// Set to '.*' to match all volumes.
	// ignored if empty.
	VolumeIdRe string `protobuf:"bytes,2,opt,name=volume_id_re,json=volumeIdRe,proto3" json:"volumeIdRe,omitempty"`
	// VolumeIdList is a list of volume IDs to match.
	// If the value is in this list, overrides volume_id_re.
	// ignored if empty.
	VolumeIdList []string `protobuf:"bytes,3,rep,name=volume_id_list,json=volumeIdList,proto3" json:"volumeIdList,omitempty"`
	// ExposePrivateKey enables callers to fetch the private key for the volume.
	// Defaults to false.
	ExposePrivateKey bool `protobuf:"varint,4,opt,name=expose_private_key,json=exposePrivateKey,proto3" json:"exposePrivateKey,omitempty"`
	// ReleaseDelay is a delay duration to wait before releasing a unreferenced volume.
	// If empty string, defaults to 1s (1 second).
	ReleaseDelay string `protobuf:"bytes,5,opt,name=release_delay,json=releaseDelay,proto3" json:"releaseDelay,omitempty"`
	// contains filtered or unexported fields
}

Config configures the rpc volume server. Provides the AccessVolumes RPC service. Accesses volumes with LookupVolume and other directives.

func NewConfig

func NewConfig(serviceID string, volumeIdList []string) *Config

NewConfig constructs a config with a volume id list.

func NewConfigWithRe

func NewConfigWithRe(serviceID, volumeIdRe string) *Config

NewConfigWithRe constructs a config with a volume id regex.

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

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetExposePrivateKey

func (x *Config) GetExposePrivateKey() bool

func (*Config) GetReleaseDelay

func (x *Config) GetReleaseDelay() string

func (*Config) GetServiceId

func (x *Config) GetServiceId() string

func (*Config) GetVolumeIdList

func (x *Config) GetVolumeIdList() []string

func (*Config) GetVolumeIdRe

func (x *Config) GetVolumeIdRe() 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) ParseReleaseDelay

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

ParseReleaseDelay parses the release delay field. Applies the default value if the field is empty.

func (*Config) ParseVolumeIdRe

func (c *Config) ParseVolumeIdRe() (*regexp.Regexp, error)

ParseVolumeIdRe parses the volume id regex field. Returns nil if the field was 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 configuration. This is a cursory validation to see if the values "look correct."

type Controller

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

Controller implements the rpc volume server.

func NewController

func NewController(
	le *logrus.Entry,
	bus bus.Bus,
	cc *Config,
) (*Controller, error)

NewController constructs a new rpc volume server.

func (*Controller) Close

func (c *Controller) Close() error

Close releases any resources used by the controller.

func (*Controller) Execute

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

Execute executes the controller goroutine.

func (*Controller) GetControllerInfo

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

GetControllerInfo returns information about the controller.

func (*Controller) GetRpcStreamMux

func (c *Controller) GetRpcStreamMux(ctx context.Context, volumeID string, _ func()) (srpc.Invoker, func(), error)

GetRpcStreamMux returns the mux for the given volume id proxy service.

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.

func (*Controller) InvokeMethod

func (c *Controller) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)

InvokeMethod invokes the method matching the service & method ID. Returns false, nil if not found. If service string is empty, ignore it.

func (*Controller) VolumeRpc

VolumeRpc uses the LookupVolume directive access a Volume handle. Exposes the ProxyVolume service. Id: volume id

func (*Controller) WatchVolumeInfo

WatchVolumeInfo watches information about a volume. The most recent message contains the most recently known state. If the volume was not found (directive is idle) returns empty.

type Factory

type Factory = bus.BusFactory[*Config, *Controller]

Factory constructs a controller.

func NewFactory

func NewFactory(b bus.Bus) *Factory

NewFactory builds the controller factory.

type ProxyVolume

type ProxyVolume struct {
	*rpc_block_server.BlockStore
	*rpc_bucket_server.BucketStore
	*rpc_object_server.ObjectStore
	*rpc_gc_server.RefGraph
	// contains filtered or unexported fields
}

ProxyVolume implements the ProxyVolume service with a Volume.

func NewProxyVolume

func NewProxyVolume(ctx context.Context, vol volume.Volume, exposePrivKey bool) *ProxyVolume

NewProxyVolume constructs a new ProxyVolume.

func (*ProxyVolume) GetCoordinatorCapability added in v0.52.0

GetCoordinatorCapability reports the remote coordinator capability.

func (*ProxyVolume) GetCoordinatorSnapshot added in v0.52.0

GetCoordinatorSnapshot returns the current remote coordinator snapshot.

func (*ProxyVolume) GetPeerPriv

GetPeerPriv returns the private key for the volume (if enabled).

func (*ProxyVolume) GetStorageStats

GetStorageStats returns storage usage statistics for the volume.

func (*ProxyVolume) GetVolume

func (v *ProxyVolume) GetVolume() volume.Volume

GetVolume returns the underlying volume.

func (*ProxyVolume) GetVolumeInfo

GetVolumeInfo returns the volume information.

func (*ProxyVolume) PublishCoordinatorWriteLease added in v0.52.0

PublishCoordinatorWriteLease publishes a remote write lease event.

func (*ProxyVolume) RefreshCoordinatorWriteLease added in v0.52.0

RefreshCoordinatorWriteLease refreshes a remote write lease.

func (*ProxyVolume) ReleaseCoordinatorWriteLease added in v0.52.0

ReleaseCoordinatorWriteLease releases a remote write lease.

func (*ProxyVolume) TryAcquireCoordinatorWriteLease added in v0.52.0

TryAcquireCoordinatorWriteLease attempts to acquire the remote write lease.

func (*ProxyVolume) WaitAcquireCoordinatorWriteLease added in v0.52.0

WaitAcquireCoordinatorWriteLease waits to acquire the remote write lease.

func (*ProxyVolume) WatchCoordinatorEvents added in v0.52.0

WatchCoordinatorEvents streams remote coordinator events.

Jump to

Keyboard shortcuts

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