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

provider_local

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: 92 Imported by: 0

Documentation

Index

Constants

View Source
const ControllerID = "provider/local"

ControllerID is the controller id.

View Source
const ProviderID = "local"

ProviderID is the default ID for the local provider.

View Source
const SRPCAccountReplicaServiceServiceID = "provider.local.AccountReplicaService"

Variables

View Source
var ConfigID = ControllerID

ConfigID is the id attached to the config objects.

View Source
var ErrDirectInviteOwnerMustBeOnline = errors.New("space owner must be online to accept this invite directly")

ErrDirectInviteOwnerMustBeOnline indicates the direct invite path requires the owner to be reachable on the live transport.

View Source
var ErrNoSessionTransport = errors.New("no session transport running")

ErrNoSessionTransport indicates an unavailable account transport.

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

Version is the controller version

Functions

func BlockStoreBucketID

func BlockStoreBucketID(providerID, accountID, blockStoreID string) string

BlockStoreBucketID returns the bucket id for a block store.

func BlockStoreLocalID

func BlockStoreLocalID(providerID, accountID, blockStoreID string) string

BlockStoreLocalID returns the local block store id for a block store.

func BlockStoreWritebackObjectStoreID

func BlockStoreWritebackObjectStoreID(providerID, accountID, blockStoreID string) string

BlockStoreWritebackObjectStoreID returns the object store id holding a block store's queued uploads.

func CheckS3Location

CheckS3Location writes, reads back, and deletes a probe object in the bucket, and classifies the first failure.

func HasSessionEnvelope added in v0.54.0

func HasSessionEnvelope(ctx context.Context, objStore object.ObjectStore, sessionID string) (bool, error)

HasSessionEnvelope reports whether a local session recovery envelope exists.

func LinkedCloudKey

func LinkedCloudKey(sessionID string) []byte

LinkedCloudKey returns the ObjectStore key for the linked-cloud account ID.

func NewBlockStoreRef

func NewBlockStoreRef(providerID, providerAccountID, bstoreID string) *bstore.BlockStoreRef

NewBlockStoreRef builds a new BlockStoreRef.

func NewObjectStoreSOStateFuncs

func NewObjectStoreSOStateFuncs(rctx context.Context, objStore object.ObjectStore, localPeer peer.ID) (
	watchFn sobject.SOStateWatchFunc,
	lockFn sobject.SOStateLockFunc,
	syncFuncs *sobject.SOHostSyncFuncs,
)

NewObjectStoreSOStateFuncs constructs a SOHostState backed by an object store and in-memory locks.

Assumes no other writers will access the object store. rctx is the context to use for looking up states from the object store. localPeer binds private read checkpoints to the local participant; empty disables retention.

func NewProviderAccountInfo

func NewProviderAccountInfo(providerID, accountID string) *provider.ProviderAccountInfo

NewProviderAccountInfo constructs a new provider account info object for the local provider.

func NewProviderInfo

func NewProviderInfo(providerID string) *provider.ProviderInfo

NewProviderInfo constructs the provider info.

func NewSOHostSyncFuncs

func NewSOHostSyncFuncs(store kvtx.Store) *sobject.SOHostSyncFuncs

NewSOHostSyncFuncs reads retained lineage from the object store. Local imports use the ordinary host lock, which commits state and lineage together.

func NewSRPCAccountReplicaServiceHandler

func NewSRPCAccountReplicaServiceHandler(impl SRPCAccountReplicaServiceServer, serviceID string) srpc.Handler

NewSRPCAccountReplicaServiceHandler constructs a new RPC handler. serviceID: if empty, uses default: provider.local.AccountReplicaService

func ProviderIRI

func ProviderIRI(providerID string) string

ProviderIRI returns the GC IRI for a provider: "provider:{id}".

func ReadEnvelope

func ReadEnvelope(ctx context.Context, objStore object.ObjectStore, sessionID string) ([]byte, error)

ReadEnvelope reads the Shamir envelope bytes from the ObjectStore.

func SOConfigHistoryCheckpointKey

func SOConfigHistoryCheckpointKey(sharedObjectID string) []byte

SOConfigHistoryCheckpointKey addresses the locally held configuration from which retained history begins. Its value is a serialized SharedObjectConfig.

func SOConfigHistoryEntryKey

func SOConfigHistoryEntryKey(sharedObjectID string, hash []byte) []byte

SOConfigHistoryEntryKey addresses a serialized SOConfigChange by its hash.

func SRPCRegisterAccountReplicaService

func SRPCRegisterAccountReplicaService(mux srpc.Mux, impl SRPCAccountReplicaServiceServer) error

SRPCRegisterAccountReplicaService registers the implementation with the mux. Uses the default serviceID: provider.local.AccountReplicaService

func SessionObjectStoreID

func SessionObjectStoreID(providerID, accountID string) string

SessionObjectStoreID returns the object store id for sessions.

func SessionObjectStorePrivKey

func SessionObjectStorePrivKey(sessionID string) []byte

SessionObjectStorePrivKey returns the object store key for the priv key for a session with the given id.

func SessionObjectStoreStateKey

func SessionObjectStoreStateKey(sessionID string) []byte

SessionObjectStoreStateKey returns the object store key for the state for a session with the given id.

func SobjectBindingKey

func SobjectBindingKey(purpose string) []byte

SobjectBindingKey returns the object store key for a shared object binding purpose.

func SobjectBlockStoreID

func SobjectBlockStoreID(sobjectID string) string

SobjectBlockStoreID returns the block store id for a shared object. Block stores backing a shared object share the shared object's ULID verbatim; no prefix is added.

func SobjectObjectStoreHostStateKey

func SobjectObjectStoreHostStateKey(sharedObjectID string) []byte

SobjectObjectStoreHostStateKey returns the object store key for a shared object with the given id.

func SobjectObjectStoreID

func SobjectObjectStoreID(providerID, accountID string) string

SobjectObjectStoreID returns the object store id for shared objects.

func SobjectObjectStoreListKey

func SobjectObjectStoreListKey() []byte

SobjectObjectStoreListKey returns the object store key for the shared object list.

func SobjectObjectStoreLocalOpResultKey

func SobjectObjectStoreLocalOpResultKey(sharedObjectID, opLocalID string) []byte

SobjectObjectStoreLocalOpResultKey returns the object store key for a shared object op result.

func SobjectObjectStoreLocalStateKey

func SobjectObjectStoreLocalStateKey(sharedObjectID string) []byte

SobjectObjectStoreLocalStateKey returns the object store key for a shared object with the given id.

func StorageVolumeID

func StorageVolumeID(providerID, accountID string) string

StorageVolumeID returns the storage volume id for a provider account.

func UnlockSessionFromEnvelope

func UnlockSessionFromEnvelope(ctx context.Context, objStore object.ObjectStore, sessionID string, entityPrivKey bifrost_crypto.PrivKey) (bifrost_crypto.PrivKey, error)

UnlockSessionFromEnvelope recovers the session private key from the envelope using the provided entity private key.

func WriteSOConfigCheckpoint

func WriteSOConfigCheckpoint(ctx context.Context, tx kvtx.Tx, id string, config *sobject.SharedObjectConfig, replace bool) error

WriteSOConfigCheckpoint records already-held trust in the caller's state transaction. Only an explicit authenticated invitation may replace an existing checkpoint.

func WriteSOConfigHistory

func WriteSOConfigHistory(
	ctx context.Context,
	tx kvtx.Tx,
	sharedObjectID string,
	current, next *sobject.SharedObjectConfig,
	changes []*sobject.SOConfigChange,
) error

WriteSOConfigHistory retains verified transitions in the transaction that writes their resulting SOState. The caller commits both or discards both. Ordinary state writes do not establish or replace a history checkpoint. Retention records held trust; it does not authenticate legacy state or admit peers.

Types

type AccountReplicaCopyState

