Documentation
¶
Index ¶
- Variables
- func RekeySOState(ctx context.Context, le *logrus.Entry, sfs *block_transform.StepFactorySet, ...) (*sobject.SOState, error)
- func TransferKeypair(ctx context.Context, source, target volume.Volume) error
- type CheckpointStore
- type CleanupSource
- type LocalTransferSource
- func (s *LocalTransferSource) DeleteSharedObject(ctx context.Context, soID string) error
- func (s *LocalTransferSource) DeleteVolume(ctx context.Context) error
- func (s *LocalTransferSource) GetAccount() *provider_local.ProviderAccount
- func (s *LocalTransferSource) GetBlockRefs(ctx context.Context, ref *sobject.SharedObjectRef) ([]*block.BlockRef, error)
- func (s *LocalTransferSource) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
- func (s *LocalTransferSource) GetSharedObjectList(ctx context.Context) (*sobject.SharedObjectList, error)
- func (s *LocalTransferSource) GetSharedObjectState(ctx context.Context, sharedObjectID string) (*sobject.SOState, error)
- type LocalTransferTarget
- func (t *LocalTransferTarget) AddSharedObject(ctx context.Context, ref *sobject.SharedObjectRef, ...) error
- func (t *LocalTransferTarget) GetAccount() *provider_local.ProviderAccount
- func (t *LocalTransferTarget) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
- func (t *LocalTransferTarget) WriteSharedObjectState(ctx context.Context, sharedObjectID string, state *sobject.SOState) error
- type ObjectStoreCheckpoint
- type SOStateRewriter
- type SpaceTransferState
- func (m *SpaceTransferState) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *SpaceTransferState) CloneVT() *SpaceTransferState
- func (this *SpaceTransferState) EqualMessageVT(thatMsg any) bool
- func (this *SpaceTransferState) EqualVT(that *SpaceTransferState) bool
- func (x *SpaceTransferState) GetBlocksCopied() uint64
- func (x *SpaceTransferState) GetBlocksTotal() uint64
- func (x *SpaceTransferState) GetErrorMessage() string
- func (x *SpaceTransferState) GetMeta() *sobject.SharedObjectMeta
- func (x *SpaceTransferState) GetPhase() TransferPhase
- func (x *SpaceTransferState) GetSharedObjectId() string
- func (x *SpaceTransferState) MarshalJSON() ([]byte, error)
- func (x *SpaceTransferState) MarshalProtoJSON(s *json.MarshalState)
- func (x *SpaceTransferState) MarshalProtoText() string
- func (m *SpaceTransferState) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *SpaceTransferState) MarshalToVT(dAtA []byte) (int, error)
- func (m *SpaceTransferState) MarshalVT() (dAtA []byte, err error)
- func (*SpaceTransferState) ProtoMessage()
- func (x *SpaceTransferState) Reset()
- func (m *SpaceTransferState) SizeVT() (n int)
- func (x *SpaceTransferState) String() string
- func (x *SpaceTransferState) UnmarshalJSON(b []byte) error
- func (x *SpaceTransferState) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *SpaceTransferState) UnmarshalVT(dAtA []byte) error
- type SpacewaveTransferSource
- func (s *SpacewaveTransferSource) GetAccount() *provider_spacewave.ProviderAccount
- func (s *SpacewaveTransferSource) GetBlockRefs(ctx context.Context, ref *sobject.SharedObjectRef) ([]*block.BlockRef, error)
- func (s *SpacewaveTransferSource) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
- func (s *SpacewaveTransferSource) GetSharedObjectList(ctx context.Context) (*sobject.SharedObjectList, error)
- func (s *SpacewaveTransferSource) GetSharedObjectState(ctx context.Context, sharedObjectID string) (*sobject.SOState, error)
- type SpacewaveTransferTarget
- func (t *SpacewaveTransferTarget) AddSharedObject(ctx context.Context, ref *sobject.SharedObjectRef, ...) error
- func (t *SpacewaveTransferTarget) GetAccount() *provider_spacewave.ProviderAccount
- func (t *SpacewaveTransferTarget) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
- func (t *SpacewaveTransferTarget) WriteSharedObjectState(ctx context.Context, sharedObjectID string, state *sobject.SOState) error
- type Transfer
- type TransferCheckpoint
- func (m *TransferCheckpoint) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *TransferCheckpoint) CloneVT() *TransferCheckpoint
- func (this *TransferCheckpoint) EqualMessageVT(thatMsg any) bool
- func (this *TransferCheckpoint) EqualVT(that *TransferCheckpoint) bool
- func (x *TransferCheckpoint) GetCurrentSpaceIndex() uint32
- func (x *TransferCheckpoint) GetSpaceIds() []string
- func (x *TransferCheckpoint) GetState() *TransferState
- func (x *TransferCheckpoint) MarshalJSON() ([]byte, error)
- func (x *TransferCheckpoint) MarshalProtoJSON(s *json.MarshalState)
- func (x *TransferCheckpoint) MarshalProtoText() string
- func (m *TransferCheckpoint) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *TransferCheckpoint) MarshalToVT(dAtA []byte) (int, error)
- func (m *TransferCheckpoint) MarshalVT() (dAtA []byte, err error)
- func (*TransferCheckpoint) ProtoMessage()
- func (x *TransferCheckpoint) Reset()
- func (m *TransferCheckpoint) SizeVT() (n int)
- func (x *TransferCheckpoint) String() string
- func (x *TransferCheckpoint) UnmarshalJSON(b []byte) error
- func (x *TransferCheckpoint) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *TransferCheckpoint) UnmarshalVT(dAtA []byte) error
- type TransferMode
- func (x TransferMode) Enum() *TransferMode
- func (x TransferMode) MarshalJSON() ([]byte, error)
- func (x TransferMode) MarshalProtoJSON(s *json.MarshalState)
- func (x TransferMode) MarshalProtoText() string
- func (x TransferMode) MarshalText() ([]byte, error)
- func (x TransferMode) String() string
- func (x *TransferMode) UnmarshalJSON(b []byte) error
- func (x *TransferMode) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *TransferMode) UnmarshalText(b []byte) error
- type TransferPhase
- func (x TransferPhase) Enum() *TransferPhase
- func (x TransferPhase) MarshalJSON() ([]byte, error)
- func (x TransferPhase) MarshalProtoJSON(s *json.MarshalState)
- func (x TransferPhase) MarshalProtoText() string
- func (x TransferPhase) MarshalText() ([]byte, error)
- func (x TransferPhase) String() string
- func (x *TransferPhase) UnmarshalJSON(b []byte) error
- func (x *TransferPhase) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *TransferPhase) UnmarshalText(b []byte) error
- type TransferSource
- type TransferState
- func (m *TransferState) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *TransferState) CloneVT() *TransferState
- func (this *TransferState) EqualMessageVT(thatMsg any) bool
- func (this *TransferState) EqualVT(that *TransferState) bool
- func (x *TransferState) GetErrorMessage() string
- func (x *TransferState) GetMode() TransferMode
- func (x *TransferState) GetPhase() TransferPhase
- func (x *TransferState) GetSourceSessionIndex() uint32
- func (x *TransferState) GetSpaces() []*SpaceTransferState
- func (x *TransferState) GetTargetSessionIndex() uint32
- func (x *TransferState) MarshalJSON() ([]byte, error)
- func (x *TransferState) MarshalProtoJSON(s *json.MarshalState)
- func (x *TransferState) MarshalProtoText() string
- func (m *TransferState) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *TransferState) MarshalToVT(dAtA []byte) (int, error)
- func (m *TransferState) MarshalVT() (dAtA []byte, err error)
- func (*TransferState) ProtoMessage()
- func (x *TransferState) Reset()
- func (m *TransferState) SizeVT() (n int)
- func (x *TransferState) String() string
- func (x *TransferState) UnmarshalJSON(b []byte) error
- func (x *TransferState) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *TransferState) UnmarshalVT(dAtA []byte) error
- type TransferTarget
Constants ¶
This section is empty.
Variables ¶
var ( TransferMode_name = map[int32]string{ 0: "TransferMode_UNKNOWN", 1: "TransferMode_MERGE", 2: "TransferMode_MIGRATE", 3: "TransferMode_MIRROR", } TransferMode_value = map[string]int32{ "TransferMode_UNKNOWN": 0, "TransferMode_MERGE": 1, "TransferMode_MIGRATE": 2, "TransferMode_MIRROR": 3, } )
Enum value maps for TransferMode.
var ( TransferPhase_name = map[int32]string{ 0: "TransferPhase_IDLE", 1: "TransferPhase_SCANNING", 2: "TransferPhase_COPYING_BLOCKS", 3: "TransferPhase_COPYING_SO", 4: "TransferPhase_CLEANUP", 5: "TransferPhase_COMPLETE", 6: "TransferPhase_FAILED", } TransferPhase_value = map[string]int32{ "TransferPhase_IDLE": 0, "TransferPhase_SCANNING": 1, "TransferPhase_COPYING_BLOCKS": 2, "TransferPhase_COPYING_SO": 3, "TransferPhase_CLEANUP": 4, "TransferPhase_COMPLETE": 5, "TransferPhase_FAILED": 6, } )
Enum value maps for TransferPhase.
Functions ¶
func RekeySOState ¶
func RekeySOState( ctx context.Context, le *logrus.Entry, sfs *block_transform.StepFactorySet, sourceState *sobject.SOState, sourcePrivKey crypto.PrivKey, targetPrivKey crypto.PrivKey, sharedObjectID string, ) (*sobject.SOState, error)
RekeySOState re-keys an SO state from the source peer to the target peer. Decrypts the root inner using the source key, re-encrypts with a fresh key for the target peer, and re-signs the root.
Types ¶
type CheckpointStore ¶
type CheckpointStore interface {
// LoadCheckpoint loads the checkpoint from the store.
// Returns nil, nil if no checkpoint exists.
LoadCheckpoint(ctx context.Context) (*TransferCheckpoint, error)
// SaveCheckpoint persists the checkpoint to the store.
SaveCheckpoint(ctx context.Context, cp *TransferCheckpoint) error
// DeleteCheckpoint removes the checkpoint from the store.
DeleteCheckpoint(ctx context.Context) error
}
CheckpointStore provides read/write access to transfer checkpoint state.
type CleanupSource ¶
type CleanupSource interface {
DeleteSharedObject(ctx context.Context, soID string) error
// DeleteVolume deletes the source account's storage volume.
DeleteVolume(ctx context.Context) error
}
CleanupSource handles post-merge cleanup of the source account. This is separate from TransferSource to keep the read interface minimal.
type LocalTransferSource ¶
type LocalTransferSource struct {
// contains filtered or unexported fields
}
LocalTransferSource implements TransferSource for a local provider account.
func NewLocalTransferSource ¶
func NewLocalTransferSource( account *provider_local.ProviderAccount, providerID, accountID string, b bus.Bus, ) *LocalTransferSource
NewLocalTransferSource creates a new LocalTransferSource.
func (*LocalTransferSource) DeleteSharedObject ¶
func (s *LocalTransferSource) DeleteSharedObject(ctx context.Context, soID string) error
DeleteSharedObject deletes a shared object from the source account.
func (*LocalTransferSource) DeleteVolume ¶
func (s *LocalTransferSource) DeleteVolume(ctx context.Context) error
DeleteVolume deletes the source account's storage volume.
func (*LocalTransferSource) GetAccount ¶
func (s *LocalTransferSource) GetAccount() *provider_local.ProviderAccount
GetAccount returns the underlying local provider account.
func (*LocalTransferSource) GetBlockRefs ¶
func (s *LocalTransferSource) GetBlockRefs(ctx context.Context, ref *sobject.SharedObjectRef) ([]*block.BlockRef, error)
GetBlockRefs returns all block refs tracked for a shared object's block store. Uses the GC ref graph to enumerate blocks belonging to the bucket.
func (*LocalTransferSource) GetBlockStore ¶
func (s *LocalTransferSource) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
GetBlockStore returns the block store ops for reading blocks from a shared object.
func (*LocalTransferSource) GetSharedObjectList ¶
func (s *LocalTransferSource) GetSharedObjectList(ctx context.Context) (*sobject.SharedObjectList, error)
GetSharedObjectList returns the list of shared objects on the source account.
func (*LocalTransferSource) GetSharedObjectState ¶
func (s *LocalTransferSource) GetSharedObjectState(ctx context.Context, sharedObjectID string) (*sobject.SOState, error)
GetSharedObjectState reads the SO state for a shared object from the object store.
type LocalTransferTarget ¶
type LocalTransferTarget struct {
// contains filtered or unexported fields
}
LocalTransferTarget implements TransferTarget for a local provider account.
func NewLocalTransferTarget ¶
func NewLocalTransferTarget( account *provider_local.ProviderAccount, providerID, accountID string, b bus.Bus, ) *LocalTransferTarget
NewLocalTransferTarget creates a new LocalTransferTarget.
func (*LocalTransferTarget) AddSharedObject ¶
func (t *LocalTransferTarget) AddSharedObject(ctx context.Context, ref *sobject.SharedObjectRef, meta *sobject.SharedObjectMeta) error
AddSharedObject adds a shared object entry to the target's SO list.
func (*LocalTransferTarget) GetAccount ¶
func (t *LocalTransferTarget) GetAccount() *provider_local.ProviderAccount
GetAccount returns the underlying local provider account.
func (*LocalTransferTarget) GetBlockStore ¶
func (t *LocalTransferTarget) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
GetBlockStore returns the block store ops for writing blocks to the target. Creates the block store bucket if it does not exist.
func (*LocalTransferTarget) WriteSharedObjectState ¶
func (t *LocalTransferTarget) WriteSharedObjectState(ctx context.Context, sharedObjectID string, state *sobject.SOState) error
WriteSharedObjectState writes the SO state for a shared object to the target's object store.
type ObjectStoreCheckpoint ¶
type ObjectStoreCheckpoint struct {
// contains filtered or unexported fields
}
ObjectStoreCheckpoint implements CheckpointStore using an ObjectStore.
func NewObjectStoreCheckpoint ¶
func NewObjectStoreCheckpoint(store object.ObjectStore) *ObjectStoreCheckpoint
NewObjectStoreCheckpoint creates a new ObjectStoreCheckpoint with a direct store handle.
func NewObjectStoreCheckpointLazy ¶
func NewObjectStoreCheckpointLazy(b bus.Bus, objectStoreID, volumeID string) *ObjectStoreCheckpoint
NewObjectStoreCheckpointLazy creates a new ObjectStoreCheckpoint that builds the object store handle on first use via the bus.
func (*ObjectStoreCheckpoint) DeleteCheckpoint ¶
func (c *ObjectStoreCheckpoint) DeleteCheckpoint(ctx context.Context) error
DeleteCheckpoint removes the checkpoint from the object store.
func (*ObjectStoreCheckpoint) LoadCheckpoint ¶
func (c *ObjectStoreCheckpoint) LoadCheckpoint(ctx context.Context) (*TransferCheckpoint, error)
LoadCheckpoint loads the checkpoint from the object store.
func (*ObjectStoreCheckpoint) SaveCheckpoint ¶
func (c *ObjectStoreCheckpoint) SaveCheckpoint(ctx context.Context, cp *TransferCheckpoint) error
SaveCheckpoint persists the checkpoint to the object store.
type SOStateRewriter ¶
type SOStateRewriter func(ctx context.Context, soID string, state *sobject.SOState) (*sobject.SOState, error)
SOStateRewriter rewrites an SO state during transfer. Used to re-key state from source peer to target peer.
type SpaceTransferState ¶
type SpaceTransferState struct {
SharedObjectId string `protobuf:"bytes,1,opt,name=shared_object_id,json=sharedObjectId,proto3" json:"sharedObjectId,omitempty"`
// Phase is the current transfer phase for this space.
Phase TransferPhase `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"`
// BlocksCopied is the number of blocks copied so far.
BlocksCopied uint64 `protobuf:"varint,3,opt,name=blocks_copied,json=blocksCopied,proto3" json:"blocksCopied,omitempty"`
// BlocksTotal is the total number of blocks to copy (0 if not yet scanned).
BlocksTotal uint64 `protobuf:"varint,4,opt,name=blocks_total,json=blocksTotal,proto3" json:"blocksTotal,omitempty"`
// ErrorMessage contains the error if phase is FAILED.
ErrorMessage string `protobuf:"bytes,5,opt,name=error_message,json=errorMessage,proto3" json:"errorMessage,omitempty"`
// Meta is the shared object metadata from the source.
Meta *sobject.SharedObjectMeta `protobuf:"bytes,6,opt,name=meta,proto3" json:"meta,omitempty"`
// contains filtered or unexported fields
}
SpaceTransferState tracks the transfer progress for a single shared object.
func (*SpaceTransferState) CloneMessageVT ¶
func (m *SpaceTransferState) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*SpaceTransferState) CloneVT ¶
func (m *SpaceTransferState) CloneVT() *SpaceTransferState
func (*SpaceTransferState) EqualMessageVT ¶
func (this *SpaceTransferState) EqualMessageVT(thatMsg any) bool
func (*SpaceTransferState) EqualVT ¶
func (this *SpaceTransferState) EqualVT(that *SpaceTransferState) bool
func (*SpaceTransferState) GetBlocksCopied ¶
func (x *SpaceTransferState) GetBlocksCopied() uint64
func (*SpaceTransferState) GetBlocksTotal ¶
func (x *SpaceTransferState) GetBlocksTotal() uint64
func (*SpaceTransferState) GetErrorMessage ¶
func (x *SpaceTransferState) GetErrorMessage() string
func (*SpaceTransferState) GetMeta ¶
func (x *SpaceTransferState) GetMeta() *sobject.SharedObjectMeta
func (*SpaceTransferState) GetPhase ¶
func (x *SpaceTransferState) GetPhase() TransferPhase
func (*SpaceTransferState) GetSharedObjectId ¶
func (x *SpaceTransferState) GetSharedObjectId() string
func (*SpaceTransferState) MarshalJSON ¶
func (x *SpaceTransferState) MarshalJSON() ([]byte, error)
MarshalJSON marshals the SpaceTransferState to JSON.
func (*SpaceTransferState) MarshalProtoJSON ¶
func (x *SpaceTransferState) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the SpaceTransferState message to JSON.
func (*SpaceTransferState) MarshalProtoText ¶
func (x *SpaceTransferState) MarshalProtoText() string
func (*SpaceTransferState) MarshalToSizedBufferVT ¶
func (m *SpaceTransferState) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*SpaceTransferState) MarshalToVT ¶
func (m *SpaceTransferState) MarshalToVT(dAtA []byte) (int, error)
func (*SpaceTransferState) MarshalVT ¶
func (m *SpaceTransferState) MarshalVT() (dAtA []byte, err error)
func (*SpaceTransferState) ProtoMessage ¶
func (*SpaceTransferState) ProtoMessage()
func (*SpaceTransferState) Reset ¶
func (x *SpaceTransferState) Reset()
func (*SpaceTransferState) SizeVT ¶
func (m *SpaceTransferState) SizeVT() (n int)
func (*SpaceTransferState) String ¶
func (x *SpaceTransferState) String() string
func (*SpaceTransferState) UnmarshalJSON ¶
func (x *SpaceTransferState) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the SpaceTransferState from JSON.
func (*SpaceTransferState) UnmarshalProtoJSON ¶
func (x *SpaceTransferState) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the SpaceTransferState message from JSON.
func (*SpaceTransferState) UnmarshalVT ¶
func (m *SpaceTransferState) UnmarshalVT(dAtA []byte) error
type SpacewaveTransferSource ¶
type SpacewaveTransferSource struct {
// contains filtered or unexported fields
}
SpacewaveTransferSource implements TransferSource for a spacewave cloud account.
func NewSpacewaveTransferSource ¶
func NewSpacewaveTransferSource( account *provider_spacewave.ProviderAccount, providerID, accountID string, ) *SpacewaveTransferSource
NewSpacewaveTransferSource creates a new SpacewaveTransferSource.
func (*SpacewaveTransferSource) GetAccount ¶
func (s *SpacewaveTransferSource) GetAccount() *provider_spacewave.ProviderAccount
GetAccount returns the underlying spacewave provider account.
func (*SpacewaveTransferSource) GetBlockRefs ¶
func (s *SpacewaveTransferSource) GetBlockRefs(ctx context.Context, ref *sobject.SharedObjectRef) ([]*block.BlockRef, error)
GetBlockRefs returns all block refs tracked for a shared object's block store. Enumerates blocks by pulling the packfile manifest from the cloud and scanning each packfile's index entries.
func (*SpacewaveTransferSource) GetBlockStore ¶
func (s *SpacewaveTransferSource) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
GetBlockStore returns the block store ops for reading blocks from a shared object.
func (*SpacewaveTransferSource) GetSharedObjectList ¶
func (s *SpacewaveTransferSource) GetSharedObjectList(ctx context.Context) (*sobject.SharedObjectList, error)
GetSharedObjectList returns the list of shared objects from the cloud.
func (*SpacewaveTransferSource) GetSharedObjectState ¶
func (s *SpacewaveTransferSource) GetSharedObjectState(ctx context.Context, sharedObjectID string) (*sobject.SOState, error)
GetSharedObjectState reads the SO state for a shared object from the cloud.
type SpacewaveTransferTarget ¶
type SpacewaveTransferTarget struct {
// contains filtered or unexported fields
}
SpacewaveTransferTarget implements TransferTarget for a spacewave cloud account.
func NewSpacewaveTransferTarget ¶
func NewSpacewaveTransferTarget( account *provider_spacewave.ProviderAccount, providerID, accountID string, ) *SpacewaveTransferTarget
NewSpacewaveTransferTarget creates a new SpacewaveTransferTarget.
func (*SpacewaveTransferTarget) AddSharedObject ¶
func (t *SpacewaveTransferTarget) AddSharedObject(ctx context.Context, ref *sobject.SharedObjectRef, meta *sobject.SharedObjectMeta) error
AddSharedObject creates a shared object on the cloud. Only creates the container; state is written separately via WriteSharedObjectState.
func (*SpacewaveTransferTarget) GetAccount ¶
func (t *SpacewaveTransferTarget) GetAccount() *provider_spacewave.ProviderAccount
GetAccount returns the underlying spacewave provider account.
func (*SpacewaveTransferTarget) GetBlockStore ¶
func (t *SpacewaveTransferTarget) GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
GetBlockStore returns the block store ops for writing blocks to the target. Creates the block store if it does not exist.
func (*SpacewaveTransferTarget) WriteSharedObjectState ¶
func (t *SpacewaveTransferTarget) WriteSharedObjectState(ctx context.Context, sharedObjectID string, state *sobject.SOState) error
WriteSharedObjectState writes the SO state to the cloud.
type Transfer ¶
type Transfer struct {
// contains filtered or unexported fields
}
Transfer orchestrates a transfer operation between source and target accounts.
func NewTransfer ¶
func NewTransfer( le *logrus.Entry, mode TransferMode, source TransferSource, target TransferTarget, sourceSessionIdx, targetSessionIdx uint32, cleanup CleanupSource, checkpoint CheckpointStore, stateRewriter SOStateRewriter, filterSpaceIDs []string, ) *Transfer
NewTransfer creates a new Transfer. cleanup may be nil to skip source cleanup after merge. checkpoint may be nil to disable checkpoint persistence. stateRewriter may be nil to copy SO state verbatim (only safe when source and target share the same peer key). filterSpaceIDs, if non-empty, restricts the transfer to only those space IDs.
func (*Transfer) Execute ¶
Execute runs the transfer operation. If a checkpoint exists, resumes from the last saved position.
func (*Transfer) GetState ¶
func (t *Transfer) GetState() *TransferState
GetState returns a snapshot of the current transfer state.
func (*Transfer) WatchState ¶ added in v0.51.7
func (t *Transfer) WatchState() (*TransferState, <-chan struct{})
WatchState returns a state snapshot and wait channel from the same broadcast lock.
type TransferCheckpoint ¶
type TransferCheckpoint struct {
// State is the current transfer state snapshot.
State *TransferState `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"`
// SpaceIds is the ordered list of space IDs to transfer.
SpaceIds []string `protobuf:"bytes,2,rep,name=space_ids,json=spaceIds,proto3" json:"spaceIds,omitempty"`
// CurrentSpaceIndex is the index into space_ids currently being processed.
CurrentSpaceIndex uint32 `protobuf:"varint,3,opt,name=current_space_index,json=currentSpaceIndex,proto3" json:"currentSpaceIndex,omitempty"`
// contains filtered or unexported fields
}
TransferCheckpoint persists transfer progress for resumability.
func (*TransferCheckpoint) CloneMessageVT ¶
func (m *TransferCheckpoint) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*TransferCheckpoint) CloneVT ¶
func (m *TransferCheckpoint) CloneVT() *TransferCheckpoint
func (*TransferCheckpoint) EqualMessageVT ¶
func (this *TransferCheckpoint) EqualMessageVT(thatMsg any) bool
func (*TransferCheckpoint) EqualVT ¶
func (this *TransferCheckpoint) EqualVT(that *TransferCheckpoint) bool
func (*TransferCheckpoint) GetCurrentSpaceIndex ¶
func (x *TransferCheckpoint) GetCurrentSpaceIndex() uint32
func (*TransferCheckpoint) GetSpaceIds ¶
func (x *TransferCheckpoint) GetSpaceIds() []string
func (*TransferCheckpoint) GetState ¶
func (x *TransferCheckpoint) GetState() *TransferState
func (*TransferCheckpoint) MarshalJSON ¶
func (x *TransferCheckpoint) MarshalJSON() ([]byte, error)
MarshalJSON marshals the TransferCheckpoint to JSON.
func (*TransferCheckpoint) MarshalProtoJSON ¶
func (x *TransferCheckpoint) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the TransferCheckpoint message to JSON.
func (*TransferCheckpoint) MarshalProtoText ¶
func (x *TransferCheckpoint) MarshalProtoText() string
func (*TransferCheckpoint) MarshalToSizedBufferVT ¶
func (m *TransferCheckpoint) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*TransferCheckpoint) MarshalToVT ¶
func (m *TransferCheckpoint) MarshalToVT(dAtA []byte) (int, error)
func (*TransferCheckpoint) MarshalVT ¶
func (m *TransferCheckpoint) MarshalVT() (dAtA []byte, err error)
func (*TransferCheckpoint) ProtoMessage ¶
func (*TransferCheckpoint) ProtoMessage()
func (*TransferCheckpoint) Reset ¶
func (x *TransferCheckpoint) Reset()
func (*TransferCheckpoint) SizeVT ¶
func (m *TransferCheckpoint) SizeVT() (n int)
func (*TransferCheckpoint) String ¶
func (x *TransferCheckpoint) String() string
func (*TransferCheckpoint) UnmarshalJSON ¶
func (x *TransferCheckpoint) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the TransferCheckpoint from JSON.
func (*TransferCheckpoint) UnmarshalProtoJSON ¶
func (x *TransferCheckpoint) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the TransferCheckpoint message from JSON.
func (*TransferCheckpoint) UnmarshalVT ¶
func (m *TransferCheckpoint) UnmarshalVT(dAtA []byte) error
type TransferMode ¶
type TransferMode int32
TransferMode defines the type of transfer operation.
const ( // TransferMode_UNKNOWN is the zero value. TransferMode_TransferMode_UNKNOWN TransferMode = 0 // TransferMode_MERGE moves all spaces from source to target and deletes source. TransferMode_TransferMode_MERGE TransferMode = 1 // TransferMode_MIGRATE moves all spaces between providers (cloud/local). TransferMode_TransferMode_MIGRATE TransferMode = 2 // TransferMode_MIRROR copies spaces from source to target without deleting source. TransferMode_TransferMode_MIRROR TransferMode = 3 )
func (TransferMode) Enum ¶
func (x TransferMode) Enum() *TransferMode
func (TransferMode) MarshalJSON ¶
func (x TransferMode) MarshalJSON() ([]byte, error)
MarshalJSON marshals the TransferMode to JSON.
func (TransferMode) MarshalProtoJSON ¶
func (x TransferMode) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the TransferMode to JSON.
func (TransferMode) MarshalProtoText ¶
func (x TransferMode) MarshalProtoText() string
func (TransferMode) MarshalText ¶
func (x TransferMode) MarshalText() ([]byte, error)
MarshalText marshals the TransferMode to text.
func (TransferMode) String ¶
func (x TransferMode) String() string
func (*TransferMode) UnmarshalJSON ¶
func (x *TransferMode) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the TransferMode from JSON.
func (*TransferMode) UnmarshalProtoJSON ¶
func (x *TransferMode) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the TransferMode from JSON.
func (*TransferMode) UnmarshalText ¶
func (x *TransferMode) UnmarshalText(b []byte) error
UnmarshalText unmarshals the TransferMode from text.
type TransferPhase ¶
type TransferPhase int32
TransferPhase defines the current phase of a transfer operation.
const ( // TransferPhase_IDLE is the initial state before transfer starts. TransferPhase_TransferPhase_IDLE TransferPhase = 0 // TransferPhase_SCANNING enumerates source shared objects. TransferPhase_TransferPhase_SCANNING TransferPhase = 1 // TransferPhase_COPYING_BLOCKS copies block data from source to target. TransferPhase_TransferPhase_COPYING_BLOCKS TransferPhase = 2 // TransferPhase_COPYING_SO copies shared object state from source to target. TransferPhase_TransferPhase_COPYING_SO TransferPhase = 3 // TransferPhase_CLEANUP removes source data after successful transfer. TransferPhase_TransferPhase_CLEANUP TransferPhase = 4 // TransferPhase_COMPLETE indicates the transfer finished successfully. TransferPhase_TransferPhase_COMPLETE TransferPhase = 5 // TransferPhase_FAILED indicates the transfer encountered an unrecoverable error. TransferPhase_TransferPhase_FAILED TransferPhase = 6 )
func (TransferPhase) Enum ¶
func (x TransferPhase) Enum() *TransferPhase
func (TransferPhase) MarshalJSON ¶
func (x TransferPhase) MarshalJSON() ([]byte, error)
MarshalJSON marshals the TransferPhase to JSON.
func (TransferPhase) MarshalProtoJSON ¶
func (x TransferPhase) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the TransferPhase to JSON.
func (TransferPhase) MarshalProtoText ¶
func (x TransferPhase) MarshalProtoText() string
func (TransferPhase) MarshalText ¶
func (x TransferPhase) MarshalText() ([]byte, error)
MarshalText marshals the TransferPhase to text.
func (TransferPhase) String ¶
func (x TransferPhase) String() string
func (*TransferPhase) UnmarshalJSON ¶
func (x *TransferPhase) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the TransferPhase from JSON.
func (*TransferPhase) UnmarshalProtoJSON ¶
func (x *TransferPhase) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the TransferPhase from JSON.
func (*TransferPhase) UnmarshalText ¶
func (x *TransferPhase) UnmarshalText(b []byte) error
UnmarshalText unmarshals the TransferPhase from text.
type TransferSource ¶
type TransferSource interface {
GetSharedObjectList(ctx context.Context) (*sobject.SharedObjectList, error)
GetSharedObjectState(ctx context.Context, sharedObjectID string) (*sobject.SOState, error)
// GetBlockStore returns the block store ops for a shared object's block store.
GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
// GetBlockRefs returns all block refs tracked for a shared object's block store.
// Uses the GC ref graph to enumerate blocks belonging to the bucket.
GetBlockRefs(ctx context.Context, ref *sobject.SharedObjectRef) ([]*block.BlockRef, error)
}
TransferSource provides read access to a provider account for transfer.
type TransferState ¶
type TransferState struct {
// Mode is the transfer mode (merge, migrate, mirror).
Mode TransferMode `protobuf:"varint,1,opt,name=mode,proto3" json:"mode,omitempty"`
// Phase is the overall transfer phase.
Phase TransferPhase `protobuf:"varint,2,opt,name=phase,proto3" json:"phase,omitempty"`
// SourceSessionIndex is the source session index.
SourceSessionIndex uint32 `protobuf:"varint,3,opt,name=source_session_index,json=sourceSessionIndex,proto3" json:"sourceSessionIndex,omitempty"`
// TargetSessionIndex is the target session index.
TargetSessionIndex uint32 `protobuf:"varint,4,opt,name=target_session_index,json=targetSessionIndex,proto3" json:"targetSessionIndex,omitempty"`
// Spaces is the per-space transfer progress.
Spaces []*SpaceTransferState `protobuf:"bytes,5,rep,name=spaces,proto3" json:"spaces,omitempty"`
// ErrorMessage contains the error if phase is FAILED.
ErrorMessage string `protobuf:"bytes,6,opt,name=error_message,json=errorMessage,proto3" json:"errorMessage,omitempty"`
// contains filtered or unexported fields
}
TransferState tracks the overall transfer operation state.
func (*TransferState) CloneMessageVT ¶
func (m *TransferState) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*TransferState) CloneVT ¶
func (m *TransferState) CloneVT() *TransferState
func (*TransferState) EqualMessageVT ¶
func (this *TransferState) EqualMessageVT(thatMsg any) bool
func (*TransferState) EqualVT ¶
func (this *TransferState) EqualVT(that *TransferState) bool
func (*TransferState) GetErrorMessage ¶
func (x *TransferState) GetErrorMessage() string
func (*TransferState) GetMode ¶
func (x *TransferState) GetMode() TransferMode
func (*TransferState) GetPhase ¶
func (x *TransferState) GetPhase() TransferPhase
func (*TransferState) GetSourceSessionIndex ¶
func (x *TransferState) GetSourceSessionIndex() uint32
func (*TransferState) GetSpaces ¶
func (x *TransferState) GetSpaces() []*SpaceTransferState
func (*TransferState) GetTargetSessionIndex ¶
func (x *TransferState) GetTargetSessionIndex() uint32
func (*TransferState) MarshalJSON ¶
func (x *TransferState) MarshalJSON() ([]byte, error)
MarshalJSON marshals the TransferState to JSON.
func (*TransferState) MarshalProtoJSON ¶
func (x *TransferState) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the TransferState message to JSON.
func (*TransferState) MarshalProtoText ¶
func (x *TransferState) MarshalProtoText() string
func (*TransferState) MarshalToSizedBufferVT ¶
func (m *TransferState) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*TransferState) MarshalToVT ¶
func (m *TransferState) MarshalToVT(dAtA []byte) (int, error)
func (*TransferState) MarshalVT ¶
func (m *TransferState) MarshalVT() (dAtA []byte, err error)
func (*TransferState) ProtoMessage ¶
func (*TransferState) ProtoMessage()
func (*TransferState) Reset ¶
func (x *TransferState) Reset()
func (*TransferState) SizeVT ¶
func (m *TransferState) SizeVT() (n int)
func (*TransferState) String ¶
func (x *TransferState) String() string
func (*TransferState) UnmarshalJSON ¶
func (x *TransferState) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the TransferState from JSON.
func (*TransferState) UnmarshalProtoJSON ¶
func (x *TransferState) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the TransferState message from JSON.
func (*TransferState) UnmarshalVT ¶
func (m *TransferState) UnmarshalVT(dAtA []byte) error
type TransferTarget ¶
type TransferTarget interface {
// GetBlockStore returns the block store ops for a shared object's block store.
// Creates the block store if it does not exist.
GetBlockStore(ctx context.Context, ref *sobject.SharedObjectRef) (block.StoreOps, func(), error)
// The ref should already have the target's provider resource ref.
AddSharedObject(ctx context.Context, ref *sobject.SharedObjectRef, meta *sobject.SharedObjectMeta) error
WriteSharedObjectState(ctx context.Context, sharedObjectID string, state *sobject.SOState) error
}
TransferTarget provides write access to a provider account for transfer.