Help us shape the future of Go! Take the 2026 Go Developer Survey

volume_rpc_client

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the config identifier.

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

ControllerID is the rpc volume client controller id.

Variables

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

Version is the controller version.

Functions

This section is empty.

Types

type Config

type Config struct {

	// ServiceId is the service id to use.
	// Must resolve to the AccessVolumes service.
	// Usually: 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.
	// Matched volume IDs are forwarded to the RPC service.
	// Matched volume IDs may not necessarily exist on the remote.
	// Set to empty or '.*' to match all volumes.
	// If volume_id_list is set, it can override this value.
	VolumeIdRe string `protobuf:"bytes,2,opt,name=volume_id_re,json=volumeIdRe,proto3" json:"volumeIdRe,omitempty"`
	// VolumeIdList returns a specific list of volumes to match.
	// If empty, uses the VolumeIDRe field instead.
	VolumeIdList []string `protobuf:"bytes,3,rep,name=volume_id_list,json=volumeIdList,proto3" json:"volumeIdList,omitempty"`
	// LoadOnStartup loads the volume_id_list on startup.
	LoadOnStartup bool `protobuf:"varint,8,opt,name=load_on_startup,json=loadOnStartup,proto3" json:"loadOnStartup,omitempty"`
	// ClientId is the client id to use.
	// May be empty.
	ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"clientId,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"`
	// VolumeAliases contains aliases to assign to proxied volumes.
	// Key = the destination volume ID.
	// Value = contains source volume IDs to match.
	// Volume IDs listed here will be proxied regardless of the regex or list set above.
	VolumeAliases map[string]*VolumeAliases `` /* 187-byte string literal not displayed */
	// Backoff controls retry backoff for the volume rpc client.
	Backoff *backoff.Backoff `protobuf:"bytes,7,opt,name=backoff,proto3" json:"backoff,omitempty"`
	// contains filtered or unexported fields
}

Config configures the rpc volume client. Accesses the AccessVolumes RPC service.

func NewConfig

func NewConfig(serviceID, volumeIdRe string) *Config

NewConfig constructs a config.

volumeIdRe is optional.

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

func (x *Config) GetBackoff() *backoff.Backoff

func (*Config) GetClientId

func (x *Config) GetClientId() string

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetLoadOnStartup

func (x *Config) GetLoadOnStartup() bool

func (*Config) GetReleaseDelay

func (x *Config) GetReleaseDelay() string

func (*Config) GetServiceId

func (x *Config) GetServiceId() string

func (*Config) GetVolumeAliases

func (x *Config) GetVolumeAliases() map[string]*VolumeAliases

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 Config_VolumeAliasesEntry

type Config_VolumeAliasesEntry struct {
	Key   string         `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value *VolumeAliases `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Config_VolumeAliasesEntry) GetKey

func (x *Config_VolumeAliasesEntry) GetKey() string

func (*Config_VolumeAliasesEntry) GetValue

func (*Config_VolumeAliasesEntry) MarshalJSON

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

MarshalJSON marshals the Config_VolumeAliasesEntry to JSON.

func (*Config_VolumeAliasesEntry) MarshalProtoJSON

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

MarshalProtoJSON marshals the Config_VolumeAliasesEntry message to JSON.

func (*Config_VolumeAliasesEntry) MarshalProtoText

func (x *Config_VolumeAliasesEntry) MarshalProtoText() string

func (*Config_VolumeAliasesEntry) ProtoMessage

func (*Config_VolumeAliasesEntry) ProtoMessage()

func (*Config_VolumeAliasesEntry) Reset

func (x *Config_VolumeAliasesEntry) Reset()

func (*Config_VolumeAliasesEntry) String

func (x *Config_VolumeAliasesEntry) String() string

func (*Config_VolumeAliasesEntry) UnmarshalJSON

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

UnmarshalJSON unmarshals the Config_VolumeAliasesEntry from JSON.

func (*Config_VolumeAliasesEntry) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the Config_VolumeAliasesEntry message from JSON.

type Controller

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

Controller implements the rpc volume client.

func NewController

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

NewController constructs a new rpc volume client.

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

func (c *Controller) LoadProxyVolume(ctx context.Context, volumeID string) (volume.Controller, func(), error)

LoadProxyVolume loads the proxy volume by ID. Returns a function to release the volume reference. Returns an error if the volume id does not match this controller.

type Coordinator added in v0.52.0

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

Coordinator negotiates remote coordination capability for a ProxyVolume.

func NewCoordinator added in v0.52.0

func NewCoordinator(client volume_rpc.SRPCProxyVolumeClient) *Coordinator

NewCoordinator constructs an RPC-backed coordinator facade.

func (*Coordinator) Capability added in v0.52.0

func (c *Coordinator) Capability(ctx context.Context, scope coord.Scope) (*coord.Capability, error)

Capability reports the server's structured remote coordination capability.

func (*Coordinator) Snapshot added in v0.52.0

func (c *Coordinator) Snapshot(ctx context.Context, scope coord.Scope) (*coord.Snapshot, error)

Snapshot returns the remote coordination snapshot.

func (*Coordinator) TryAcquireWriteLease added in v0.52.0

func (c *Coordinator) TryAcquireWriteLease(ctx context.Context, scope coord.Scope) (coord.WriteLease, bool, error)

TryAcquireWriteLease attempts to acquire the remote write lease.

The acquire stream stays open for the lease lifetime: the server releases the lease when the stream ends, and the client reports loss through WriteLease.Done when the stream ends first.

func (*Coordinator) WaitAcquireWriteLease added in v0.52.0

func (c *Coordinator) WaitAcquireWriteLease(ctx context.Context, scope coord.Scope) (coord.WriteLease, error)

WaitAcquireWriteLease waits to acquire the remote write lease.

func (*Coordinator) Watch added in v0.52.0

func (c *Coordinator) Watch(ctx context.Context, scope coord.Scope, afterGeneration uint64) (coord.Watch, error)

Watch streams remote coordination events through the ProxyVolume service.

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 LoadProxyVolumeResolver

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

LoadProxyVolumeResolver loads a proxy volume for a directive. Exits once the proxy volume controller is fully running. Does not directly resolve the directive.

func NewLoadProxyVolumeResolver

func NewLoadProxyVolumeResolver(c *Controller, di directive.Instance, volumeID string) *LoadProxyVolumeResolver

NewLoadProxyVolumeResolver constructs a new LoadProxyVolumeResolver.

func (*LoadProxyVolumeResolver) Resolve

Resolve resolves the values, emitting them to the handler.

type ProxyVolume

type ProxyVolume struct {
	*rpc_block_client.BlockStore
	*rpc_bucket_client.BucketStore
	*rpc_object_client.ObjectStore
	coord.Coordinator
	// contains filtered or unexported fields
}

ProxyVolume implements a volume backed by a ProxyVolume service.

func NewProxyVolume

func NewProxyVolume(
	volInfo *volume.VolumeInfo,
	proxyVolumeClient volume_rpc.SRPCProxyVolumeClient,
	blockStoreClient rpc_block.SRPCBlockStoreClient,
	bucketStoreClient rpc_bucket.SRPCBucketStoreClient,
	objectStoreClient rpc_object.SRPCObjectStoreClient,
	refGraphClient rpc_gc.SRPCRefGraphClient,
) (*ProxyVolume, error)

NewProxyVolume constructs a new ProxyVolume.

func (*ProxyVolume) Close

func (v *ProxyVolume) Close() error

Close closes the volume, returning any errors.

func (*ProxyVolume) Delete

func (v *ProxyVolume) Delete() error

Delete closes the volume and removes the backing store. ProxyVolume does not own a backing store, so this is a no-op.

func (*ProxyVolume) Execute

func (v *ProxyVolume) Execute(ctx context.Context) error

Execute executes the volume store.

func (*ProxyVolume) GetID

func (v *ProxyVolume) GetID() string

GetID returns the volume ID, should be derived from the peer ID.

func (*ProxyVolume) GetPeer

func (v *ProxyVolume) GetPeer(ctx context.Context, withPriv bool) (peer.Peer, error)

GetPeer returns the Peer object. If withPriv=false ensure that the Peer returned does not have the private key.

func (*ProxyVolume) GetPeerID

func (v *ProxyVolume) GetPeerID() peer.ID

GetPeerID returns the volume peer ID.

func (*ProxyVolume) GetRefGraph

func (v *ProxyVolume) GetRefGraph() block_gc.RefGraphOps

GetRefGraph returns the volume's GC reference graph.

func (*ProxyVolume) GetStorageStats

func (v *ProxyVolume) GetStorageStats(ctx context.Context) (*volume.StorageStats, error)

GetStorageStats returns storage usage statistics via RPC.

func (*ProxyVolume) GetVolumeClient

func (v *ProxyVolume) GetVolumeClient() volume_rpc.SRPCProxyVolumeClient

GetVolumeClient returns the proxy volume client.

func (*ProxyVolume) LoadPeerPriv

func (v *ProxyVolume) LoadPeerPriv(ctx context.Context) (crypto.PrivKey, error)

LoadPeerPriv attempts to load the volume private key. May return nil if there is no key stored. May return ErrPrivKeyUnavailable

func (*ProxyVolume) StorePeerPriv

func (v *ProxyVolume) StorePeerPriv(ctx context.Context, pkey crypto.PrivKey) error

StorePeerPriv overwrites the volume's stored private key.

type ProxyVolumeController

type ProxyVolumeController struct {
	*volume_controller.Controller
	// contains filtered or unexported fields
}

ProxyVolumeController implements a volume controller with a ProxyVolumeController service.

func NewProxyVolumeController

func NewProxyVolumeController(
	b bus.Bus,
	le *logrus.Entry,
	volumeInfo *volume.VolumeInfo,
	volumeIDAlias []string,
	proxyVolumeClient volume_rpc.SRPCProxyVolumeClient,
	blockStoreClient rpc_block.SRPCBlockStoreClient,
	bucketStoreClient rpc_bucket.SRPCBucketStoreClient,
	objectStoreClient rpc_object.SRPCObjectStoreClient,
	refGraphClient rpc_gc.SRPCRefGraphClient,
) *ProxyVolumeController

NewProxyVolumeController constructs a new ProxyVolumeController.

func NewProxyVolumeControllerWithClient

func NewProxyVolumeControllerWithClient(
	b bus.Bus,
	le *logrus.Entry,
	volumeInfo *volume.VolumeInfo,
	volumeIDAlias []string,
	cc srpc.Client,
	serviceIDPrefix string,
) *ProxyVolumeController

NewProxyVolumeControllerWithClient constructs a new ProxyVolumeController with a client and service id prefix.

func (*ProxyVolumeController) GetBlockStoreClient

func (v *ProxyVolumeController) GetBlockStoreClient() rpc_block.SRPCBlockStoreClient

GetBlockStoreClient returns the block store client.

func (*ProxyVolumeController) GetBucketStoreClient

func (v *ProxyVolumeController) GetBucketStoreClient() rpc_bucket.SRPCBucketStoreClient

GetBucketStoreClient returns the bucket store client.

func (*ProxyVolumeController) GetID

func (v *ProxyVolumeController) GetID() string

GetID returns the volume ID.

func (*ProxyVolumeController) GetObjectStoreClient

func (v *ProxyVolumeController) GetObjectStoreClient() rpc_object.SRPCObjectStoreClient

GetObjectStoreClient returns the object store client.

func (*ProxyVolumeController) GetVolumeClient

GetVolumeClient returns the proxy volume client.

type VolumeAliases

type VolumeAliases struct {

	// From is a list of volume IDs to alias.
	From []string `protobuf:"bytes,1,rep,name=from,proto3" json:"from,omitempty"`
	// contains filtered or unexported fields
}

VolumeAliases is a list of volume aliases.

func (*VolumeAliases) CloneMessageVT

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

func (*VolumeAliases) CloneVT

func (m *VolumeAliases) CloneVT() *VolumeAliases

func (*VolumeAliases) EqualMessageVT

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

func (*VolumeAliases) EqualVT

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

func (*VolumeAliases) GetFrom

func (x *VolumeAliases) GetFrom() []string

func (*VolumeAliases) MarshalJSON

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

MarshalJSON marshals the VolumeAliases to JSON.

func (*VolumeAliases) MarshalProtoJSON

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

MarshalProtoJSON marshals the VolumeAliases message to JSON.

func (*VolumeAliases) MarshalProtoText

func (x *VolumeAliases) MarshalProtoText() string

func (*VolumeAliases) MarshalToSizedBufferVT

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

func (*VolumeAliases) MarshalToVT

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

func (*VolumeAliases) MarshalVT

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

func (*VolumeAliases) ProtoMessage

func (*VolumeAliases) ProtoMessage()

func (*VolumeAliases) Reset

func (x *VolumeAliases) Reset()

func (*VolumeAliases) SizeVT

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

func (*VolumeAliases) String

func (x *VolumeAliases) String() string

func (*VolumeAliases) UnmarshalJSON

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

UnmarshalJSON unmarshals the VolumeAliases from JSON.

func (*VolumeAliases) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the VolumeAliases message from JSON.

func (*VolumeAliases) UnmarshalVT

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

Jump to

Keyboard shortcuts

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