type AccountReplicaCopyState struct {

	// ObjectId identifies the SharedObject within this ProviderAccount.
	ObjectId string `protobuf:"bytes,1,opt,name=object_id,json=objectId,proto3" json:"objectId,omitempty"`
	// Head is the exact accepted World root being copied.
	Head *bucket.ObjectRef `protobuf:"bytes,2,opt,name=head,proto3" json:"head,omitempty"`
	// Blocks is the number of distinct blocks copied for this head.
	Blocks uint64 `protobuf:"varint,3,opt,name=blocks,proto3" json:"blocks,omitempty"`
	// Bytes is the at-rest size of those blocks, including local cache hits.
	Bytes uint64 `protobuf:"varint,4,opt,name=bytes,proto3" json:"bytes,omitempty"`
	// Complete is set only after all reachable blocks cross the durability fence.
	Complete bool `protobuf:"varint,5,opt,name=complete,proto3" json:"complete,omitempty"`
	// Error describes why this head could not finish; a later attempt resumes from local blocks.
	Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

AccountReplicaCopyState records local durability for one accepted World head.

func (*AccountReplicaCopyState) CloneMessageVT

func (*AccountReplicaCopyState) CloneVT

func (*AccountReplicaCopyState) EqualMessageVT

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

func (*AccountReplicaCopyState) EqualVT

func (*AccountReplicaCopyState) GetBlocks

func (x *AccountReplicaCopyState) GetBlocks() uint64

func (*AccountReplicaCopyState) GetBytes

func (x *AccountReplicaCopyState) GetBytes() uint64

func (*AccountReplicaCopyState) GetComplete

func (x *AccountReplicaCopyState) GetComplete() bool

func (*AccountReplicaCopyState) GetError

func (x *AccountReplicaCopyState) GetError() string

func (*AccountReplicaCopyState) GetHead

func (*AccountReplicaCopyState) GetObjectId

func (x *AccountReplicaCopyState) GetObjectId() string

func (*AccountReplicaCopyState) MarshalJSON

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

MarshalJSON marshals the AccountReplicaCopyState to JSON.

func (*AccountReplicaCopyState) MarshalProtoJSON

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

MarshalProtoJSON marshals the AccountReplicaCopyState message to JSON.

func (*AccountReplicaCopyState) MarshalProtoText

func (x *AccountReplicaCopyState) MarshalProtoText() string

func (*AccountReplicaCopyState) MarshalToSizedBufferVT

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

func (*AccountReplicaCopyState) MarshalToVT

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

func (*AccountReplicaCopyState) MarshalVT

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

func (*AccountReplicaCopyState) ProtoMessage

func (*AccountReplicaCopyState) ProtoMessage()

func (*AccountReplicaCopyState) Reset

func (x *AccountReplicaCopyState) Reset()

func (*AccountReplicaCopyState) SizeVT

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

func (*AccountReplicaCopyState) String

func (x *AccountReplicaCopyState) String() string

func (*AccountReplicaCopyState) UnmarshalJSON

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

UnmarshalJSON unmarshals the AccountReplicaCopyState from JSON.

func (*AccountReplicaCopyState) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the AccountReplicaCopyState message from JSON.

func (*AccountReplicaCopyState) UnmarshalVT

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

type AccountReplicaObjectRequest

type AccountReplicaObjectRequest struct {

	// SettingsId binds the request to the already enrolled account settings object.
	SettingsId string `protobuf:"bytes,1,opt,name=settings_id,json=settingsId,proto3" json:"settingsId,omitempty"`
	// ObjectId selects a live entry in that account's catalog.
	ObjectId string `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3" json:"objectId,omitempty"`
	// contains filtered or unexported fields
}

AccountReplicaObjectRequest selects an object within a known canonical account.

func (*AccountReplicaObjectRequest) CloneMessageVT

func (*AccountReplicaObjectRequest) CloneVT

func (*AccountReplicaObjectRequest) EqualMessageVT

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

func (*AccountReplicaObjectRequest) EqualVT

func (*AccountReplicaObjectRequest) GetObjectId

func (x *AccountReplicaObjectRequest) GetObjectId() string

func (*AccountReplicaObjectRequest) GetSettingsId

func (x *AccountReplicaObjectRequest) GetSettingsId() string

func (*AccountReplicaObjectRequest) MarshalJSON

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

MarshalJSON marshals the AccountReplicaObjectRequest to JSON.

func (*AccountReplicaObjectRequest) MarshalProtoJSON

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

MarshalProtoJSON marshals the AccountReplicaObjectRequest message to JSON.

func (*AccountReplicaObjectRequest) MarshalProtoText

func (x *AccountReplicaObjectRequest) MarshalProtoText() string

func (*AccountReplicaObjectRequest) MarshalToSizedBufferVT

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

func (*AccountReplicaObjectRequest) MarshalToVT

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

func (*AccountReplicaObjectRequest) MarshalVT

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

func (*AccountReplicaObjectRequest) ProtoMessage

func (*AccountReplicaObjectRequest) ProtoMessage()

func (*AccountReplicaObjectRequest) Reset

func (x *AccountReplicaObjectRequest) Reset()

func (*AccountReplicaObjectRequest) SizeVT

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

func (*AccountReplicaObjectRequest) String

func (x *AccountReplicaObjectRequest) String() string

func (*AccountReplicaObjectRequest) UnmarshalJSON

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

UnmarshalJSON unmarshals the AccountReplicaObjectRequest from JSON.

func (*AccountReplicaObjectRequest) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the AccountReplicaObjectRequest message from JSON.

func (*AccountReplicaObjectRequest) UnmarshalVT

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

type BlockStore

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

BlockStore implements the bstore interface.

func (*BlockStore) BeginDeferFlush

func (b *BlockStore) BeginDeferFlush()

BeginDeferFlush forwards the GC ref-batch scope to the inner store.

func (*BlockStore) BeginReadOperation added in v0.51.7

func (b *BlockStore) BeginReadOperation(ctx context.Context) (block.StoreOps, func(), error)

BeginReadOperation opens a read scope on the inner store.

func (*BlockStore) EndDeferFlush

func (b *BlockStore) EndDeferFlush(ctx context.Context) error

EndDeferFlush forwards the GC ref-batch scope to the inner store.

func (*BlockStore) GetBlock

func (b *BlockStore) GetBlock(ctx context.Context, ref *block.BlockRef) ([]byte, bool, error)

GetBlock forwards to the configured Session read store.

func (*BlockStore) GetBlockExists

func (b *BlockStore) GetBlockExists(ctx context.Context, ref *block.BlockRef) (bool, error)

GetBlockExists forwards to the configured Session read store.

func (*BlockStore) GetBlockExistsBatch

func (b *BlockStore) GetBlockExistsBatch(ctx context.Context, refs []*block.BlockRef) ([]bool, error)

GetBlockExistsBatch forwards batched existence probes to the configured read store.

func (*BlockStore) GetCopySource

func (b *BlockStore) GetCopySource() block.StoreOps

GetCopySource returns the store a graph copy reads from. A copy writes each block itself, so it reads peers without the per-block cache fill.

func (*BlockStore) GetDecodedBlockCache added in v0.51.7

func (b *BlockStore) GetDecodedBlockCache() *block.DecodedBlockCache

GetDecodedBlockCache returns the lifecycle-owned decoded-block cache.

func (*BlockStore) GetHashType

func (b *BlockStore) GetHashType() hash.HashType

GetHashType returns the inner store hash type.

func (*BlockStore) GetID

func (b *BlockStore) GetID() string

GetID returns the inner store id.

func (*BlockStore) GetStoredBlock

func (b *BlockStore) GetStoredBlock(ctx context.Context, ref *block.BlockRef) (*block.StoredBlock, error)

GetStoredBlock forwards to the inner store.

func (*BlockStore) GetSupportedFeatures

func (b *BlockStore) GetSupportedFeatures() block.StoreFeature

GetSupportedFeatures returns the native feature bitset for the inner store.

func (*BlockStore) GetUploadStatus

func (b *BlockStore) GetUploadStatus() (UploadStatus, <-chan struct{})

GetUploadStatus returns the storage backend and upload status, and a channel closed when either changes.

func (*BlockStore) InvalidateDecodedBlockRef added in v0.51.7

func (b *BlockStore) InvalidateDecodedBlockRef(ctx context.Context, ref *block.BlockRef)

InvalidateDecodedBlockRef removes decoded-cache entries for ref.

func (*BlockStore) MarkRootsComplete

func (b *BlockStore) MarkRootsComplete(ctx context.Context, roots []*block.BlockRef) error

MarkRootsComplete forwards the durable World proof.

func (*BlockStore) PinRoot

func (b *BlockStore) PinRoot(ctx context.Context, ref *block.BlockRef) (func(), error)

PinRoot forwards a reader pin to the underlying store.

func (*BlockStore) PutBlock

func (b *BlockStore) PutBlock(ctx context.Context, data []byte, opts *block.PutOpts) (*block.BlockRef, bool, error)

PutBlock forwards to the inner store.

func (*BlockStore) PutBlockBatch

func (b *BlockStore) PutBlockBatch(ctx context.Context, entries []*block.PutBatchEntry) error

PutBlockBatch forwards batched writes to the inner store.

func (*BlockStore) ReclaimStorage

func (b *BlockStore) ReclaimStorage(ctx context.Context, fence func(context.Context) error) (time.Time, error)

ReclaimStorage drops the blocks the local store no longer holds from the storage backend's bucket. Returns zero without calling fence when no storage backend is open.

func (*BlockStore) ReleaseRoots

func (b *BlockStore) ReleaseRoots(ctx context.Context, refs []*block.BlockRef) error

ReleaseRoots forwards staging release to the underlying store.

func (*BlockStore) RmBlock

func (b *BlockStore) RmBlock(ctx context.Context, ref *block.BlockRef) error

RmBlock forwards to the inner store.

func (*BlockStore) RootComplete

func (b *BlockStore) RootComplete(ctx context.Context, ref *block.BlockRef) (bool, error)

RootComplete checks the underlying World proof.

func (*BlockStore) SetRetainedRoot

func (b *BlockStore) SetRetainedRoot(ctx context.Context, name string, ref *block.BlockRef) error

SetRetainedRoot forwards durable root ownership to the underlying store.

func (*BlockStore) StatBlock

func (b *BlockStore) StatBlock(ctx context.Context, ref *block.BlockRef) (*block.BlockStat, error)

StatBlock forwards to the configured Session read store.

func (*BlockStore) SupportsRootRetention

func (b *BlockStore) SupportsRootRetention() bool

SupportsRootRetention reports the underlying ownership capability.

func (*BlockStore) Sync added in v0.52.0

func (b *BlockStore) Sync(ctx context.Context) (bool, error)

Sync forwards the durability barrier to the inner store.

func (*BlockStore) WaitUploaded

func (b *BlockStore) WaitUploaded(ctx context.Context) error

WaitUploaded waits until the storage backend holds every block written so far. Returns immediately when no storage backend is open, and returns the upload error while uploads fail. Concurrent writes extend the wait.

type Config

type Config struct {

	// ProviderId is the provider identifier.
	// Defaults to "local" if unset.
	// NOTE: Many places in the codebase expect this to be "local" so change carefully!
	ProviderId string `protobuf:"bytes,1,opt,name=provider_id,json=providerId,proto3" json:"providerId,omitempty"`
	// PeerId is the peer id to use.
	// If empty, uses the first value returned from GetPeer
	PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
	// StorageId is the storage id to use.
	// If empty, uses the default storage controller id.
	StorageId string `protobuf:"bytes,3,opt,name=storage_id,json=storageId,proto3" json:"storageId,omitempty"`
	// SignalingUrl is the trusted Spacewave Cloud signaling base URL used by
	// standalone local sessions without a linked cloud account. Each session
	// signs its own short-lived ticket request with its session keypair; no
	// cloud account or provider credential is involved. Empty disables WebRTC
	// signaling for standalone sessions.
	SignalingUrl string `protobuf:"bytes,4,opt,name=signaling_url,json=signalingUrl,proto3" json:"signalingUrl,omitempty"`
	// SignalingEnvPrefix is the request-signing namespace of the signaling server.
	// Empty uses the production namespace.
	SignalingEnvPrefix string `protobuf:"bytes,5,opt,name=signaling_env_prefix,json=signalingEnvPrefix,proto3" json:"signalingEnvPrefix,omitempty"`
	// contains filtered or unexported fields
}

Config configures the local space provider controller.

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. This string is stored with the encoded config.

func (*Config) GetPeerId

func (x *Config) GetPeerId() string

func (*Config) GetProviderId

func (x *Config) GetProviderId() string

func (*Config) GetSignalingEnvPrefix added in v0.57.4

func (x *Config) GetSignalingEnvPrefix() string

func (*Config) GetSignalingUrl added in v0.57.2

func (x *Config) GetSignalingUrl() string

func (*Config) GetStorageId

func (x *Config) GetStorageId() 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) ParsePeerID

