Documentation
¶
Index ¶
- type DiskController
- func NewDiskController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, ...) *DiskController
- func NewDiskControllerWithClients(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, ...) *DiskController
- func NewDiskControllerWithMountPath(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, ...) *DiskController
- func (d *DiskController) Close() error
- func (d *DiskController) Create(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
- func (d *DiskController) Delete(ctx context.Context, id entity.Id) error
- func (d *DiskController) Init(ctx context.Context) error
- func (d *DiskController) Start(ctx context.Context) error
- func (d *DiskController) Update(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
- type DiskLeaseController
- func NewDiskLeaseController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, ...) *DiskLeaseController
- func NewDiskLeaseControllerWithClients(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, ...) *DiskLeaseController
- func NewDiskLeaseControllerWithMountPath(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, ...) *DiskLeaseController
- func (d *DiskLeaseController) CleanupOldReleasedLeases(ctx context.Context) error
- func (d *DiskLeaseController) Create(ctx context.Context, lease *storage_v1alpha.DiskLease, meta *entity.Meta) error
- func (d *DiskLeaseController) Delete(ctx context.Context, id entity.Id) error
- func (d *DiskLeaseController) GetTestDisk(diskId entity.Id) *storage_v1alpha.Disk
- func (d *DiskLeaseController) Init(ctx context.Context) error
- func (d *DiskLeaseController) SetTestDisk(disk *storage_v1alpha.Disk)
- func (d *DiskLeaseController) Update(ctx context.Context, lease *storage_v1alpha.DiskLease, meta *entity.Meta) error
- type DiskWatchController
- func (d *DiskWatchController) Create(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
- func (d *DiskWatchController) Delete(ctx context.Context, id entity.Id) error
- func (d *DiskWatchController) Init(ctx context.Context) error
- func (d *DiskWatchController) Update(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
- type LsvdClient
- type LsvdClientOption
- type VolumeInfo
- type VolumeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiskController ¶
type DiskController struct {
Log *slog.Logger
EAC *entityserver_v1alpha.EntityAccessClient
// contains filtered or unexported fields
}
DiskController manages disk entities and their lifecycle
func NewDiskController ¶
func NewDiskController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, lsvdClient LsvdClient) *DiskController
NewDiskController creates a new disk controller
func NewDiskControllerWithClients ¶
func NewDiskControllerWithClients(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, defaultClient, localReplicaClient, remoteOnlyClient LsvdClient) *DiskController
NewDiskControllerWithClients creates a new disk controller with separate clients for local and remote-only modes
func NewDiskControllerWithMountPath ¶
func NewDiskControllerWithMountPath(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, lsvdClient LsvdClient, mountPath string) *DiskController
NewDiskControllerWithMountPath creates a new disk controller with custom mount path
func (*DiskController) Close ¶
func (d *DiskController) Close() error
Close gracefully shuts down the disk controller
func (*DiskController) Create ¶
func (d *DiskController) Create(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
Create handles creation of a new disk entity
func (*DiskController) Init ¶
func (d *DiskController) Init(ctx context.Context) error
Init initializes the disk controller
func (*DiskController) Start ¶
func (d *DiskController) Start(ctx context.Context) error
Start starts the disk controller
func (*DiskController) Update ¶
func (d *DiskController) Update(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
Update handles updates to an existing disk entity
type DiskLeaseController ¶
type DiskLeaseController struct {
Log *slog.Logger
EAC *entityserver_v1alpha.EntityAccessClient
// contains filtered or unexported fields
}
DiskLeaseController manages disk lease entities and exclusive access
Operational flow: 1. Disks are created in SegmentAccess when provisioned 2. When a lease is bound, the disk is initialized (lsvd.NewDisk), attached to NBD, formatted, and mounted 3. Leases control exclusive access to these mounted volumes 4. The lease.Mount.Path specifies where to mount within the sandbox's filesystem
func NewDiskLeaseController ¶
func NewDiskLeaseController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, lsvdClient LsvdClient) *DiskLeaseController
NewDiskLeaseController creates a new disk lease controller
func NewDiskLeaseControllerWithClients ¶
func NewDiskLeaseControllerWithClients(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, defaultClient, localReplicaClient, remoteOnlyClient LsvdClient) *DiskLeaseController
NewDiskLeaseControllerWithClients creates a new disk lease controller with separate clients for local and remote-only modes
func NewDiskLeaseControllerWithMountPath ¶
func NewDiskLeaseControllerWithMountPath(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, lsvdClient LsvdClient, mountPath string) *DiskLeaseController
NewDiskLeaseControllerWithMountPath creates a new disk lease controller with custom mount path
func (*DiskLeaseController) CleanupOldReleasedLeases ¶
func (d *DiskLeaseController) CleanupOldReleasedLeases(ctx context.Context) error
CleanupOldReleasedLeases deletes released leases that haven't been updated for over 1 hour
func (*DiskLeaseController) Create ¶
func (d *DiskLeaseController) Create(ctx context.Context, lease *storage_v1alpha.DiskLease, meta *entity.Meta) error
Create handles creation of a new disk lease entity
func (*DiskLeaseController) GetTestDisk ¶
func (d *DiskLeaseController) GetTestDisk(diskId entity.Id) *storage_v1alpha.Disk
GetTestDisk is a test helper to retrieve disk information from test cache
func (*DiskLeaseController) Init ¶
func (d *DiskLeaseController) Init(ctx context.Context) error
Init initializes the disk lease controller
func (*DiskLeaseController) SetTestDisk ¶
func (d *DiskLeaseController) SetTestDisk(disk *storage_v1alpha.Disk)
SetTestDisk is a test helper to set disk information when EAC is not available
func (*DiskLeaseController) Update ¶
func (d *DiskLeaseController) Update(ctx context.Context, lease *storage_v1alpha.DiskLease, meta *entity.Meta) error
Update handles updates to an existing disk lease entity
type DiskWatchController ¶
type DiskWatchController struct {
Log *slog.Logger
EAC *entityserver_v1alpha.EntityAccessClient
// Reference to the disk lease controller to enqueue lease reconciliations
LeaseController *controller.ReconcileController
}
DiskWatchController watches for disk state changes and triggers reconciliation of dependent leases
func NewDiskWatchController ¶
func NewDiskWatchController(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient, leaseController *controller.ReconcileController) *DiskWatchController
NewDiskWatchController creates a new disk watch controller
func (*DiskWatchController) Create ¶
func (d *DiskWatchController) Create(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
Create handles creation of a disk entity (triggers lease reconciliation)
func (*DiskWatchController) Init ¶
func (d *DiskWatchController) Init(ctx context.Context) error
Init initializes the disk watch controller
func (*DiskWatchController) Update ¶
func (d *DiskWatchController) Update(ctx context.Context, disk *storage_v1alpha.Disk, meta *entity.Meta) error
Update handles updates to a disk entity (triggers lease reconciliation)
type LsvdClient ¶
type LsvdClient interface {
// CreateVolume creates a new LSVD volume (backwards compatibility - calls both CreateVolumeInSegmentAccess and InitializeDisk)
CreateVolume(ctx context.Context, volumeId string, sizeGb int64, filesystem string) error
// CreateVolumeInSegmentAccess creates a volume only in SegmentAccess (no disk initialization)
CreateVolumeInSegmentAccess(ctx context.Context, volumeId string, sizeGb int64, filesystem string) error
// InitializeDisk initializes lsvd.NewDisk for an existing volume in SegmentAccess
InitializeDisk(ctx context.Context, volumeId string, filesystem string) error
// UnprovisionVolume unprovisions an LSVD volume (does not delete data)
UnprovisionVolume(ctx context.Context, volumeId string) error
// MountVolume mounts an LSVD volume to a mount path (requires InitializeDisk to be called first)
MountVolume(ctx context.Context, volumeId string, mountPath string, readOnly bool) error
// UnmountVolume unmounts an LSVD volume
UnmountVolume(ctx context.Context, volumeId string) error
// IsVolumeMounted checks if a volume is currently mounted
IsVolumeMounted(ctx context.Context, volumeId string) (bool, error)
// GetVolumeInfo returns information about a volume
GetVolumeInfo(ctx context.Context, volumeId string) (*VolumeInfo, error)
// ListVolumes lists all volumes
ListVolumes(ctx context.Context) ([]string, error)
}
LsvdClient provides an interface for LSVD volume operations
func NewLsvdClient ¶
func NewLsvdClient(log *slog.Logger, dataPath string, opts ...LsvdClientOption) LsvdClient
NewLsvdClient creates a new LSVD client
func NewLsvdClientWithReplica ¶
func NewLsvdClientWithReplica(log *slog.Logger, dataPath string, authClient *cloudauth.AuthClient, cloudURL string) LsvdClient
NewLsvdClientWithReplica creates a new LSVD client with DiskAPI replication Deprecated: Use NewLsvdClient with WithReplica option instead
type LsvdClientOption ¶
type LsvdClientOption func(*lsvdClientImpl)
LsvdClientOption is a functional option for configuring LsvdClient
func WithRemoteOnly ¶
func WithRemoteOnly(authClient *cloudauth.AuthClient, cloudURL string) LsvdClientOption
WithRemoteOnly configures the client to use only remote storage (no local replica)
func WithReplica ¶
func WithReplica(authClient *cloudauth.AuthClient, cloudURL string) LsvdClientOption
WithReplica enables replication to a remote DiskAPI endpoint
type VolumeInfo ¶
type VolumeInfo struct {
ID string
Name string
SizeBytes int64
Filesystem string
MountPath string
UUID string
Status VolumeStatus
}
VolumeInfo contains information about an LSVD volume
type VolumeStatus ¶
type VolumeStatus string
VolumeStatus represents the state of a volume
const ( // VolumeStatusNotFound indicates the volume doesn't exist VolumeStatusNotFound VolumeStatus = "not_found" // VolumeStatusOnDisk indicates the volume exists on disk but is not loaded in memory VolumeStatusOnDisk VolumeStatus = "on_disk" // VolumeStatusLoaded indicates the volume is loaded in memory but not mounted VolumeStatusLoaded VolumeStatus = "loaded" // VolumeStatusMounted indicates the volume is mounted and accessible VolumeStatusMounted VolumeStatus = "mounted" )