Documentation
¶
Index ¶
- Variables
- func CheckIDMatchesAliases(targetVolID, volID string, aliases []string) bool
- func CheckIDMatchesList(id string, list []string, re *regexp.Regexp) bool
- func CheckLookupBlockStoreMatchesVolume(dir block_store.LookupBlockStore, vol Volume, aliases []string) bool
- func CheckLookupMatchesVolume(dir LookupVolume, vol Volume, aliases []string) bool
- func IsPermanent(err error) bool
- func NewVolumeID(storeTypeID string, peerID peer.ID) string
- func OrdersWrites(vol Volume) bool
- func Permanent(err error) error
- func ResolveHashType(hashType hash.HashType) hash.HashType
- func WaitDurable(ctx context.Context, vol Volume) error
- type BuildObjectStoreAPI
- type BuildObjectStoreAPIValue
- type BusObjectStore
- type Constructor
- type Controller
- type ListBuckets
- type ListBucketsRequest
- func (m *ListBucketsRequest) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *ListBucketsRequest) CloneVT() *ListBucketsRequest
- func (this *ListBucketsRequest) EqualMessageVT(thatMsg any) bool
- func (this *ListBucketsRequest) EqualVT(that *ListBucketsRequest) bool
- func (x *ListBucketsRequest) GetBucketId() string
- func (d *ListBucketsRequest) GetDebugVals() directive.DebugValues
- func (d *ListBucketsRequest) GetName() string
- func (d *ListBucketsRequest) GetValueOptions() directive.ValueOptions
- func (x *ListBucketsRequest) GetVolumeIdList() []string
- func (x *ListBucketsRequest) GetVolumeIdRe() string
- func (d *ListBucketsRequest) IsEquivalent(other directive.Directive) bool
- func (d *ListBucketsRequest) ListBucketsBucketId() string
- func (d *ListBucketsRequest) ListBucketsVolumeIDList() []string
- func (d *ListBucketsRequest) ListBucketsVolumeIDRe() *regexp.Regexp
- func (x *ListBucketsRequest) MarshalJSON() ([]byte, error)
- func (x *ListBucketsRequest) MarshalProtoJSON(s *json.MarshalState)
- func (x *ListBucketsRequest) MarshalProtoText() string
- func (m *ListBucketsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *ListBucketsRequest) MarshalToVT(dAtA []byte) (int, error)
- func (m *ListBucketsRequest) MarshalVT() (dAtA []byte, err error)
- func (d *ListBucketsRequest) ParseVolumeIDRe() (*regexp.Regexp, error)
- func (*ListBucketsRequest) ProtoMessage()
- func (x *ListBucketsRequest) Reset()
- func (m *ListBucketsRequest) SizeVT() (n int)
- func (x *ListBucketsRequest) String() string
- func (d *ListBucketsRequest) Superceeds(other directive.Directive) bool
- func (x *ListBucketsRequest) UnmarshalJSON(b []byte) error
- func (x *ListBucketsRequest) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *ListBucketsRequest) UnmarshalVT(dAtA []byte) error
- func (d *ListBucketsRequest) Validate() error
- type ListBucketsValue
- type LookupVolume
- type LookupVolumeValue
- type ObjectStoreHandle
- type PermanentError
- type StorageStats
- func (m *StorageStats) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *StorageStats) CloneVT() *StorageStats
- func (this *StorageStats) EqualMessageVT(thatMsg any) bool
- func (this *StorageStats) EqualVT(that *StorageStats) bool
- func (x *StorageStats) GetBlockCount() uint64
- func (x *StorageStats) GetTotalBytes() uint64
- func (x *StorageStats) MarshalJSON() ([]byte, error)
- func (x *StorageStats) MarshalProtoJSON(s *json.MarshalState)
- func (x *StorageStats) MarshalProtoText() string
- func (m *StorageStats) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *StorageStats) MarshalToVT(dAtA []byte) (int, error)
- func (m *StorageStats) MarshalVT() (dAtA []byte, err error)
- func (*StorageStats) ProtoMessage()
- func (x *StorageStats) Reset()
- func (m *StorageStats) SizeVT() (n int)
- func (x *StorageStats) String() string
- func (x *StorageStats) UnmarshalJSON(b []byte) error
- func (x *StorageStats) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *StorageStats) UnmarshalVT(dAtA []byte) error
- type Volume
- type VolumeBlockStore
- func (v *VolumeBlockStore) BeginDeferFlush()
- func (v *VolumeBlockStore) EndDeferFlush(ctx context.Context) error
- func (v *VolumeBlockStore) GetBlock(ctx context.Context, ref *block.BlockRef) ([]byte, bool, error)
- func (v *VolumeBlockStore) GetBlockExists(ctx context.Context, ref *block.BlockRef) (bool, error)
- func (v *VolumeBlockStore) GetBlockExistsBatch(ctx context.Context, refs []*block.BlockRef) ([]bool, error)
- func (v *VolumeBlockStore) GetGCManagerHooks() (block_gc.ManagerHooks, bool)
- func (v *VolumeBlockStore) GetHashType() hash.HashType
- func (v *VolumeBlockStore) GetSupportedFeatures() block.StoreFeature
- func (v *VolumeBlockStore) PutBlock(ctx context.Context, data []byte, opts *block.PutOpts) (*block.BlockRef, bool, error)
- func (v *VolumeBlockStore) PutBlockBatch(ctx context.Context, entries []*block.PutBatchEntry) error
- func (v *VolumeBlockStore) RmBlock(ctx context.Context, ref *block.BlockRef) error
- func (v *VolumeBlockStore) StatBlock(ctx context.Context, ref *block.BlockRef) (*block.BlockStat, error)
- func (v *VolumeBlockStore) Sync(ctx context.Context) (bool, error)
- type VolumeBucketInfo
- func (m *VolumeBucketInfo) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *VolumeBucketInfo) CloneVT() *VolumeBucketInfo
- func (this *VolumeBucketInfo) EqualMessageVT(thatMsg any) bool
- func (this *VolumeBucketInfo) EqualVT(that *VolumeBucketInfo) bool
- func (x *VolumeBucketInfo) GetBucketInfo() *bucket.BucketInfo
- func (x *VolumeBucketInfo) GetVolumeInfo() *VolumeInfo
- func (x *VolumeBucketInfo) MarshalJSON() ([]byte, error)
- func (x *VolumeBucketInfo) MarshalProtoJSON(s *json.MarshalState)
- func (x *VolumeBucketInfo) MarshalProtoText() string
- func (m *VolumeBucketInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *VolumeBucketInfo) MarshalToVT(dAtA []byte) (int, error)
- func (m *VolumeBucketInfo) MarshalVT() (dAtA []byte, err error)
- func (*VolumeBucketInfo) ProtoMessage()
- func (x *VolumeBucketInfo) Reset()
- func (m *VolumeBucketInfo) SizeVT() (n int)
- func (x *VolumeBucketInfo) String() string
- func (x *VolumeBucketInfo) UnmarshalJSON(b []byte) error
- func (x *VolumeBucketInfo) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *VolumeBucketInfo) UnmarshalVT(dAtA []byte) error
- type VolumeInfo
- func (m *VolumeInfo) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *VolumeInfo) CloneVT() *VolumeInfo
- func (this *VolumeInfo) EqualMessageVT(thatMsg any) bool
- func (this *VolumeInfo) EqualVT(that *VolumeInfo) bool
- func (x *VolumeInfo) GetControllerInfo() *controller.Info
- func (x *VolumeInfo) GetHashType() hash.HashType
- func (x *VolumeInfo) GetPeerId() string
- func (x *VolumeInfo) GetPeerPub() string
- func (x *VolumeInfo) GetVolumeId() string
- func (x *VolumeInfo) MarshalJSON() ([]byte, error)
- func (x *VolumeInfo) MarshalProtoJSON(s *json.MarshalState)
- func (x *VolumeInfo) MarshalProtoText() string
- func (m *VolumeInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *VolumeInfo) MarshalToVT(dAtA []byte) (int, error)
- func (m *VolumeInfo) MarshalVT() (dAtA []byte, err error)
- func (i *VolumeInfo) ParsePeerID() (peer.ID, error)
- func (i *VolumeInfo) ParsePeerPub() (crypto.PublicKey, error)
- func (i *VolumeInfo) ParseToPeer() (peer.Peer, error)
- func (*VolumeInfo) ProtoMessage()
- func (x *VolumeInfo) Reset()
- func (i *VolumeInfo) ResolveHashType() hash.HashType
- func (m *VolumeInfo) SizeVT() (n int)
- func (x *VolumeInfo) String() string
- func (x *VolumeInfo) UnmarshalJSON(b []byte) error
- func (x *VolumeInfo) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *VolumeInfo) UnmarshalVT(dAtA []byte) error
- func (i *VolumeInfo) Validate() error
- type WriteOrderer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVolumeIDEmpty is returned if the volume id was empty. ErrVolumeIDEmpty = errors.New("volume id cannot be empty") // ErrBucketNotInVolume is returned if the volume does not contain the bucket. ErrBucketNotInVolume = errors.New("bucket does not exist in volume") ErrObjectStoreUnavailable = errors.New("object store is unavailable") )
Functions ¶
func CheckIDMatchesAliases ¶
CheckIDMatchesAliases checks if the ID matches the value or any alias. Returns true if the target id was empty
func CheckIDMatchesList ¶
CheckIDMatchesList checks if the ID matches the list or regex. If the ID matches the regex OR matches the list, returns true.
func CheckLookupBlockStoreMatchesVolume ¶
func CheckLookupBlockStoreMatchesVolume(dir block_store.LookupBlockStore, vol Volume, aliases []string) bool
CheckLookupBlockStoreMatchesVolume checks if a LookupBlockStore matches a volume. only checks if there are any constraints set on the directive (not ID).
func CheckLookupMatchesVolume ¶
func CheckLookupMatchesVolume(dir LookupVolume, vol Volume, aliases []string) bool
CheckLookupMatchesVolume checks if a LookupVolume matches a volume.
func IsPermanent ¶ added in v0.52.0
IsPermanent reports whether err marks a non-retryable construction failure.
func NewVolumeID ¶
NewVolumeID constructs a new volume ID with a store type id and a peer id.
storeTypeID should be like "hydra/volume/kvtxinmem"
func OrdersWrites ¶
OrdersWrites reports whether vol makes its writes durable in commit order.
func Permanent ¶ added in v0.52.0
Permanent wraps err as a non-retryable volume construction failure. It returns nil when err is nil.
func ResolveHashType ¶ added in v0.51.7
ResolveHashType resolves the volume hash choice.
Types ¶
type BuildObjectStoreAPI ¶
type BuildObjectStoreAPI interface {
// Directive indicates BuildObjectStoreAPI is a directive.
directive.Directive
// BuildObjectStoreAPIStoreID returns the object store ID.
// Cannot be empty.
BuildObjectStoreAPIStoreID() string
// BuildObjectStoreAPIVolumeID returns the volume ID constraint.
// Can be empty to select any volume.
BuildObjectStoreAPIVolumeID() string
}
BuildObjectStoreAPI is a directive to get API handles to object store.
func NewBuildObjectStoreAPI ¶
func NewBuildObjectStoreAPI(objectStoreID, volumeID string) BuildObjectStoreAPI
NewBuildObjectStoreAPI constructs a new BuildObjectStoreAPI directive.
type BuildObjectStoreAPIValue ¶
type BuildObjectStoreAPIValue = ObjectStoreHandle
BuildObjectStoreAPIValue is the result type for BuildObjectStoreAPI. The value is removed and replaced when any values change.
type BusObjectStore ¶
type BusObjectStore struct {
// contains filtered or unexported fields
}
BusObjectStore implements ObjectStore backed by a volume on a bus.
Executes BuildObjectStore directive to get an object store handle.
func NewBusObjectStore ¶
func NewBusObjectStore(ctx context.Context, b bus.Bus, returnIfIdle bool, storeID, storeVolumeID string) *BusObjectStore
NewBusObjectStore constructs a new BusObjectStore.
if returnIfIdle is set and the directive becomes idle, returns ErrObjectStoreUnavailable.
func (*BusObjectStore) BuildObjectStore ¶
func (b *BusObjectStore) BuildObjectStore(ctx context.Context, disposeCb func()) (BuildObjectStoreAPIValue, directive.Reference, error)
BuildObjectStore opens the handle to the object store api.
May return nil, nil, nil, if returnIfIdle is set.
func (*BusObjectStore) NewTransaction ¶
NewTransaction returns a new transaction against the store. Always call Discard() after you are done with the transaction. The transaction will be read-only unless write is set.
type Constructor ¶
Constructor constructs a volume with common parameters.
type Controller ¶
type Controller interface {
// Controller is the controllerbus controller interface.
controller.Controller
// GetVolume returns the controlled volume.
// This may wait for the volume to be ready.
GetVolume(ctx context.Context) (Volume, error)
// BuildBucketAPI builds an API handle for the bucket ID in the volume.
// Returns the handle & a release function, or (nil, nil, err).
BuildBucketAPI(ctx context.Context, bucketID string) (bucket.BucketHandle, func(), error)
}
Controller is a volume controller.
type ListBuckets ¶
type ListBuckets interface {
// Directive indicates ListBuckets is a directive.
directive.Directive
// ListBucketsBucketId returns the desired bucket id.
// Can be empty.
ListBucketsBucketId() string
// ListBucketsVolumeIDRe returns the volume ID constraint.
// Can be empty.
// Cannot be specified if VolumeIDList is set.
ListBucketsVolumeIDRe() *regexp.Regexp
// ListBucketsVolumeIDList returns a specific list of volumes to list.
// If empty, uses the VolumeIDRe field instead.
// Cannot be specified if VolumeIDRe is set.
ListBucketsVolumeIDList() []string
}
ListBuckets is a directive to list buckets.
func NewListBuckets ¶
func NewListBuckets(bucketID string, volumeIDs []string) ListBuckets
NewListBuckets constructs a ListBuckets with a list of volumes.
func NewListBucketsWithRe ¶
func NewListBucketsWithRe(bucketID string, volumeIDRe string) ListBuckets
NewListBucketsWithRe constructs an ListBuckets with a regexp.
type ListBucketsRequest ¶
type ListBucketsRequest struct {
// BucketId limits information to a specific bucket.
// Can be empty.
BucketId string `protobuf:"bytes,1,opt,name=bucket_id,json=bucketId,proto3" json:"bucketId,omitempty"`
// VolumeIdRe limits to specific volumes by regex.
// Can be empty.
// Cannot be specified if VolumeIDList is set.
VolumeIdRe string `protobuf:"bytes,2,opt,name=volume_id_re,json=volumeIdRe,proto3" json:"volumeIdRe,omitempty"`
// VolumeIdList returns a specific list of volumes to list.
// If empty, uses the VolumeIDRe field instead.
// Cannot be specified if VolumeIDRe is set.
VolumeIdList []string `protobuf:"bytes,3,rep,name=volume_id_list,json=volumeIdList,proto3" json:"volumeIdList,omitempty"`
// contains filtered or unexported fields
}
ListBucketsRequest is a list buckets directive in proto form.
func (*ListBucketsRequest) CloneMessageVT ¶
func (m *ListBucketsRequest) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*ListBucketsRequest) CloneVT ¶
func (m *ListBucketsRequest) CloneVT() *ListBucketsRequest
func (*ListBucketsRequest) EqualMessageVT ¶
func (this *ListBucketsRequest) EqualMessageVT(thatMsg any) bool
func (*ListBucketsRequest) EqualVT ¶
func (this *ListBucketsRequest) EqualVT(that *ListBucketsRequest) bool
func (*ListBucketsRequest) GetBucketId ¶
func (x *ListBucketsRequest) GetBucketId() string
func (*ListBucketsRequest) GetDebugVals ¶
func (d *ListBucketsRequest) GetDebugVals() directive.DebugValues
GetDebugString returns the directive arguments stringified.
func (*ListBucketsRequest) GetName ¶
func (d *ListBucketsRequest) GetName() string
GetName returns the directive's type name. This is not necessarily unique, and is primarily intended for display.
func (*ListBucketsRequest) GetValueOptions ¶
func (d *ListBucketsRequest) GetValueOptions() directive.ValueOptions
GetValueListBucketsOptions returns options relating to value handling.
func (*ListBucketsRequest) GetVolumeIdList ¶
func (x *ListBucketsRequest) GetVolumeIdList() []string
func (*ListBucketsRequest) GetVolumeIdRe ¶
func (x *ListBucketsRequest) GetVolumeIdRe() string
func (*ListBucketsRequest) IsEquivalent ¶
func (d *ListBucketsRequest) IsEquivalent(other directive.Directive) bool
IsEquivalent checks if the other directive is equivalent. If two directives are equivalent, and the new directive does not superceed the old, then the new directive will be merged (de-duplicated) into the old.
func (*ListBucketsRequest) ListBucketsBucketId ¶
func (d *ListBucketsRequest) ListBucketsBucketId() string
ListBucketsBucketId returns the desired bucket id. Can be empty.
func (*ListBucketsRequest) ListBucketsVolumeIDList ¶
func (d *ListBucketsRequest) ListBucketsVolumeIDList() []string
ListBucketsVolumeIDList returns a specific list of volumes to list. If empty, uses the VolumeIDRe field instead. Cannot be specified if VolumeIDRe is set.
func (*ListBucketsRequest) ListBucketsVolumeIDRe ¶
func (d *ListBucketsRequest) ListBucketsVolumeIDRe() *regexp.Regexp
ListBucketsVolumeIDRe returns the volume ID constraint. Can be empty. Cannot be specified if VolumeIDList is set.
func (*ListBucketsRequest) MarshalJSON ¶
func (x *ListBucketsRequest) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ListBucketsRequest to JSON.
func (*ListBucketsRequest) MarshalProtoJSON ¶
func (x *ListBucketsRequest) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ListBucketsRequest message to JSON.
func (*ListBucketsRequest) MarshalProtoText ¶
func (x *ListBucketsRequest) MarshalProtoText() string
func (*ListBucketsRequest) MarshalToSizedBufferVT ¶
func (m *ListBucketsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*ListBucketsRequest) MarshalToVT ¶
func (m *ListBucketsRequest) MarshalToVT(dAtA []byte) (int, error)
func (*ListBucketsRequest) MarshalVT ¶
func (m *ListBucketsRequest) MarshalVT() (dAtA []byte, err error)
func (*ListBucketsRequest) ParseVolumeIDRe ¶
func (d *ListBucketsRequest) ParseVolumeIDRe() (*regexp.Regexp, error)
ParseVolumeIDRe parses the volume id regex field.
func (*ListBucketsRequest) ProtoMessage ¶
func (*ListBucketsRequest) ProtoMessage()
func (*ListBucketsRequest) Reset ¶
func (x *ListBucketsRequest) Reset()
func (*ListBucketsRequest) SizeVT ¶
func (m *ListBucketsRequest) SizeVT() (n int)
func (*ListBucketsRequest) String ¶
func (x *ListBucketsRequest) String() string
func (*ListBucketsRequest) Superceeds ¶
func (d *ListBucketsRequest) Superceeds(other directive.Directive) bool
Superceeds checks if the directive overrides another. The other directive will be canceled if superceded.
func (*ListBucketsRequest) UnmarshalJSON ¶
func (x *ListBucketsRequest) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ListBucketsRequest from JSON.
func (*ListBucketsRequest) UnmarshalProtoJSON ¶
func (x *ListBucketsRequest) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ListBucketsRequest message from JSON.
func (*ListBucketsRequest) UnmarshalVT ¶
func (m *ListBucketsRequest) UnmarshalVT(dAtA []byte) error
func (*ListBucketsRequest) Validate ¶
func (d *ListBucketsRequest) Validate() error
Validate validates the directive. This is a cursory validation to see if the values "look correct."
type ListBucketsValue ¶
type ListBucketsValue = VolumeBucketInfo
ListBucketsValue is the result type for ListBuckets.
type LookupVolume ¶
type LookupVolume interface {
// Directive indicates LookupVolume is a directive.
directive.Directive
// LookupVolumeID returns a specific volume ID to filter to.
// Can be empty.
LookupVolumeID() string
// LookupVolumePeerIDConstraint returns a specific peer ID we are looking for.
// Can be empty.
LookupVolumePeerIDConstraint() peer.ID
}
LookupVolume is a directive to lookup running volumes. Value type: volume.Volume.
func NewLookupVolume ¶
func NewLookupVolume(volumeID string, peerID peer.ID) LookupVolume
NewLookupVolume constructs a new LookupVolume directive. both parameters can be empty
type LookupVolumeValue ¶
type LookupVolumeValue = Volume
LookupVolumeValue is the value type for LookupVolume.
type ObjectStoreHandle ¶
type ObjectStoreHandle interface {
// GetID returns the object store ID.
GetID() string
// GetVolumeId returns the volume ID of the object store handle.
GetVolumeId() string
// GetVolume returns the owning volume for this object store handle.
GetVolume() Volume
// GetObjectStore returns the object store.
GetObjectStore() object.ObjectStore
}
ObjectStoreHandle is a object store API handle.
type PermanentError ¶ added in v0.52.0
type PermanentError struct {
// Err is the underlying construction failure.
Err error
}
PermanentError marks a volume construction failure that must not be retried.
The volume cannot be constructed in the current environment, so retrying the constructor cannot succeed. The browser OPFS backend uses this to report a storage-capability denial (a SecurityError on root acquisition) that survives a site-data clear and only differs by browser profile. The volume controller stops restarting on a permanent error and surfaces it to waiters instead of looping forever.
func (*PermanentError) Error ¶ added in v0.52.0
func (e *PermanentError) Error() string
Error returns the underlying error message.
func (*PermanentError) Unwrap ¶ added in v0.52.0
func (e *PermanentError) Unwrap() error
Unwrap returns the underlying error.
type StorageStats ¶
type StorageStats struct {
// TotalBytes is the total storage size in bytes.
TotalBytes uint64 `protobuf:"varint,1,opt,name=total_bytes,json=totalBytes,proto3" json:"totalBytes,omitempty"`
// BlockCount is the number of blocks stored.
BlockCount uint64 `protobuf:"varint,2,opt,name=block_count,json=blockCount,proto3" json:"blockCount,omitempty"`
// contains filtered or unexported fields
}
StorageStats contains storage usage statistics for a volume.
func (*StorageStats) CloneMessageVT ¶
func (m *StorageStats) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*StorageStats) CloneVT ¶
func (m *StorageStats) CloneVT() *StorageStats
func (*StorageStats) EqualMessageVT ¶
func (this *StorageStats) EqualMessageVT(thatMsg any) bool
func (*StorageStats) EqualVT ¶
func (this *StorageStats) EqualVT(that *StorageStats) bool
func (*StorageStats) GetBlockCount ¶
func (x *StorageStats) GetBlockCount() uint64
func (*StorageStats) GetTotalBytes ¶
func (x *StorageStats) GetTotalBytes() uint64
func (*StorageStats) MarshalJSON ¶
func (x *StorageStats) MarshalJSON() ([]byte, error)
MarshalJSON marshals the StorageStats to JSON.
func (*StorageStats) MarshalProtoJSON ¶
func (x *StorageStats) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the StorageStats message to JSON.
func (*StorageStats) MarshalProtoText ¶
func (x *StorageStats) MarshalProtoText() string
func (*StorageStats) MarshalToSizedBufferVT ¶
func (m *StorageStats) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*StorageStats) MarshalToVT ¶
func (m *StorageStats) MarshalToVT(dAtA []byte) (int, error)
func (*StorageStats) MarshalVT ¶
func (m *StorageStats) MarshalVT() (dAtA []byte, err error)
func (*StorageStats) ProtoMessage ¶
func (*StorageStats) ProtoMessage()
func (*StorageStats) Reset ¶
func (x *StorageStats) Reset()
func (*StorageStats) SizeVT ¶
func (m *StorageStats) SizeVT() (n int)
func (*StorageStats) String ¶
func (x *StorageStats) String() string
func (*StorageStats) UnmarshalJSON ¶
func (x *StorageStats) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the StorageStats from JSON.
func (*StorageStats) UnmarshalProtoJSON ¶
func (x *StorageStats) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the StorageStats message from JSON.
func (*StorageStats) UnmarshalVT ¶
func (m *StorageStats) UnmarshalVT(dAtA []byte) error
type Volume ¶
type Volume interface {
// GetID returns the volume ID.
// Usually this is derived from the peer ID and volume type.
GetID() string
// GetPeerID returns the volume peer ID.
GetPeerID() peer.ID
// GetPeer returns the Peer object.
// If withPriv=false ensure that the Peer returned does not have the private key.
GetPeer(ctx context.Context, withPriv bool) (peer.Peer, error)
// GetRefGraph returns the volume's GC reference graph.
//
// NOTE: May return nil if the volume does not support Garbage Collection.
GetRefGraph() block_gc.RefGraphOps
// GetStorageStats returns storage usage statistics for the volume.
// Returns total bytes and block count from the underlying storage backend.
GetStorageStats(ctx context.Context) (*StorageStats, error)
// Sync is the volume-owned durability barrier. StoreOps.Sync callers still
// fence durability through this method when the store is a Volume.
Sync(ctx context.Context) (bool, error)
// Store indicates the volume is a hydra store.
store.Store
// Coordinator coordinates direct multi-writer ObjectStore access.
coord.Coordinator
// Close closes the volume, returning any errors.
Close() error
// Delete closes the volume and removes the backing store.
// After Delete returns, the volume's persistent data is gone.
// Close is idempotent after Delete.
Delete() error
}
Volume stores data with an associated peer ID.
type VolumeBlockStore ¶
type VolumeBlockStore struct {
Volume
// contains filtered or unexported fields
}
VolumeBlockStore wraps a volume with a block store.
func NewVolumeBlockStore ¶
func NewVolumeBlockStore(vol Volume, blockStore block.StoreOps) *VolumeBlockStore
NewVolumeBlockStore constructs a new wrapper with a block store around a volume.
func (*VolumeBlockStore) BeginDeferFlush ¶
func (v *VolumeBlockStore) BeginDeferFlush()
BeginDeferFlush forwards the GC defer-flush scope to the wrapped block store.
func (*VolumeBlockStore) EndDeferFlush ¶
func (v *VolumeBlockStore) EndDeferFlush(ctx context.Context) error
EndDeferFlush forwards closing the GC defer-flush scope to the wrapped block store.
func (*VolumeBlockStore) GetBlockExists ¶
GetBlockExists checks if a block exists with a cid reference.
func (*VolumeBlockStore) GetBlockExistsBatch ¶
func (v *VolumeBlockStore) GetBlockExistsBatch(ctx context.Context, refs []*block.BlockRef) ([]bool, error)
GetBlockExistsBatch forwards batched existence probes to the wrapped block store when supported.
func (*VolumeBlockStore) GetGCManagerHooks ¶
func (v *VolumeBlockStore) GetGCManagerHooks() (block_gc.ManagerHooks, bool)
GetGCManagerHooks forwards WAL-backed GC manager hooks from the wrapped volume when available.
func (*VolumeBlockStore) GetHashType ¶
func (v *VolumeBlockStore) GetHashType() hash.HashType
GetHashType returns the preferred hash type for the store.
func (*VolumeBlockStore) GetSupportedFeatures ¶
func (v *VolumeBlockStore) GetSupportedFeatures() block.StoreFeature
GetSupportedFeatures returns the native feature bitmask for the store.
func (*VolumeBlockStore) PutBlock ¶
func (v *VolumeBlockStore) PutBlock(ctx context.Context, data []byte, opts *block.PutOpts) (*block.BlockRef, bool, error)
PutBlock puts a block into the store.
func (*VolumeBlockStore) PutBlockBatch ¶
func (v *VolumeBlockStore) PutBlockBatch(ctx context.Context, entries []*block.PutBatchEntry) error
PutBlockBatch forwards batched writes to the wrapped block store when supported.
type VolumeBucketInfo ¶
type VolumeBucketInfo struct {
// BucketInfo is the bucket information.
BucketInfo *bucket.BucketInfo `protobuf:"bytes,1,opt,name=bucket_info,json=bucketInfo,proto3" json:"bucketInfo,omitempty"`
// VolumeInfo is the volume containing the bucket instance.
VolumeInfo *VolumeInfo `protobuf:"bytes,2,opt,name=volume_info,json=volumeInfo,proto3" json:"volumeInfo,omitempty"`
// contains filtered or unexported fields
}
VolumeBucketInfo is information about a bucket in a volume.
func (*VolumeBucketInfo) CloneMessageVT ¶
func (m *VolumeBucketInfo) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*VolumeBucketInfo) CloneVT ¶
func (m *VolumeBucketInfo) CloneVT() *VolumeBucketInfo
func (*VolumeBucketInfo) EqualMessageVT ¶
func (this *VolumeBucketInfo) EqualMessageVT(thatMsg any) bool
func (*VolumeBucketInfo) EqualVT ¶
func (this *VolumeBucketInfo) EqualVT(that *VolumeBucketInfo) bool
func (*VolumeBucketInfo) GetBucketInfo ¶
func (x *VolumeBucketInfo) GetBucketInfo() *bucket.BucketInfo
func (*VolumeBucketInfo) GetVolumeInfo ¶
func (x *VolumeBucketInfo) GetVolumeInfo() *VolumeInfo
func (*VolumeBucketInfo) MarshalJSON ¶
func (x *VolumeBucketInfo) MarshalJSON() ([]byte, error)
MarshalJSON marshals the VolumeBucketInfo to JSON.
func (*VolumeBucketInfo) MarshalProtoJSON ¶
func (x *VolumeBucketInfo) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the VolumeBucketInfo message to JSON.
func (*VolumeBucketInfo) MarshalProtoText ¶
func (x *VolumeBucketInfo) MarshalProtoText() string
func (*VolumeBucketInfo) MarshalToSizedBufferVT ¶
func (m *VolumeBucketInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*VolumeBucketInfo) MarshalToVT ¶
func (m *VolumeBucketInfo) MarshalToVT(dAtA []byte) (int, error)
func (*VolumeBucketInfo) MarshalVT ¶
func (m *VolumeBucketInfo) MarshalVT() (dAtA []byte, err error)
func (*VolumeBucketInfo) ProtoMessage ¶
func (*VolumeBucketInfo) ProtoMessage()
func (*VolumeBucketInfo) Reset ¶
func (x *VolumeBucketInfo) Reset()
func (*VolumeBucketInfo) SizeVT ¶
func (m *VolumeBucketInfo) SizeVT() (n int)
func (*VolumeBucketInfo) String ¶
func (x *VolumeBucketInfo) String() string
func (*VolumeBucketInfo) UnmarshalJSON ¶
func (x *VolumeBucketInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the VolumeBucketInfo from JSON.
func (*VolumeBucketInfo) UnmarshalProtoJSON ¶
func (x *VolumeBucketInfo) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the VolumeBucketInfo message from JSON.
func (*VolumeBucketInfo) UnmarshalVT ¶
func (m *VolumeBucketInfo) UnmarshalVT(dAtA []byte) error
type VolumeInfo ¶
type VolumeInfo struct {
// VolumeId is the volume ID as determined by the controller.
VolumeId string `protobuf:"bytes,1,opt,name=volume_id,json=volumeId,proto3" json:"volumeId,omitempty"`
// PeerId is the peer ID of the volume.
PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
// PeerPub is the pem public key of the volume.
PeerPub string `protobuf:"bytes,3,opt,name=peer_pub,json=peerPub,proto3" json:"peerPub,omitempty"`
// ControllerInfo is information about the volume controller.
// Note: may be empty.
ControllerInfo *controller.Info `protobuf:"bytes,4,opt,name=controller_info,json=controllerInfo,proto3" json:"controllerInfo,omitempty"`
// HashType is the default block hash type to use for blocks.
// If unset (0 value) will use the Spacewave default (SHA256).
HashType hash.HashType `protobuf:"varint,5,opt,name=hash_type,json=hashType,proto3" json:"hashType,omitempty"`
// contains filtered or unexported fields
}
VolumeInfo contains basic information about a volume.
func NewVolumeInfo ¶
func NewVolumeInfo(ctx context.Context, ci *controller.Info, vol Volume) (*VolumeInfo, error)
NewVolumeInfo constructs volume info from a volume.
func (*VolumeInfo) CloneMessageVT ¶
func (m *VolumeInfo) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*VolumeInfo) CloneVT ¶
func (m *VolumeInfo) CloneVT() *VolumeInfo
func (*VolumeInfo) EqualMessageVT ¶
func (this *VolumeInfo) EqualMessageVT(thatMsg any) bool
func (*VolumeInfo) EqualVT ¶
func (this *VolumeInfo) EqualVT(that *VolumeInfo) bool
func (*VolumeInfo) GetControllerInfo ¶
func (x *VolumeInfo) GetControllerInfo() *controller.Info
func (*VolumeInfo) GetHashType ¶
func (x *VolumeInfo) GetHashType() hash.HashType
func (*VolumeInfo) GetPeerId ¶
func (x *VolumeInfo) GetPeerId() string
func (*VolumeInfo) GetPeerPub ¶
func (x *VolumeInfo) GetPeerPub() string
func (*VolumeInfo) GetVolumeId ¶
func (x *VolumeInfo) GetVolumeId() string
func (*VolumeInfo) MarshalJSON ¶
func (x *VolumeInfo) MarshalJSON() ([]byte, error)
MarshalJSON marshals the VolumeInfo to JSON.
func (*VolumeInfo) MarshalProtoJSON ¶
func (x *VolumeInfo) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the VolumeInfo message to JSON.
func (*VolumeInfo) MarshalProtoText ¶
func (x *VolumeInfo) MarshalProtoText() string
func (*VolumeInfo) MarshalToSizedBufferVT ¶
func (m *VolumeInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*VolumeInfo) MarshalToVT ¶
func (m *VolumeInfo) MarshalToVT(dAtA []byte) (int, error)
func (*VolumeInfo) MarshalVT ¶
func (m *VolumeInfo) MarshalVT() (dAtA []byte, err error)
func (*VolumeInfo) ParsePeerID ¶
func (i *VolumeInfo) ParsePeerID() (peer.ID, error)
ParsePeerID parses the peer ID.
func (*VolumeInfo) ParsePeerPub ¶
func (i *VolumeInfo) ParsePeerPub() (crypto.PublicKey, error)
ParsePeerPub parses the public key.
func (*VolumeInfo) ParseToPeer ¶
func (i *VolumeInfo) ParseToPeer() (peer.Peer, error)
ParseToPeer parses the fields and builds the corresponding Peer.
func (*VolumeInfo) ProtoMessage ¶
func (*VolumeInfo) ProtoMessage()
func (*VolumeInfo) Reset ¶
func (x *VolumeInfo) Reset()
func (*VolumeInfo) ResolveHashType ¶ added in v0.51.7
func (i *VolumeInfo) ResolveHashType() hash.HashType
ResolveHashType resolves the volume info hash choice.
func (*VolumeInfo) SizeVT ¶
func (m *VolumeInfo) SizeVT() (n int)
func (*VolumeInfo) String ¶
func (x *VolumeInfo) String() string
func (*VolumeInfo) UnmarshalJSON ¶
func (x *VolumeInfo) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the VolumeInfo from JSON.
func (*VolumeInfo) UnmarshalProtoJSON ¶
func (x *VolumeInfo) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the VolumeInfo message from JSON.
func (*VolumeInfo) UnmarshalVT ¶
func (m *VolumeInfo) UnmarshalVT(dAtA []byte) error
func (*VolumeInfo) Validate ¶
func (i *VolumeInfo) Validate() error
Validate validates the VolumeInfo object.
type WriteOrderer ¶
type WriteOrderer interface {
// OrdersWrites reports whether the volume makes writes durable in order.
OrdersWrites() bool
// WaitDurable waits until every write completed before the call is
// durable, without forcing a flush.
WaitDurable(ctx context.Context) error
}
WriteOrderer is implemented by a volume whose block and object store writes become durable in commit order: once a durable commit completes, every earlier write is durable too. A writer whose block writes are followed by a durable object store commit on the same volume needs no Sync between them.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
common
|
|
|
Package crashtest checks that a volume engine recovers from a crash at any point of a randomized workload to a state its commits allow.
|
Package crashtest checks that a volume engine recovers from a crash at any point of a randomized workload to a state its commits allow. |
|
Package device defines the storage device a browser volume engine writes through, with memory and file implementations.
|
Package device defines the storage device a browser volume engine writes through, with memory and file implementations. |
|
devicetest
Package devicetest checks a device.Device against its contract, so native tests and browser fixtures run the same checks on every implementation.
|
Package devicetest checks a device.Device against its contract, so native tests and browser fixtures run the same checks on every implementation. |
|
opfs
Package device_opfs implements device.Device on an OPFS directory with sync access handles, which only a dedicated worker can open.
|
Package device_opfs implements device.Device on an OPFS directory with sync access handles, which only a dedicated worker can open. |
|
Package direct is a volume engine that stores every key-value entry, block, and journal entry as its own record in a records.Store, the shape of an IndexedDB object store.
|
Package direct is a volume engine that stores every key-value entry, block, and journal entry as its own record in a records.Store, the shape of an IndexedDB object store. |
|
Package volume_idb implements the browser volume engines' storage primitives on IndexedDB: a chunked device.Device and a records.Store.
|
Package volume_idb implements the browser volume engines' storage primitives on IndexedDB: a chunked device.Device and a records.Store. |
|
Package journal encodes the garbage collection journal entries volume engines store.
|
Package journal encodes the garbage collection journal entries volume engines store. |
|
js
|
|
|
opfs/refgraph
Package refgraph stores the garbage-collection ownership graph in the OPFS volume catalogue.
|
Package refgraph stores the garbage-collection ownership graph in the OPFS volume catalogue. |
|
Package logindex is an ordered key-value index on a storage Device that keeps the whole table in memory and writes it as a log.
|
Package logindex is an ordered key-value index on a storage Device that keeps the whole table in memory and writes it as a log. |
|
Package memtable is an in-memory ordered key-value table with copy-on-write snapshots, which its owner persists through a commit function.
|
Package memtable is an in-memory ordered key-value table with copy-on-write snapshots, which its owner persists through a commit function. |
|
Package paylog is a volume engine shell over a storage Device: block payloads append to a log of segment files, and one ordered index holds the key-value store, the block locations, and the garbage collection journal.
|
Package paylog is a volume engine shell over a storage Device: block payloads append to a log of segment files, and one ordered index holds the key-value store, the block locations, and the garbage collection journal. |
|
Package records defines the ordered record store an IndexedDB object store provides, with a memory implementation that simulates power loss.
|
Package records defines the ordered record store an IndexedDB object store provides, with a memory implementation that simulates power loss. |
|
recordstest
Package recordstest checks a records.Store against its contract, so native tests and browser fixtures run the same checks on every implementation.
|
Package recordstest checks a records.Store against its contract, so native tests and browser fixtures run the same checks on every implementation. |
|
Package workload records the logical operations a Volume's storage engine serves, as runtime/trace log events, so the workload captured from a running app can be extracted from its execution trace and replayed against another engine.
|
Package workload records the logical operations a Volume's storage engine serves, as runtime/trace log events, so the workload captured from a running app can be extracted from its execution trace and replayed against another engine. |