func (c *Config) ParsePeerID() (peer.ID, error)

ParsePeerID parses the peer id field.

func (*Config) ParseSignalingURL added in v0.57.2

func (c *Config) ParseSignalingURL() (*url.URL, error)

ParseSignalingURL accepts an absolute HTTP(S) URL or an origin-relative path for browser signaling. Empty disables signaling for standalone local sessions.

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.

type Controller

Controller is the provider controller type.

type Factory

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

Factory constructs the local provider.

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds the factory.

func (*Factory) Construct

func (t *Factory) Construct(
	ctx context.Context,
	conf config.Config,
	opts controller.ConstructOpts,
) (controller.Controller, error)

Construct constructs the associated controller given configuration.

func (*Factory) ConstructConfig

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

GetControllerID returns the unique ID for the controller.

func (*Factory) GetVersion

func (t *Factory) GetVersion() controller.Version

GetVersion returns the version of this controller.

type LocalSOHost

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

LocalSOHost is the implementation of the local shared object host logic.

func NewLocalSOHost

func NewLocalSOHost(
	le *logrus.Entry,
	privKey crypto.PrivKey,
	soHost *sobject.SOHost,
	objStore object.ObjectStore,
	sharedObjectID string,
	sfs *block_transform.StepFactorySet,
) (*LocalSOHost, error)

NewLocalSOHost constructs a new LocalSOHost.

func (*LocalSOHost) AccessSharedObjectState

func (l *LocalSOHost) AccessSharedObjectState(ctx context.Context, released func()) (ccontainer.Watchable[sobject.SharedObjectStateSnapshot], func(), error)

AccessSharedObjectState adds a reference to the state and returns the state container.

func (*LocalSOHost) Execute

func (l *LocalSOHost) Execute(ctx context.Context) error

Execute executes the LocalSOHost logic.

func (*LocalSOHost) QueueOperation

func (l *LocalSOHost) QueueOperation(ctx context.Context, op []byte) (string, error)

QueueOperation applies an operation to the shared object op queue. Returns after the operation is durable in the host queue, the local queue, or as a recorded rejection, and visible in the published snapshot. When ctx carries sobject.WithOrderedOperation, a direct host state write is ordered instead: applied on return and durable at the store's next durability point. Returns the local op id.

func (*LocalSOHost) WaitOperation

func (l *LocalSOHost) WaitOperation(ctx context.Context, localID string) (uint64, bool, error)

WaitOperation waits for the operation to be confirmed or rejected by the provider. Success waits until body readers can observe at least the accepted root nonce. Returns the nonce of that published snapshot. An operation that left the host queue without a result, a rejection, or an accepted root nonce covering it returns ErrDroppedOp. If the operation was rejected, returns 0, true, error. Any other error returns 0, false, error.

type LocalSOOperationResult

