Documentation
¶
Index ¶
- Constants
- Variables
- 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) EqualsConfig(other config.Config) bool
- func (x *Config) GetBackoff() *backoff.Backoff
- func (x *Config) GetClientId() string
- func (c *Config) GetConfigID() string
- func (x *Config) GetLoadOnStartup() bool
- func (x *Config) GetReleaseDelay() string
- func (x *Config) GetServiceId() string
- func (x *Config) GetVolumeAliases() map[string]*VolumeAliases
- func (x *Config) GetVolumeIdList() []string
- func (x *Config) GetVolumeIdRe() 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) ParseReleaseDelay() (time.Duration, error)
- func (c *Config) ParseVolumeIdRe() (*regexp.Regexp, 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 Config_VolumeAliasesEntry
- func (x *Config_VolumeAliasesEntry) GetKey() string
- func (x *Config_VolumeAliasesEntry) GetValue() *VolumeAliases
- func (x *Config_VolumeAliasesEntry) MarshalJSON() ([]byte, error)
- func (x *Config_VolumeAliasesEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_VolumeAliasesEntry) MarshalProtoText() string
- func (*Config_VolumeAliasesEntry) ProtoMessage()
- func (x *Config_VolumeAliasesEntry) Reset()
- func (x *Config_VolumeAliasesEntry) String() string
- func (x *Config_VolumeAliasesEntry) UnmarshalJSON(b []byte) error
- func (x *Config_VolumeAliasesEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) LoadProxyVolume(ctx context.Context, volumeID string) (volume.Controller, func(), error)
- type Coordinator
- func (c *Coordinator) Capability(ctx context.Context, scope coord.Scope) (*coord.Capability, error)
- func (c *Coordinator) Snapshot(ctx context.Context, scope coord.Scope) (*coord.Snapshot, error)
- func (c *Coordinator) TryAcquireWriteLease(ctx context.Context, scope coord.Scope) (coord.WriteLease, bool, error)
- func (c *Coordinator) WaitAcquireWriteLease(ctx context.Context, scope coord.Scope) (coord.WriteLease, error)
- func (c *Coordinator) Watch(ctx context.Context, scope coord.Scope, afterGeneration uint64) (coord.Watch, error)
- type Factory
- type LoadProxyVolumeResolver
- type ProxyVolume
- func (v *ProxyVolume) Close() error
- func (v *ProxyVolume) Delete() error
- func (v *ProxyVolume) Execute(ctx context.Context) error
- func (v *ProxyVolume) GetID() string
- func (v *ProxyVolume) GetPeer(ctx context.Context, withPriv bool) (peer.Peer, error)
- func (v *ProxyVolume) GetPeerID() peer.ID
- func (v *ProxyVolume) GetRefGraph() block_gc.RefGraphOps
- func (v *ProxyVolume) GetStorageStats(ctx context.Context) (*volume.StorageStats, error)
- func (v *ProxyVolume) GetVolumeClient() volume_rpc.SRPCProxyVolumeClient
- func (v *ProxyVolume) LoadPeerPriv(ctx context.Context) (crypto.PrivKey, error)
- func (v *ProxyVolume) StorePeerPriv(ctx context.Context, pkey crypto.PrivKey) error
- type ProxyVolumeController
- func (v *ProxyVolumeController) GetBlockStoreClient() rpc_block.SRPCBlockStoreClient
- func (v *ProxyVolumeController) GetBucketStoreClient() rpc_bucket.SRPCBucketStoreClient
- func (v *ProxyVolumeController) GetID() string
- func (v *ProxyVolumeController) GetObjectStoreClient() rpc_object.SRPCObjectStoreClient
- func (v *ProxyVolumeController) GetVolumeClient() volume_rpc.SRPCProxyVolumeClient
- type VolumeAliases
- func (m *VolumeAliases) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *VolumeAliases) CloneVT() *VolumeAliases
- func (this *VolumeAliases) EqualMessageVT(thatMsg any) bool
- func (this *VolumeAliases) EqualVT(that *VolumeAliases) bool
- func (x *VolumeAliases) GetFrom() []string
- func (x *VolumeAliases) MarshalJSON() ([]byte, error)
- func (x *VolumeAliases) MarshalProtoJSON(s *json.MarshalState)
- func (x *VolumeAliases) MarshalProtoText() string
- func (m *VolumeAliases) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *VolumeAliases) MarshalToVT(dAtA []byte) (int, error)
- func (m *VolumeAliases) MarshalVT() (dAtA []byte, err error)
- func (*VolumeAliases) ProtoMessage()
- func (x *VolumeAliases) Reset()
- func (m *VolumeAliases) SizeVT() (n int)
- func (x *VolumeAliases) String() string
- func (x *VolumeAliases) UnmarshalJSON(b []byte) error
- func (x *VolumeAliases) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *VolumeAliases) UnmarshalVT(dAtA []byte) error
Constants ¶
const ConfigID = ControllerID
ConfigID is the config identifier.
const ControllerID = "hydra/volume/rpc/client"
ControllerID is the rpc volume client controller id.
Variables ¶
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 (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) GetBackoff ¶
func (*Config) GetClientId ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetLoadOnStartup ¶
func (*Config) GetReleaseDelay ¶
func (*Config) GetServiceId ¶
func (*Config) GetVolumeAliases ¶
func (x *Config) GetVolumeAliases() map[string]*VolumeAliases
func (*Config) GetVolumeIdList ¶
func (*Config) GetVolumeIdRe ¶
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) ParseReleaseDelay ¶
ParseReleaseDelay parses the release delay field. Applies the default value if the field is empty.
func (*Config) ParseVolumeIdRe ¶
ParseVolumeIdRe parses the volume id regex field. Returns nil if the field was 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 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 (x *Config_VolumeAliasesEntry) GetValue() *VolumeAliases
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 ¶
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) 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.
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 ¶
func (r *LoadProxyVolumeResolver) Resolve(ctx context.Context, handler directive.ResolverHandler) error
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 ¶
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 ¶
LoadPeerPriv attempts to load the volume private key. May return nil if there is no key stored. May return ErrPrivKeyUnavailable
func (*ProxyVolume) StorePeerPriv ¶
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 ¶
func (v *ProxyVolumeController) GetVolumeClient() volume_rpc.SRPCProxyVolumeClient
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