Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterProxyVolume(mux srpc.Mux, proxyVol *ProxyVolume) error
- func RegisterProxyVolumeWithPrefix(mux srpc.Mux, proxyVol *ProxyVolume, prefix string) error
- 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 (c *Config) GetConfigID() string
- func (x *Config) GetExposePrivateKey() bool
- func (x *Config) GetReleaseDelay() string
- func (x *Config) GetServiceId() string
- 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 Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetRpcStreamMux(ctx context.Context, volumeID string, _ func()) (srpc.Invoker, func(), error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)
- func (c *Controller) VolumeRpc(strm volume_rpc.SRPCAccessVolumes_VolumeRpcStream) error
- func (c *Controller) WatchVolumeInfo(req *volume_rpc.WatchVolumeInfoRequest, ...) error
- type Factory
- type ProxyVolume
- func (v *ProxyVolume) GetCoordinatorCapability(ctx context.Context, req *volume_rpc.GetCoordinatorCapabilityRequest) (*volume_rpc.GetCoordinatorCapabilityResponse, error)
- func (v *ProxyVolume) GetCoordinatorSnapshot(ctx context.Context, req *volume_rpc.GetCoordinatorSnapshotRequest) (*volume_rpc.GetCoordinatorSnapshotResponse, error)
- func (v *ProxyVolume) GetPeerPriv(ctx context.Context, req *volume_rpc.GetPeerPrivRequest) (*volume_rpc.GetPeerPrivResponse, error)
- func (v *ProxyVolume) GetStorageStats(ctx context.Context, req *volume_rpc.GetStorageStatsRequest) (*volume_rpc.GetStorageStatsResponse, error)
- func (v *ProxyVolume) GetVolume() volume.Volume
- func (v *ProxyVolume) GetVolumeInfo(ctx context.Context, req *volume_rpc.GetVolumeInfoRequest) (*volume_rpc.GetVolumeInfoResponse, error)
- func (v *ProxyVolume) PublishCoordinatorWriteLease(ctx context.Context, req *volume_rpc.PublishCoordinatorWriteLeaseRequest) (*volume_rpc.CoordinatorWriteLeaseSnapshotResponse, error)
- func (v *ProxyVolume) RefreshCoordinatorWriteLease(ctx context.Context, req *volume_rpc.CoordinatorWriteLeaseRequest) (*volume_rpc.CoordinatorWriteLeaseSnapshotResponse, error)
- func (v *ProxyVolume) ReleaseCoordinatorWriteLease(ctx context.Context, req *volume_rpc.CoordinatorWriteLeaseRequest) (*volume_rpc.ReleaseCoordinatorWriteLeaseResponse, error)
- func (v *ProxyVolume) TryAcquireCoordinatorWriteLease(req *volume_rpc.TryAcquireCoordinatorWriteLeaseRequest, ...) error
- func (v *ProxyVolume) WaitAcquireCoordinatorWriteLease(req *volume_rpc.WaitAcquireCoordinatorWriteLeaseRequest, ...) error
- func (v *ProxyVolume) WatchCoordinatorEvents(req *volume_rpc.WatchCoordinatorEventsRequest, ...) error
Constants ¶
const ConfigID = ControllerID
ConfigID is the config identifier.
const ControllerID = "hydra/volume/rpc/server"
ControllerID is the rpc volume server controller id.
Variables ¶
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 NewConfigWithRe ¶
NewConfigWithRe constructs a config with a volume id regex.
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) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetExposePrivateKey ¶
func (*Config) GetReleaseDelay ¶
func (*Config) GetServiceId ¶
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 Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the rpc volume server.
func NewController ¶
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 ¶
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 ¶
func (c *Controller) VolumeRpc(strm volume_rpc.SRPCAccessVolumes_VolumeRpcStream) error
VolumeRpc uses the LookupVolume directive access a Volume handle. Exposes the ProxyVolume service. Id: volume id
func (*Controller) WatchVolumeInfo ¶
func (c *Controller) WatchVolumeInfo( req *volume_rpc.WatchVolumeInfoRequest, strm volume_rpc.SRPCAccessVolumes_WatchVolumeInfoStream, ) error
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 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 ¶
NewProxyVolume constructs a new ProxyVolume.
func (*ProxyVolume) GetCoordinatorCapability ¶ added in v0.52.0
func (v *ProxyVolume) GetCoordinatorCapability( ctx context.Context, req *volume_rpc.GetCoordinatorCapabilityRequest, ) (*volume_rpc.GetCoordinatorCapabilityResponse, error)
GetCoordinatorCapability reports the remote coordinator capability.
func (*ProxyVolume) GetCoordinatorSnapshot ¶ added in v0.52.0
func (v *ProxyVolume) GetCoordinatorSnapshot( ctx context.Context, req *volume_rpc.GetCoordinatorSnapshotRequest, ) (*volume_rpc.GetCoordinatorSnapshotResponse, error)
GetCoordinatorSnapshot returns the current remote coordinator snapshot.
func (*ProxyVolume) GetPeerPriv ¶
func (v *ProxyVolume) GetPeerPriv( ctx context.Context, req *volume_rpc.GetPeerPrivRequest, ) (*volume_rpc.GetPeerPrivResponse, error)
GetPeerPriv returns the private key for the volume (if enabled).
func (*ProxyVolume) GetStorageStats ¶
func (v *ProxyVolume) GetStorageStats( ctx context.Context, req *volume_rpc.GetStorageStatsRequest, ) (*volume_rpc.GetStorageStatsResponse, error)
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 ¶
func (v *ProxyVolume) GetVolumeInfo( ctx context.Context, req *volume_rpc.GetVolumeInfoRequest, ) (*volume_rpc.GetVolumeInfoResponse, error)
GetVolumeInfo returns the volume information.
func (*ProxyVolume) PublishCoordinatorWriteLease ¶ added in v0.52.0
func (v *ProxyVolume) PublishCoordinatorWriteLease( ctx context.Context, req *volume_rpc.PublishCoordinatorWriteLeaseRequest, ) (*volume_rpc.CoordinatorWriteLeaseSnapshotResponse, error)
PublishCoordinatorWriteLease publishes a remote write lease event.
func (*ProxyVolume) RefreshCoordinatorWriteLease ¶ added in v0.52.0
func (v *ProxyVolume) RefreshCoordinatorWriteLease( ctx context.Context, req *volume_rpc.CoordinatorWriteLeaseRequest, ) (*volume_rpc.CoordinatorWriteLeaseSnapshotResponse, error)
RefreshCoordinatorWriteLease refreshes a remote write lease.
func (*ProxyVolume) ReleaseCoordinatorWriteLease ¶ added in v0.52.0
func (v *ProxyVolume) ReleaseCoordinatorWriteLease( ctx context.Context, req *volume_rpc.CoordinatorWriteLeaseRequest, ) (*volume_rpc.ReleaseCoordinatorWriteLeaseResponse, error)
ReleaseCoordinatorWriteLease releases a remote write lease.
func (*ProxyVolume) TryAcquireCoordinatorWriteLease ¶ added in v0.52.0
func (v *ProxyVolume) TryAcquireCoordinatorWriteLease( req *volume_rpc.TryAcquireCoordinatorWriteLeaseRequest, strm volume_rpc.SRPCProxyVolume_TryAcquireCoordinatorWriteLeaseStream, ) error
TryAcquireCoordinatorWriteLease attempts to acquire the remote write lease.
func (*ProxyVolume) WaitAcquireCoordinatorWriteLease ¶ added in v0.52.0
func (v *ProxyVolume) WaitAcquireCoordinatorWriteLease( req *volume_rpc.WaitAcquireCoordinatorWriteLeaseRequest, strm volume_rpc.SRPCProxyVolume_WaitAcquireCoordinatorWriteLeaseStream, ) error
WaitAcquireCoordinatorWriteLease waits to acquire the remote write lease.
func (*ProxyVolume) WatchCoordinatorEvents ¶ added in v0.52.0
func (v *ProxyVolume) WatchCoordinatorEvents( req *volume_rpc.WatchCoordinatorEventsRequest, strm volume_rpc.SRPCProxyVolume_WatchCoordinatorEventsStream, ) error
WatchCoordinatorEvents streams remote coordinator events.