type LocalSOOperationResult struct {

	// LocalId is the local operation id, must be a valid ulid.
	LocalId string `protobuf:"bytes,1,opt,name=local_id,json=localId,proto3" json:"localId,omitempty"`
	// Result is the operation result.
	Result *sobject.SOOperationResult `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	// RootSeqno is the root seqno that accepted or rejected the operation.
	RootSeqno uint64 `protobuf:"varint,3,opt,name=root_seqno,json=rootSeqno,proto3" json:"rootSeqno,omitempty"`
	// contains filtered or unexported fields
}

LocalSOOperationResult contains the result of a SOOperation.

func (*LocalSOOperationResult) CloneMessageVT

func (*LocalSOOperationResult) CloneVT

func (*LocalSOOperationResult) EqualMessageVT

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

func (*LocalSOOperationResult) EqualVT

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

func (*LocalSOOperationResult) GetLocalId

func (x *LocalSOOperationResult) GetLocalId() string

func (*LocalSOOperationResult) GetResult

func (*LocalSOOperationResult) GetRootSeqno added in v0.51.7

func (x *LocalSOOperationResult) GetRootSeqno() uint64

func (*LocalSOOperationResult) MarshalJSON

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

MarshalJSON marshals the LocalSOOperationResult to JSON.

func (*LocalSOOperationResult) MarshalProtoJSON

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

MarshalProtoJSON marshals the LocalSOOperationResult message to JSON.

func (*LocalSOOperationResult) MarshalProtoText

func (x *LocalSOOperationResult) MarshalProtoText() string

func (*LocalSOOperationResult) MarshalToSizedBufferVT

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

func (*LocalSOOperationResult) MarshalToVT

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

func (*LocalSOOperationResult) MarshalVT

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

func (*LocalSOOperationResult) ProtoMessage

func (*LocalSOOperationResult) ProtoMessage()

func (*LocalSOOperationResult) Reset

func (x *LocalSOOperationResult) Reset()

func (*LocalSOOperationResult) SizeVT

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

func (*LocalSOOperationResult) String

func (x *LocalSOOperationResult) String() string

func (*LocalSOOperationResult) UnmarshalJSON

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

UnmarshalJSON unmarshals the LocalSOOperationResult from JSON.

func (*LocalSOOperationResult) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the LocalSOOperationResult message from JSON.

func (*LocalSOOperationResult) UnmarshalVT

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

type LocalSOState

type LocalSOState struct {

	// OpQueue contains locally queued ops not applied to the SOHost yet.
	OpQueue []*sobject.QueuedSOOperation `protobuf:"bytes,1,rep,name=op_queue,json=opQueue,proto3" json:"opQueue,omitempty"`
	// contains filtered or unexported fields
}

LocalSOState contains the local state for a shared object.

func (*LocalSOState) CloneMessageVT

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

func (*LocalSOState) CloneVT

func (m *LocalSOState) CloneVT() *LocalSOState

func (*LocalSOState) EqualMessageVT

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

func (*LocalSOState) EqualVT

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

func (*LocalSOState) GetOpQueue

func (x *LocalSOState) GetOpQueue() []*sobject.QueuedSOOperation

func (*LocalSOState) MarshalJSON

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

MarshalJSON marshals the LocalSOState to JSON.

func (*LocalSOState) MarshalProtoJSON

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

MarshalProtoJSON marshals the LocalSOState message to JSON.

func (*LocalSOState) MarshalProtoText

func (x *LocalSOState) MarshalProtoText() string

func (*LocalSOState) MarshalToSizedBufferVT

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

func (*LocalSOState) MarshalToVT

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

func (*LocalSOState) MarshalVT

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

func (*LocalSOState) ProtoMessage

func (*LocalSOState) ProtoMessage()

func (*LocalSOState) Reset

func (x *LocalSOState) Reset()

func (*LocalSOState) SizeVT

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

func (*LocalSOState) String

func (x *LocalSOState) String() string

func (*LocalSOState) UnmarshalJSON

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

UnmarshalJSON unmarshals the LocalSOState from JSON.

func (*LocalSOState) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the LocalSOState message from JSON.

func (*LocalSOState) UnmarshalVT

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

type MovePhase

type MovePhase int

MovePhase is a step of a storage move.

const (
	// MovePhaseFetch copies blocks held only by the old backend into the
	// account's own storage.
	MovePhaseFetch MovePhase = iota + 1
	// MovePhaseUpload waits for the new backend to hold every block.
	MovePhaseUpload
	// MovePhaseDone reports the completed move.
	MovePhaseDone
)

type MoveProgress

type MoveProgress struct {
	// Phase is the current step.
	Phase MovePhase
	// Fetched is the number of blocks checked during the fetch phase.
	Fetched int
	// Total is the number of blocks the fetch phase checks.
	Total int
	// Upload is the new placement's upload status during the upload phase.
	Upload UploadStatus
}

MoveProgress is the state of a storage move.

type Provider

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

Provider implements the local provider.

func NewProvider

func NewProvider(
	le *logrus.Entry,
	b bus.Bus,
	storageID string,
	signalingURL string,
	signalingEnvPrefix string,
	info *provider.ProviderInfo,
	peer peer.Peer,
	handler provider.ProviderHandler,
) *Provider

NewProvider constructs a new Provider.

signalingURL is the trusted Spacewave Cloud signaling base URL persisted in the provider configuration. Standalone local sessions without a linked cloud account use it as their WebRTC transport rendezvous. Empty keeps those sessions without signaling.

func (*Provider) AccessProviderAccount

func (p *Provider) AccessProviderAccount(ctx context.Context, accountID string, released func()) (provider.ProviderAccount, func(), error)

AccessProviderAccount accesses a provider account. If accountID is empty, it will use the default or prompt the user. released may be nil.

func (*Provider) CreateLocalAccountAndSession

func (p *Provider) CreateLocalAccountAndSession(ctx context.Context, cloudAccountID string) (*session.SessionRef, error)

CreateLocalAccountAndSession initializes a local provider account and session. cloudAccountID links this local session to a cloud account (empty for standalone).

NOTE: this is a WIP / possibly temporary function.

func (*Provider) CreateLocalAccountAndSessionWithKey added in v0.57.2

func (p *Provider) CreateLocalAccountAndSessionWithKey(ctx context.Context, cloudAccountID string, keyPEM []byte) (*session.SessionRef, error)

CreateLocalAccountAndSessionWithKey initializes a local provider account and session seeded with the given session private key PEM. The key is used only when the session has no stored key yet; an existing stored key wins so the session reopens with its durable identity. An empty keyPEM generates a key.

func (*Provider) Execute

func (p *Provider) Execute(ctx context.Context) error

Execute executes the provider. Return nil for no-op (will not be restarted).

func (*Provider) GetProviderInfo

func (p *Provider) GetProviderInfo() *provider.ProviderInfo

GetProviderInfo returns the basic provider information.

type ProviderAccount

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

ProviderAccount implements the local provider account.

func (*ProviderAccount) AcceptMigrationSessions

func (a *ProviderAccount) AcceptMigrationSessions(ctx context.Context, transition *provider.AccountTransition, sourceKey, destinationKey crypto.PrivKey) error

AcceptMigrationSessions durably authorizes each returning Session peer before source retirement. Its storage identity is bound only after possession is proven.

func (*ProviderAccount) AccessSharedObjectHealth

func (a *ProviderAccount) AccessSharedObjectHealth(
	ctx context.Context,
	ref *sobject.SharedObjectRef,
	released func(),
) (ccontainer.Watchable[*sobject.SharedObjectHealth], func(), error)

AccessSharedObjectHealth adds a reference to shared object health by ref.

func (*ProviderAccount) AccessSharedObjectList

func (a *ProviderAccount) AccessSharedObjectList(ctx context.Context, released func()) (ccontainer.Watchable[*sobject.SharedObjectList], func(), error)

AccessSharedObjectList adds a reference to the list of shared objects and returns the container. Returns a release function. Accepts a function that is called if the Watchable becomes invalid.

func (*ProviderAccount) AddStorageBackend

func (a *ProviderAccount) AddStorageBackend(
	ctx context.Context,
	displayName string,
	location *account_settings.S3Location,
	creds *block_store_s3.Credentials,
	setDefault bool,
) (string, *block_store_s3.CheckResult, error)

AddStorageBackend checks the bucket with the credentials and, when the check passes, keeps the credentials in a storage credential Secret owned by the account and records the backend in the account settings. It returns the new backend id, or an empty id when the check failed.

func (*ProviderAccount) AttachMigratedSession

func (a *ProviderAccount) AttachMigratedSession(ctx context.Context, source session.Session, transition *provider.AccountTransition) (*session.SessionRef, error)

AttachMigratedSession rewraps this machine's existing key and obtains verified destination grants. A returning client uses its old authenticated transport.

func (*ProviderAccount) AutoStartP2PSyncIfNeeded added in v0.57.2

func (a *ProviderAccount) AutoStartP2PSyncIfNeeded(
	ctx context.Context,
	st *transport.SessionTransport,
) error

AutoStartP2PSyncIfNeeded starts P2P sync when the account has a paired Device, a joined Space, or an owned Space with invitations or participants. Session mount restores both invitation service and synchronization.

Errors mounting the account settings SO are logged and swallowed so a missing or unreadable SO does not abort the session mount.

func (*ProviderAccount) CheckMigrationSessions

func (a *ProviderAccount) CheckMigrationSessions(ctx context.Context, transition *provider.AccountTransition, _ crypto.PrivKey, _ crypto.PrivKey) error

CheckMigrationSessions checks the destination's complete current permission set. An externally owned Space can block enrollment; it is never silently omitted.

func (*ProviderAccount) CheckStorageBackend

func (a *ProviderAccount) CheckStorageBackend(ctx context.Context, backendID string) (*block_store_s3.CheckResult, error)

CheckStorageBackend runs the connectivity check against a saved backend.

func (*ProviderAccount) CommitAccountTransition

func (a *ProviderAccount) CommitAccountTransition(ctx context.Context, transition *provider.AccountTransition, _, _ crypto.PrivKey) error

CommitAccountTransition publishes the signed redirect while retaining source data.

func (*ProviderAccount) ConsumeSpaceLinkNonce added in v0.57.2

func (a *ProviderAccount) ConsumeSpaceLinkNonce(
	ctx context.Context,
	agentPeerID string,
	nonce []byte,
	payload []byte,
	expiresAt time.Time,
) error

ConsumeSpaceLinkNonce atomically records a consumed SpaceLink ticket nonce for this account. A replayed nonce is rejected before any state mutation.

func (*ProviderAccount) CreateBlockStore

func (a *ProviderAccount) CreateBlockStore(ctx context.Context, id string) (*bstore.BlockStoreRef, error)

CreateBlockStore creates a new bstore with the given details.

func (*ProviderAccount) CreateOrgSharedObject

func (a *ProviderAccount) CreateOrgSharedObject(ctx context.Context, orgID, displayName string) error

CreateOrgSharedObject creates an organization SharedObject and queues InitOrganizationOp. Used by the local provider to create orgs without any cloud API call.

func (*ProviderAccount) CreateSessionTransport

func (a *ProviderAccount) CreateSessionTransport(ctx context.Context, sessionKey crypto.PrivKey, signalingURL string) error

CreateSessionTransport creates and starts a session transport using the given session private key and signaling URL. If a transport is already running, it is stopped first.

The transport runs via a retrying RoutineContainer. Startup attempts remain owned by the same transport until readiness or a terminal stop.

func (*ProviderAccount) CreateSharedObject

func (a *ProviderAccount) CreateSharedObject(ctx context.Context, id string, meta *sobject.SharedObjectMeta, _, _ string) (*sobject.SharedObjectRef, error)

CreateSharedObject creates a new sobject with the given details.

func (*ProviderAccount) DeleteSharedObject

func (a *ProviderAccount) DeleteSharedObject(ctx context.Context, id string) error

DeleteSharedObject deletes the shared object with the given id.

func (*ProviderAccount) DeliverAccountTransition

func (a *ProviderAccount) DeliverAccountTransition(ctx context.Context, checkpoint *pairing.SharedObject) (*provider_migration.AccountTransitionReceipt, error)

DeliverAccountTransition accepts only history descending from this account's held authority. The new destination peer is authenticated by that history; its transport identity alone grants no access and receives no account data.

func (*ProviderAccount) EnrollMigratedSession

EnrollMigratedSession authorizes the actual authenticated stream peer, then verifies possession of the proposed destination storage key independently.

func (*ProviderAccount) EnrollPairingReceiver

func (a *ProviderAccount) EnrollPairingReceiver(ctx context.Context, stream *stream_packet.Session, enrollment *pairing.Enrollment, _ crypto.PrivKey, sourcePeer, receivingPeer peer.ID) error

EnrollPairingReceiver authorizes both receiving keys and transfers checkpoints.

func (*ProviderAccount) EnsureAccountSettingsSO

func (a *ProviderAccount) EnsureAccountSettingsSO(ctx context.Context) (*sobject.SharedObjectRef, error)

EnsureAccountSettingsSO returns the bound account settings SharedObjectRef, creating and binding a unique-id local settings SO when absent.

func (*ProviderAccount) EnsureConfiguredSessionTransport added in v0.57.2

func (a *ProviderAccount) EnsureConfiguredSessionTransport(
	ctx context.Context,
	sessionPriv crypto.PrivKey,
) error

EnsureConfiguredSessionTransport follows the session mount's transport and uses the provider's trusted signaling endpoint only when it must create one. It never replaces a mounted transport with an RPC-owned transport.

func (*ProviderAccount) EnsureSessionTransport

func (a *ProviderAccount) EnsureSessionTransport(
	ctx context.Context,
	sessionPriv crypto.PrivKey,
	relayURL string,
) error

EnsureSessionTransport creates the session transport if not already running.

func (*ProviderAccount) FetchObject

FetchObject authorizes the authenticated Session against the current canonical account registry. Catalog knowledge alone never permits checkpoint enrollment.

func (*ProviderAccount) GetAccountCopyProgress

func (a *ProviderAccount) GetAccountCopyProgress() ([]*AccountReplicaCopyState, <-chan struct{})

GetAccountCopyProgress returns isolated progress snapshots and the next change.

func (*ProviderAccount) GetAccountID

func (a *ProviderAccount) GetAccountID() string

GetAccountID returns the provider account identifier.

func (*ProviderAccount) GetAccountSettingsRef

func (a *ProviderAccount) GetAccountSettingsRef(ctx context.Context) (*sobject.SharedObjectRef, error)

GetAccountSettingsRef returns the bound account settings SharedObjectRef.

func (*ProviderAccount) GetAccountTransferSnapshot

func (a *ProviderAccount) GetAccountTransferSnapshot() (dex_solicit.TransferSnapshot, []<-chan struct{})

GetAccountTransferSnapshot aggregates real DEX payload traffic on the active account transport. A peer participating in several Spaces is counted once.

func (*ProviderAccount) GetMountedSessionPeerID

func (a *ProviderAccount) GetMountedSessionPeerID(ctx context.Context) peer.ID

GetMountedSessionPeerID returns the peer ID of a mounted local session.

func (*ProviderAccount) GetOnlinePeerIDsWithWait added in v0.51.7

func (a *ProviderAccount) GetOnlinePeerIDsWithWait(peerIDs []string) ([]string, []<-chan struct{})

GetOnlinePeerIDsWithWait returns the base58 peer IDs of paired devices that currently have an active bifrost link and change channels for transport and link state.

func (*ProviderAccount) GetP2PSyncSnapshotWithWait added in v0.57.0

func (a *ProviderAccount) GetP2PSyncSnapshotWithWait() (bool, <-chan struct{})

GetP2PSyncSnapshotWithWait returns whether P2P sync is running and a channel that closes when its lifecycle changes.

func (*ProviderAccount) GetPINSessionRecoveryState added in v0.54.0

func (a *ProviderAccount) GetPINSessionRecoveryState(ctx context.Context, ref *session.SessionRef) (session.SessionRecoveryState, error)

GetPINSessionRecoveryState reports whether the local PIN reset path has a recovery envelope to unlock with a password or backup key.

func (*ProviderAccount) GetProviderAccountFeature

func (a *ProviderAccount) GetProviderAccountFeature(ctx context.Context, feature provider.ProviderFeature) (provider.ProviderAccountFeature, error)

GetProviderAccountFeature returns the implementation of a specific provider feature.

Implements one of SpaceProvider, BlockStoreProvider, ... Check GetProviderInfo()=>features in advance before calling this. Returns ErrUnimplementedProviderFeature if the feature is not implemented.

func (*ProviderAccount) GetProviderID

func (a *ProviderAccount) GetProviderID() string

GetProviderID returns the provider identifier.

func (*ProviderAccount) GetSOListCtr

GetSOListCtr returns the shared object list container.

func (*ProviderAccount) GetSessionTransport

func (a *ProviderAccount) GetSessionTransport() *transport.SessionTransport

GetSessionTransport returns the running session transport, or nil.

func (*ProviderAccount) GetStepFactorySet

func (a *ProviderAccount) GetStepFactorySet() *block_transform.StepFactorySet

GetStepFactorySet returns the block transform step factory set.

func (*ProviderAccount) GetStorageStats

func (a *ProviderAccount) GetStorageStats(ctx context.Context) (*volume.StorageStats, error)

GetStorageStats returns storage usage statistics for the account volume.

func (*ProviderAccount) GetStorageStatsSnapshotWithWait added in v0.51.7

func (a *ProviderAccount) GetStorageStatsSnapshotWithWait(
	ctx context.Context,
) (*volume.StorageStats, <-chan struct{}, error)

GetStorageStatsSnapshotWithWait returns current storage statistics and a change channel for storage stats updates.

func (*ProviderAccount) GetTransportBroadcast

func (a *ProviderAccount) GetTransportBroadcast() *broadcast.Broadcast

GetTransportBroadcast returns the transport state broadcast.

func (*ProviderAccount) GetTransportSnapshotWithWait

func (a *ProviderAccount) GetTransportSnapshotWithWait() (bool, <-chan struct{})

GetTransportSnapshotWithWait returns whether transport is running and its wait channel.

func (*ProviderAccount) GetVolume

func (a *ProviderAccount) GetVolume() volume.Volume

GetVolume returns the parent volume for the account.

func (*ProviderAccount) ImportMigrationObject

ImportMigrationObject copies the accepted data before publishing its verified checkpoint. Source blocks and grants remain available after failure or retry.

func (*ProviderAccount) IsP2PSyncRunning

func (a *ProviderAccount) IsP2PSyncRunning() bool

IsP2PSyncRunning returns whether P2P sync is currently active. Safe to call from any goroutine.

func (*ProviderAccount) JoinViaInvite

func (a *ProviderAccount) JoinViaInvite(
	ctx context.Context,
	sessionKey crypto.PrivKey,
	inviteMsg *sobject.SOInviteMessage,
	signalingURL string,
) (*sobject_invite.JoinResult, error)

JoinViaInvite executes the full invite join flow.

1. Ensures a session transport is running (starts one if needed) 2. Opens an SRPC stream to the owner and sends AcceptInviteRequest 3. Receives the SOGrant from the owner 4. Mounts the shared object with the grant 5. Starts P2P sync so SolicitSync delivers state

The inviteMsg is the out-of-band SOInviteMessage from the owner. sessionKey is the invitee's session private key. signalingURL is the cloud API base URL for signaling (can be empty for local).

func (*ProviderAccount) LeaveSharedObject

func (a *ProviderAccount) LeaveSharedObject(ctx context.Context, sessionKey crypto.PrivKey, id string) error

LeaveSharedObject relinquishes this account's storage and calling device grants. The native owner acknowledges removal before this account installs revocation. Existing local data stays retained; this operation does not delete the shared object.

func (*ProviderAccount) ListBlockStoreRefs

func (a *ProviderAccount) ListBlockStoreRefs(ctx context.Context, blockStoreID string) ([]*block.BlockRef, error)

ListBlockStoreRefs returns every block the block store holds: the blocks reachable in the volume's GC ref graph from the store's bucket node.

func (*ProviderAccount) ListStoredSessionIDs

func (a *ProviderAccount) ListStoredSessionIDs(ctx context.Context) ([]string, error)

ListStoredSessionIDs returns identities whose protected signing keys are already present in the account volume. It never mounts a Session, since mounting an unknown ID would generate a new key.

func (*ProviderAccount) MergePairingAccount

func (a *ProviderAccount) MergePairingAccount(ctx context.Context, mounted session.Session, destination provider.ProviderAccount, ref *session.SessionRef) (func(context.Context) (*session.SessionRef, error), error)

MergePairingAccount moves the approved source through the destination provider.

func (*ProviderAccount) MigrationInfo

func (a *ProviderAccount) MigrationInfo(ctx context.Context, key crypto.PrivKey) (*provider_migration.Info, error)

MigrationInfo reads the canonical registry and keeps the active Session in the census.

func (*ProviderAccount) MountBlockStore

func (a *ProviderAccount) MountBlockStore(ctx context.Context, ref *bstore.BlockStoreRef, released func()) (bstore.BlockStore, func(), error)

MountBlockStore attempts to mount a BlockStore returning the bstore and a release function.

usually called by the provider controller

func (*ProviderAccount) MountSession

func (a *ProviderAccount) MountSession(ctx context.Context, ref *session.SessionRef, released func()) (session.Session, func(), error)

MountSession attempts to mount a Session returning the session and a release function.

It is usually called by the provider controller.

func (*ProviderAccount) MountSharedObject

func (a *ProviderAccount) MountSharedObject(ctx context.Context, ref *sobject.SharedObjectRef, released func()) (sobject.SharedObject, func(), error)

MountSharedObject retains a ready SharedObject until the returned release runs.

func (*ProviderAccount) MoveSpaceStorage

func (a *ProviderAccount) MoveSpaceStorage(
	ctx context.Context,
	sharedObjectID string,
	backendID string,
	fn func(MoveProgress) error,
) error

MoveSpaceStorage moves a SharedObject's blocks to a storage backend, or to the account's own storage when backendID is empty, and calls fn with the progress until the new placement holds every block.

Leaving a backend first copies the blocks only it holds into the account's own storage, so the switch never strands a block. Entering a backend queues every block for upload, which continues after this call returns early. A repeated call resumes an interrupted move. The switch releases the store's objects on the old backend, which the account then deletes.

func (*ProviderAccount) OfferPairingAccount

func (a *ProviderAccount) OfferPairingAccount(ctx context.Context, key crypto.PrivKey) (*pairing.AccountOffer, error)

OfferPairingAccount identifies the canonical local account and its replica signer.

func (*ProviderAccount) PlaceBlockStore

func (a *ProviderAccount) PlaceBlockStore(ctx context.Context, blockStoreID, backendID string) error

PlaceBlockStore places a block store on a storage backend. An empty backendID returns the store to the account's own storage.

func (*ProviderAccount) PrepareDirectInvite added in v0.57.4

func (a *ProviderAccount) PrepareDirectInvite(
	ctx context.Context,
	sessionKey crypto.PrivKey,
	ownerKey crypto.PrivKey,
	invite *sobject.SOInviteMessage,
) error

PrepareDirectInvite binds an invitation to the account's live transport and keeps its invitation server running for the account lifetime.

func (*ProviderAccount) PreparePairingReceiver

func (a *ProviderAccount) PreparePairingReceiver(ctx context.Context, offer *pairing.AccountOffer, sourcePeer, receivingPeer peer.ID) (*pairing.Receiver, error)

PreparePairingReceiver reserves a receiving Session without granting account access.

func (*ProviderAccount) QueueOrgUpdateOp

func (a *ProviderAccount) QueueOrgUpdateOp(ctx context.Context, orgID string, op *s4wave_org.UpdateOrgOp) error

QueueOrgUpdateOp queues an UpdateOrgOp on the org SO.

func (*ProviderAccount) ReadStorageCredentials

func (a *ProviderAccount) ReadStorageCredentials(
	ctx context.Context,
	backend *account_settings.StorageBackend,
) (*block_store_s3.Credentials, error)

ReadStorageCredentials decrypts the credentials of a storage backend.

func (*ProviderAccount) RecordPairedDevice added in v0.57.2

func (a *ProviderAccount) RecordPairedDevice(
	ctx context.Context,
	remotePeerID string,
	displayName string,
) error

RecordPairedDevice persists a verified Device identity in account settings. SpaceLink approval uses it so the originating account restores P2P sync after daemon restart without repeating enrollment.

func (*ProviderAccount) RefreshSharedObjectList added in v0.52.0

func (a *ProviderAccount) RefreshSharedObjectList(context.Context) error

RefreshSharedObjectList keeps the SharedObjectProvider contract uniform. Local provider lists are updated synchronously by local mutations.

func (*ProviderAccount) RemoveStorageBackend

func (a *ProviderAccount) RemoveStorageBackend(ctx context.Context, backendID string) error

RemoveStorageBackend removes a backend that holds no Space and deletes its credential Secret. While Spaces are placed on it, the error names them.

It first deletes the objects of the block stores released on the backend, since removal drops the credentials. A failed delete leaves its objects in the bucket.

func (*ProviderAccount) ResetPINSession

func (a *ProviderAccount) ResetPINSession(ctx context.Context, ref *session.SessionRef, cred *session.EntityCredential) error

ResetPINSession resets a PIN-locked session via envelope recovery. Derives the entity key from the credential, recovers the session private key from the envelope, re-encrypts it in auto-unlock mode, and restarts the session tracker.

func (*ProviderAccount) ResolveNewSpaceStorageBackend

func (a *ProviderAccount) ResolveNewSpaceStorageBackend(ctx context.Context, requestedID string, accountStorage bool) (string, error)

ResolveNewSpaceStorageBackend returns the backend a new Space's blocks go on: the requested backend, else the account's default, else none. When accountStorage is set, returns none.

func (*ProviderAccount) RetainP2PPeer added in v0.57.2

func (a *ProviderAccount) RetainP2PPeer(ctx context.Context, remotePeerID peer.ID) error

RetainP2PPeer keeps an EstablishLinkWithPeer directive across P2P sync state restarts. Device enrollment calls it with the persisted invite owner so daemon restart reconnects without repeating the one-use invite.

func (*ProviderAccount) RetrySharedObjectSync

func (a *ProviderAccount) RetrySharedObjectSync(soID string) bool

RetrySharedObjectSync replaces the running SO sync directive for soID while preserving the active transport generation and every other controller. It reports whether an existing routine was restarted.

func (*ProviderAccount) RewrapSessionEnvelope

func (a *ProviderAccount) RewrapSessionEnvelope(ctx context.Context, keypairs []*session.EntityKeypair) error

RewrapSessionEnvelope re-wraps the session private key in a Shamir envelope using the current set of entity keypair public keys from the AccountSettings SharedObject.

The envelope is written to {sessionID}/env in the session's ObjectStore. Threshold is 0 (any single entity keypair can recover the session key).

Skipped silently when the session is locked (privkey not in memory) or when no entity keypairs are available.

func (*ProviderAccount) SetDefaultStorageBackend

func (a *ProviderAccount) SetDefaultStorageBackend(ctx context.Context, backendID string) error

SetDefaultStorageBackend selects the backend new Spaces use, or the account's own storage when backendID is empty.

func (*ProviderAccount) SetStorageBackendPricing

func (a *ProviderAccount) SetStorageBackendPricing(
	ctx context.Context,
	backendID string,
	pricing *block_store_s3.Pricing,
) error

SetStorageBackendPricing overrides the price list storage reclaim uses for a backend, or returns it to the published prices of the endpoint's service when pricing is nil. The backend's open stores reopen with the new prices.

func (*ProviderAccount) StartP2PSync

func (a *ProviderAccount) StartP2PSync(ctx context.Context, sessionTransport *transport.SessionTransport) error

StartP2PSync starts SO sync and DEX block exchange for all mounted shared objects. Called when a P2P-linked device connects.

The method waits for sessionTransport readiness and starts sync controllers on its child bus.

func (*ProviderAccount) StartPersistentP2PSync added in v0.57.2

func (a *ProviderAccount) StartPersistentP2PSync(ctx context.Context, sessionTransport *transport.SessionTransport) error

StartPersistentP2PSync starts P2P sync for the provider-account lifetime while bounding startup by ctx.

func (*ProviderAccount) StopP2PSync

func (a *ProviderAccount) StopP2PSync()

StopP2PSync stops all P2P sync controllers, waits for goroutines to finish, and releases references.

func (*ProviderAccount) StopSessionTransport

func (a *ProviderAccount) StopSessionTransport()

StopSessionTransport stops the running session transport if any.

func (*ProviderAccount) UnlinkDevice

func (a *ProviderAccount) UnlinkDevice(ctx context.Context, remotePeerID peer.ID) error

UnlinkDevice removes a paired device from the account settings SO and revokes its SO participant access on all shared objects.

func (*ProviderAccount) UnlockPINSession

func (a *ProviderAccount) UnlockPINSession(ctx context.Context, ref *session.SessionRef, pin []byte) error

UnlockPINSession unlocks a PIN-locked session before it is mounted. Stores the decrypted key on the ProviderAccount for the tracker to consume.

func (*ProviderAccount) UpdateSharedObjectMeta

func (a *ProviderAccount) UpdateSharedObjectMeta(ctx context.Context, id string, meta *sobject.SharedObjectMeta) error

UpdateSharedObjectMeta updates the metadata for an existing shared object.

func (*ProviderAccount) WaitGCCleanup added in v0.51.2

func (a *ProviderAccount) WaitGCCleanup(ctx context.Context) error

WaitGCCleanup waits for pending account GC cleanup to finish.

func (*ProviderAccount) WatchOrgList

func (a *ProviderAccount) WatchOrgList(ctx context.Context, cb func([]*api.OrgResponse)) error

WatchOrgList watches the organization list by scanning the SO list for org-typed SOs. Emits updates whenever the SO list changes. Returns when the context is canceled.

func (*ProviderAccount) WatchUploadStatus

func (a *ProviderAccount) WatchUploadStatus(ctx context.Context, sharedObjectID string, fn func(UploadStatus) error) error

WatchUploadStatus calls fn with the storage backend and upload status of a SharedObject's block store, then again after each change, until ctx ends or fn fails.

type SRPCAccountReplicaServiceClient

type SRPCAccountReplicaServiceClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// FetchObject authorizes the caller's registered storage identity and exports a checkpoint.
	FetchObject(ctx context.Context, in *AccountReplicaObjectRequest) (*pairing.SharedObject, error)
}

func NewSRPCAccountReplicaServiceClient

func NewSRPCAccountReplicaServiceClient(cc srpc.Client) SRPCAccountReplicaServiceClient

func NewSRPCAccountReplicaServiceClientWithServiceID

func NewSRPCAccountReplicaServiceClientWithServiceID(cc srpc.Client, serviceID string) SRPCAccountReplicaServiceClient

type SRPCAccountReplicaServiceHandler

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

func (SRPCAccountReplicaServiceHandler) GetMethodIDs

func (SRPCAccountReplicaServiceHandler) GetMethodIDs() []string

func (*SRPCAccountReplicaServiceHandler) GetServiceID

func (d *SRPCAccountReplicaServiceHandler) GetServiceID() string

func (*SRPCAccountReplicaServiceHandler) InvokeMethod

func (d *SRPCAccountReplicaServiceHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCAccountReplicaServiceHandler) InvokeMethod_FetchObject

type SRPCAccountReplicaServiceServer

type SRPCAccountReplicaServiceServer interface {
	// FetchObject authorizes the caller's registered storage identity and exports a checkpoint.
	FetchObject(context.Context, *AccountReplicaObjectRequest) (*pairing.SharedObject, error)
}

type SRPCAccountReplicaService_FetchObjectStream

type SRPCAccountReplicaService_FetchObjectStream interface {
	srpc.Stream
}

type Session

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

Session implements the session interface attached to sessionTracker.

func (*Session) AccessStateAtomStore

func (s *Session) AccessStateAtomStore(ctx context.Context, storeID string) (resource_state.StateAtomStore, error)

AccessStateAtomStore gets or creates a shared session state atom store.

func (*Session) GetBus

func (s *Session) GetBus() bus.Bus

GetBus returns the bus used for the session.

func (*Session) GetLockState

func (s *Session) GetLockState(ctx context.Context) (session.SessionLockMode, bool, error)

GetLockState returns the current lock mode and whether the session is locked.

func (*Session) GetPairingEngine

func (s *Session) GetPairingEngine() (*pairing.Engine, error)

GetPairingEngine returns this unlocked Session's account enrollment owner.

func (*Session) GetPairingTransport

func (s *Session) GetPairingTransport(ctx context.Context, relay pairing.Relay) (*transport.SessionTransport, error)

GetPairingTransport uses this Session's existing connection owner. An empty relay requests a direct connection and does not replace working signaling.

func (*Session) GetPeerId

func (s *Session) GetPeerId() peer.ID

GetPeerId returns the peer id used by the session.

func (*Session) GetPrivKey

func (s *Session) GetPrivKey() crypto.PrivKey

GetPrivKey returns the session private key. Returns nil if the session is locked.

func (*Session) GetProviderAccount

func (s *Session) GetProviderAccount() provider.ProviderAccount

GetProviderAccount returns the handle to the session provider account.

func (*Session) GetSessionRef

func (s *Session) GetSessionRef() *session.SessionRef

GetSessionRef returns the ref to the session.

func (*Session) LockSession

func (s *Session) LockSession(ctx context.Context) error

LockSession locks a running session, scrubbing the privkey from memory. The session tracker will restart and enter PIN-wait state when re-mounted.

func (*Session) RetireAccountTransport

func (s *Session) RetireAccountTransport(ctx context.Context) error

RetireAccountTransport releases this Session's old account transport before its unchanged key is mounted under the destination's independent lifetime.

func (*Session) SessionCredentialStore

func (s *Session) SessionCredentialStore() object.ObjectStore

SessionCredentialStore retains this mounted Session's own encrypted credential.

func (*Session) SetLockMode

func (s *Session) SetLockMode(ctx context.Context, mode session.SessionLockMode, pin []byte) error

SetLockMode changes the session lock mode. Hot switch: session stays running.

func (*Session) SnapshotStateAtomStoreIDs

func (s *Session) SnapshotStateAtomStoreIDs(ctx context.Context) ([]string, error)

SnapshotStateAtomStoreIDs returns the known session state atom store ids.

func (*Session) UnlockSession

func (s *Session) UnlockSession(ctx context.Context, pin []byte) error

UnlockSession unlocks a PIN-locked session. No-op if already unlocked.

func (*Session) WatchLockState

func (s *Session) WatchLockState(ctx context.Context, cb func(mode session.SessionLockMode, locked bool)) error

WatchLockState calls the callback with the current lock state and on changes.

func (*Session) WatchStateAtomStoreIDs

func (s *Session) WatchStateAtomStoreIDs(
	ctx context.Context,
	cb func(storeIDs []string) error,
) error

WatchStateAtomStoreIDs watches the known session state atom store ids.

type SharedObject

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

SharedObject implements the sobject interface attached to sobjectTracker.

func (*SharedObject) AccessLocalStateStore

func (s *SharedObject) AccessLocalStateStore(ctx context.Context, storeID string, released func()) (kvtx.Store, func(), error)

AccessLocalStateStore isolates state by SharedObject and store ID within the account's object store. Releasing the mount invalidates its local stores.

func (*SharedObject) AccessSharedObjectHealth

func (s *SharedObject) AccessSharedObjectHealth(ctx context.Context, released func()) (ccontainer.Watchable[*sobject.SharedObjectHealth], func(), error)

AccessSharedObjectHealth retains the provider's health watch for this mount.

func (*SharedObject) AccessSharedObjectState

func (s *SharedObject) AccessSharedObjectState(ctx context.Context, released func()) (ccontainer.Watchable[sobject.SharedObjectStateSnapshot], func(), error)

AccessSharedObjectState adds a reference to the state and returns the state container. Returns a release function. Accepts a function that is called if the Watchable becomes invalid.

func (*SharedObject) ClearOperationResult

func (s *SharedObject) ClearOperationResult(ctx context.Context, localID string) error

ClearOperationResult clears the operation state (rejection). No-op if the operation was successfully applied. Be sure to call this after WaitOperation returns an error. Call with the local operation id.

func (*SharedObject) CreateSOInviteOp

func (s *SharedObject) CreateSOInviteOp(
	ctx context.Context,
	ownerPrivKey crypto.PrivKey,
	role sobject.SOParticipantRole,
	providerID string,
	targetPeerID string,
	maxUses uint32,
	expiresAt *timestamppb.Timestamp,
) (*sobject.SOInviteMessage, error)

CreateSOInviteOp creates a signed invite and stores it locally.

func (*SharedObject) GetBackingVolume added in v0.57.0

func (s *SharedObject) GetBackingVolume() volume.Volume

GetBackingVolume returns the volume that owns this SharedObject's storage.

func (*SharedObject) GetBlockStore

func (s *SharedObject) GetBlockStore() bstore.BlockStore

GetBlockStore returns the block store mounted along with the SharedObject.

func (*SharedObject) GetBus

func (s *SharedObject) GetBus() bus.Bus

GetBus returns the bus used for the shared object.

func (*SharedObject) GetPeerID

func (s *SharedObject) GetPeerID() peer.ID

GetPeerID returns the local peer id for the shared object.

func (*SharedObject) GetPrivKey

func (s *SharedObject) GetPrivKey() crypto.PrivKey

GetPrivKey returns the private key for signing invite messages.

func (*SharedObject) GetProviderID

func (s *SharedObject) GetProviderID() string

GetProviderID returns the provider identifier for the invite message.

func (*SharedObject) GetSOHost

func (s *SharedObject) GetSOHost() *sobject.SOHost

GetSOHost returns the SOHost for invite operations.

func (*SharedObject) GetSOHostState

func (s *SharedObject) GetSOHostState(ctx context.Context) (*sobject.SOState, error)

GetSOHostState returns a snapshot of the current SOState via the SOHost.

func (*SharedObject) GetSharedObjectID

func (s *SharedObject) GetSharedObjectID() string

GetSharedObjectID returns the shared object id.

func (*SharedObject) GetSharedObjectReadCheckpoint

func (s *SharedObject) GetSharedObjectReadCheckpoint(ctx context.Context) (*sobject.SharedObjectReadCheckpoint, error)

GetSharedObjectReadCheckpoint returns the last readable snapshot retained at departure. A nil snapshot means this provider has no retained history for this participant.

func (*SharedObject) GetSharedObjectState

func (s *SharedObject) GetSharedObjectState(ctx context.Context) (sobject.SharedObjectStateSnapshot, error)

GetSharedObjectState returns a snapshot of the shared object state.

func (*SharedObject) IncrementInviteUses

func (s *SharedObject) IncrementInviteUses(ctx context.Context, signerPrivKey crypto.PrivKey, inviteID string) error

IncrementInviteUses increments invite uses locally.

func (*SharedObject) ProcessOperations

func (s *SharedObject) ProcessOperations(ctx context.Context, watch bool, cb sobject.ProcessOpsFunc) error

ProcessOperations processes operations as a validator. The ops should be processed in the order they are provided. The results must be a subset of ops (but does not need to have all ops). If watch is set, waits for ops to be queued, then calls cb. Does not return. If watch is unset, if there are no available ops, returns immediately. cb is called with the state snapshot and the decoded inner state.

func (*SharedObject) QueueOperation

func (s *SharedObject) QueueOperation(ctx context.Context, op []byte) (string, error)

QueueOperation applies an operation to the shared object op queue. Returns after the operation is applied to the local queue. Returns the local operation ID.

func (*SharedObject) QueueOrdersBlockWrites

func (s *SharedObject) QueueOrdersBlockWrites() bool

QueueOrdersBlockWrites reports whether queueing orders block writes. The block store and the operation queue share the account volume's ordered store.

func (*SharedObject) ReadSharedObjectConfigHistory

func (s *SharedObject) ReadSharedObjectConfigHistory(ctx context.Context, target *sobject.SharedObjectConfig) (*sobject.SharedObjectConfig, []*sobject.SOConfigChange, error)

ReadSharedObjectConfigHistory returns accepted lineage from the local trust checkpoint.

func (*SharedObject) ReadSharedObjectFullConfigHistory

func (s *SharedObject) ReadSharedObjectFullConfigHistory(ctx context.Context, target *sobject.SharedObjectConfig) ([]*sobject.SOConfigChange, error)

ReadSharedObjectFullConfigHistory proves an imported object's original lineage.

func (*SharedObject) ReadSharedObjectGenesis

func (s *SharedObject) ReadSharedObjectGenesis(ctx context.Context, base *sobject.SharedObjectConfig) (*sobject.SOConfigChange, error)

ReadSharedObjectGenesis returns the signed entry behind the oldest retained checkpoint. Older replicas may require their original owner to supply it.

func (*SharedObject) RevokeInvite

func (s *SharedObject) RevokeInvite(ctx context.Context, signerPrivKey crypto.PrivKey, inviteID string) error

RevokeInvite revokes an invite locally.

func (*SharedObject) WaitDurable

func (s *SharedObject) WaitDurable(ctx context.Context) error

WaitDurable waits until every state write completed before the call is durable, without forcing a flush.

func (*SharedObject) WaitOperation

func (s *SharedObject) WaitOperation(ctx context.Context, localID string) (uint64, bool, error)

WaitOperation waits for the operation to be confirmed or rejected by the provider. Returns the current state nonce (greater than or equal to the nonce when the op was applied). After ClearOperation has been called, this will return success even for failed ops! If the operation was rejected, returns 0, true, error. Any other error returns 0, false, error.

type UploadStatus

type UploadStatus struct {
	// Backend is the storage backend holding the store, nil for the account's
	// own storage.
	Backend *account_settings.StorageBackend
	// Status is the upload status of the queued writes.
	block_store_writeback.Status
}

UploadStatus is a block store's storage backend and upload status.

Jump to

Keyboard shortcuts

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