domain

package
v0.0.0-...-1e10b44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ERROR_CODE_INTERNAL (catch‑all when we can’t classify better)
	ErrInternal = errors.New("internal error")

	// ERROR_CODE_CANCELED
	ErrCanceled = errors.New("canceled")

	// ERROR_CODE_DEADLINE_EXCEEDED
	ErrDeadlineExceeded = errors.New("deadline exceeded")

	// ERROR_CODE_CHUNK_NOT_FOUND
	ErrChunkNotFound = errors.New("not found")

	// ERROR_CODE_CHUNK_ALREADY_EXISTS
	ErrChunkAlreadyExists = errors.New("already exists")

	// ERROR_CODE_CHUNK_CORRUPTED
	ErrChunkCorrupted = errors.New("chunk corrupted")

	// ERROR_CODE_CHUNK_WRITE_INCOMPLETE
	ErrChunkWriteIncomplete = errors.New("incomplete write")

	// ERROR_CODE_INVALID_OPERATION (e.g. deleted/pending when we expect ready)
	ErrChunkInvalidOperation = errors.New("invalid operation")

	// ERROR_CODE_CHUNK_INVALID_VERSION (for optimistic locking / append out-of-sync)
	ErrChunkInvalidVersion = errors.New("invalid version")

	// ERROR_CODE_CHUNK_INVALID_RANGE (bad offsets/lengths, negative sizes, etc.)
	ErrChunkInvalidRange = errors.New("invalid range")

	// ERROR_CODE_CHUNK_INVALID_ID (bad chunk ID format, etc.)
	ErrChunkInvalidID = errors.New("invalid id")

	// ERROR_CODE_CLOCK_NOT_MONOTONIC (clock moved backwards)
	ErrClockNotMonotonic = errors.New("non-monotonic clock")

	// ERROR_CODE_VOLUME_DEGRADED
	ErrVolumeDegraded = errors.New("volume degraded")

	// ERROR_CODE_VOLUME_FAILED
	ErrVolumeFailed = errors.New("volume failed")

	ErrNodeClaimNotFound = errors.New("node claim not found")
	ErrNodeClaimInvalid  = errors.New("node claim invalid")
	ErrNodeClaimConflict = errors.New("node claim conflict")

	ErrNodeSeedNotFound = errors.New("node seed not found")

	ErrVolumeUnavailable = errors.New("volume unavailable")

	ErrFileStoreVolumeAlreadyInitialized = errors.New("file store volume already initialized")
	ErrFileStoreVolumeNotInitialized     = errors.New("file store volume not initialized")
	ErrFileStoreVolumeCorrupt            = errors.New("file store volume corrupt")
	ErrFileStoreVolumeVersionMismatch    = errors.New("file store volume version mismatch")

	ErrNodePeerNotFound = errors.New("node peer not found")
)

Functions

func LinearProbe

func LinearProbe(total, start, attempt int) int

Linear implements a linear probing strategy. It calculates the next index to probe based on the total number of items, the starting index, and the current attempt number.

func QuadraticProbe

func QuadraticProbe(total, start, attempt int) int

Quadratic calculates the next index to probe using quadratic probing. It takes the total number of slots, the starting index, and the current attempt number. It returns the next index to probe, or -1 if total is less than or equal to 0.

func RandomProbe

func RandomProbe(total, _start, _attempt int) int

Random selects a random index from the available total number of targets. It ignores the start and attempt parameters. If total is less than or equal to zero, it returns -1.

func RandomProbeWithRand

func RandomProbeWithRand(rng *rand.Rand) func(total, start, attempt int) int

ProbeWithRand returns a probe function that selects a random index from the available total number of targets. If rng is nil, a new random number generator seeded with the current time is used.

Types

type AppendChunkOptions

type AppendChunkOptions struct {
	MinTailSlackLength int64
}

type ChooseVolumeOptions

type ChooseVolumeOptions struct {
	MaxAttempts int
	Filter      func(id VolumeID) bool
	Probe       func(total, start, attempt int) int
}

type Chunk

type Chunk interface {
	ID() ChunkID
	WriterKey() []byte
	CreatedAt() time.Time
	ExpiresAt() (time.Time, bool)
	UpdatedAt() (time.Time, bool)
	Size() (int64, bool)
	Version() (uint64, bool)
	DeletedAt() (time.Time, bool)
	State() ChunkState
	// contains filtered or unexported methods
}

type ChunkHandle

type ChunkHandle interface {
	io.Closer

	OpenReader(ctx context.Context) (ChunkReader, error)
	OpenRangeReader(ctx context.Context, offset, length int64) (ChunkRangeReader, error)
	OpenReaderAt(ctx context.Context) (ChunkReaderAt, error)
}

type ChunkID

type ChunkID [16]byte

func NewChunkID

func NewChunkID(unixMillis int64, node NodeID, volume VolumeID, sequence uint16) ChunkID

func ParseChunkID

func ParseChunkID(s string) (ChunkID, error)

func (ChunkID) Bytes

func (id ChunkID) Bytes() []byte

func (ChunkID) MarshalBinary

func (id ChunkID) MarshalBinary() ([]byte, error)

func (ChunkID) MarshalText

func (id ChunkID) MarshalText() ([]byte, error)

func (ChunkID) NodeID

func (id ChunkID) NodeID() NodeID

func (ChunkID) Sequence

func (id ChunkID) Sequence() uint16

func (ChunkID) String

func (id ChunkID) String() string

func (ChunkID) Time

func (id ChunkID) Time() time.Time

func (ChunkID) UnixMilli

func (id ChunkID) UnixMilli() int64

func (*ChunkID) UnmarshalBinary

func (id *ChunkID) UnmarshalBinary(data []byte) error

func (*ChunkID) UnmarshalText

func (id *ChunkID) UnmarshalText(data []byte) error

func (ChunkID) VolumeID

func (id ChunkID) VolumeID() VolumeID

type ChunkIDGenerator

type ChunkIDGenerator interface {
	Generate(volume VolumeID) (ChunkID, error)
}

type ChunkRangeReader

type ChunkRangeReader interface {
	io.Closer
	io.Reader
}

type ChunkReader

type ChunkReader interface {
	io.Closer
	io.Reader
}

type ChunkReaderAt

type ChunkReaderAt interface {
	io.Closer
	io.ReaderAt
}

type ChunkRepository

type ChunkRepository interface {
	Get(ctx context.Context, id ChunkID) (Chunk, error)
	GetWithWriterKey(ctx context.Context, writerKey []byte) (Chunk, error)
	Upsert(ctx context.Context, chunk Chunk) error
	Delete(ctx context.Context, id ChunkID) error
}

type ChunkState

type ChunkState int
const (
	ChunkStateUnknown ChunkState = iota
	ChunkStatePending
	ChunkStateReady
	ChunkStateDeleted
)

type ChunkStorage

type ChunkStorage interface {
	Open(ctx context.Context, id ChunkID) (ChunkHandle, error)
	Create(ctx context.Context, id ChunkID, opts CreateChunkOptions) error
	Put(ctx context.Context, id ChunkID, r io.Reader, n int64, opts PutChunkOptions) error
	Append(ctx context.Context, id ChunkID, knownSize int64, r io.Reader, n int64, opts AppendChunkOptions) error
	Delete(ctx context.Context, id ChunkID) error
	ShrinkToFit(ctx context.Context, id ChunkID, knownSize int64, opts ShrinkChunkToFitOptions) error
	Exists(ctx context.Context, id ChunkID) (bool, error)
}

type CreateChunkOptions

type CreateChunkOptions struct {
	MinTailSlackLength int64
}

type DeletedChunk

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

func NewDeletedChunk

func NewDeletedChunk(id ChunkID, writerKey []byte, createdAt time.Time, deletedAt time.Time) *DeletedChunk

func (*DeletedChunk) CreatedAt

func (c *DeletedChunk) CreatedAt() time.Time

func (*DeletedChunk) DeletedAt

func (c *DeletedChunk) DeletedAt() (time.Time, bool)

func (*DeletedChunk) ExpiresAt

func (c *DeletedChunk) ExpiresAt() (time.Time, bool)

func (*DeletedChunk) ID

func (c *DeletedChunk) ID() ChunkID

func (*DeletedChunk) Size

func (c *DeletedChunk) Size() (int64, bool)

func (*DeletedChunk) State

func (*DeletedChunk) State() ChunkState

func (*DeletedChunk) UpdatedAt

func (c *DeletedChunk) UpdatedAt() (time.Time, bool)

func (*DeletedChunk) Version

func (c *DeletedChunk) Version() (uint64, bool)

func (*DeletedChunk) WriterKey

func (c *DeletedChunk) WriterKey() []byte

type FileStoreFormat

type FileStoreFormat interface {
	Initialize(node NodeID, volume VolumeID, path string) error
	Stat(path string) (*VolumeInfo, error)
	Open(path string) (VolumeHandle, error)
}

type FilesystemType

type FilesystemType string
const (
	FilesystemTypeUnknown FilesystemType = ""
	FilesystemTypeAPFS    FilesystemType = "apfs"
	FilesystemTypeBtrfs   FilesystemType = "btrfs"
	FilesystemTypeExt4    FilesystemType = "ext4"
	FilesystemTypeHFSPlus FilesystemType = "hfs+"
	FilesystemTypeNTFS    FilesystemType = "ntfs"
	FilesystemTypeReFS    FilesystemType = "refs"
	FilesystemTypeXFS     FilesystemType = "xfs"
	FilesystemTypeZFS     FilesystemType = "zfs"
)

func (FilesystemType) String

func (fs FilesystemType) String() string

type IOKitIOBlockStorageDriverStatistics

type IOKitIOBlockStorageDriverStatistics struct {
	// Describes the number of bytes read since the block storage driver was instantiated.
	//
	// This property describes the number of bytes read since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	BytesRead int64 `plist:"Bytes (Read)"`
	// Describes the number of bytes written since the block storage driver was instantiated.
	//
	// This property describes the number of bytes written since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	BytesWritten int64 `plist:"Bytes (Write)"`
	// Describes the number of nanoseconds of latency during reads since the block storage driver was instantiated.
	//
	// This property describes the number of nanoseconds of latency during reads since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	LatentReadTime int64 `plist:"Latency Time (Read)"`
	// Describes the number of nanoseconds of latency during writes since the block storage driver was instantiated.
	//
	// This property describes the number of nanoseconds of latency during writes since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	LatentWriteTime int64 `plist:"Latency Time (Write)"`
	// Describes the number of read errors encountered since the block storage driver was instantiated.
	//
	// This property describes the number of read errors encountered since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	ReadErrors int64 `plist:"Errors (Read)"`
	// Describes the number of read retries required since the block storage driver was instantiated.
	//
	// This property describes the number of read retries required since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	ReadRetries int64 `plist:"Retries (Read)"`
	// Describes the number of read operations processed since the block storage driver was instantiated.
	//
	// This property describes the number of read operations processed since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	Reads int64 `plist:"Operations (Read)"`
	// Describes the number of nanoseconds spent performing reads since the block storage driver was instantiated.
	//
	// This property describes the number of nanoseconds spent performing reads since the block storage driver was instantiated. It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table. It has an OSNumber value.
	TotalReadTime int64 `plist:"Total Time (Read)"`
	// Describes the number of nanoseconds spent performing writes since the block storage driver was instantiated.
	//
	// This property describes the number of nanoseconds spent performing writes since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	TotalWriteTime int64 `plist:"Total Time (Write)"`
	// Describes the number of write errors encountered since the block storage driver was instantiated.
	//
	// This property describes the number of write errors encountered since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	WriteErrors int64 `plist:"Errors (Write)"`
	// Describes the number of write retries required since the block storage driver was instantiated.
	//
	// This property describes the number of write retries required since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	WriteRetries int64 `plist:"Retries (Write)"`
	// Describes the number of write operations processed since the block storage driver was instantiated.
	//
	// This property describes the number of write operations processed since the block storage driver was instantiated.
	// It is one of the statistic entries listed under the top-level kIOBlockStorageDriverStatisticsKey property table.
	// It has an OSNumber value.
	Writes int64 `plist:"Operations (Write)"`
}

Statistics from IOKit block storage drivers on Apple platforms.

type InterconnectType

type InterconnectType string

InterconnectType describes the physical or network layer connecting a storage device. The zero value ("") indicates the interconnect type could not be determined.

const (
	// InterconnectTypeFibreChannel indicates a Fibre Channel connection.
	InterconnectTypeFibreChannel InterconnectType = "fibre-channel"
	// InterconnectTypeFireWire indicates an IEEE 1394 (FireWire) connection.
	InterconnectTypeFireWire InterconnectType = "firewire"
	// InterconnectTypeInfiniBand indicates an InfiniBand connection.
	InterconnectTypeInfiniBand InterconnectType = "infiniband"
	// InterconnectTypePATA indicates a Parallel ATA (IDE) connection.
	InterconnectTypePATA InterconnectType = "pata"
	// InterconnectTypePCIExpress indicates a PCI Express connection.
	InterconnectTypePCIExpress InterconnectType = "pci-express"
	// InterconnectTypeRDMA indicates an RDMA connection (e.g., RoCE, iWARP).
	InterconnectTypeRDMA InterconnectType = "rdma"
	// InterconnectTypeSAS indicates a Serial Attached SCSI connection.
	InterconnectTypeSAS InterconnectType = "sas"
	// InterconnectTypeSATA indicates a Serial ATA connection.
	InterconnectTypeSATA InterconnectType = "sata"
	// InterconnectTypeTCP indicates a TCP/IP network connection.
	InterconnectTypeTCP InterconnectType = "tcp"
	// InterconnectTypeUSB indicates a USB connection.
	InterconnectTypeUSB InterconnectType = "usb"
	// InterconnectTypeVirtIO indicates a VirtIO virtual device.
	InterconnectTypeVirtIO InterconnectType = "virtio"
)

type LinuxBlockLayerStatistics

type LinuxBlockLayerStatistics struct {
	// Reads is the number of read operations completed.
	Reads int64
	// MergedReads is the number of read operations merged.
	MergedReads int64
	// SectorsRead is the number of sectors read.
	SectorsRead int64
	// ReadTicks is the total number of milliseconds that read I/O requests have waited on this block device.
	// If multiple requests are waiting, this value increases faster than real time.
	ReadTicks int64
	// Writes is the number of write operations completed.
	Writes int64
	// MergedWrites is the number of write operations merged.
	MergedWrites int64
	// SectorsWritten is the number of sectors written.
	SectorsWritten int64
	// WriteTicks is the total number of milliseconds that write I/O requests have waited on this block device.
	// If multiple requests are waiting, this value increases faster than real time.
	WriteTicks int64
	// InFlight is the number of I/O operations currently in progress.
	InFlight int64
	// IOTicks is the total number of milliseconds during which the device has had I/O requests queued.
	IOTicks int64
	// TimeInQueue is the total wait time for all I/O requests, in milliseconds.
	TimeInQueue int64
	// Discards is the number of discard operations completed.
	Discards int64
	// MergedDiscards is the number of discard operations merged.
	MergedDiscards int64
	// SectorsDiscarded is the number of sectors discarded.
	SectorsDiscarded int64
	// DiscardTicks is the total number of milliseconds that discard I/O requests have waited on this block device.
	// If multiple requests are waiting, this value increases faster than real time.
	DiscardTicks int64
	// Flushes is the number of flush operations completed.
	Flushes int64
	// FlushTicks is the total number of milliseconds that flush I/O requests have waited on this block device.
	// If multiple requests are waiting, this value increases faster than real time.
	FlushTicks int64
}

Raw values from /sys/block/<device>/stat

type MediumType

type MediumType string

MediumType describes the physical storage medium. The zero value ("") indicates the medium type could not be determined.

const (
	// MediumTypeRotational indicates a spinning disk (HDD).
	MediumTypeRotational MediumType = "rotational"
	// MediumTypeSolidState indicates flash storage (SSD).
	MediumTypeSolidState MediumType = "solid-state"
)

type NodeClaim

type NodeClaim struct {
	ID    NodeID
	Proof [32]byte
}

type NodeClaimRegistry

type NodeClaimRegistry interface {
	Register(ctx context.Context, claim *NodeClaim) error
	Check(ctx context.Context, claim *NodeClaim) error
}

type NodeClaimRepository

type NodeClaimRepository interface {
	Get(ctx context.Context) (*NodeClaim, error)
	Upsert(ctx context.Context, claim *NodeClaim) error
}

type NodeID

type NodeID uint32

type NodeIDProvider

type NodeIDProvider interface {
	GetNodeID() NodeID
}

type NodeLabelPublisher

type NodeLabelPublisher interface {
	Publish(node NodeID, labels map[string]string)
}

type NodeLabelSource

type NodeLabelSource interface {
	Read() map[string]string
	Watch(watchCtx context.Context) <-chan struct{}
}

type NodePeer

type NodePeer struct {
	ID   NodeID
	GRPC NodePeerGRPC
}

type NodePeerGRPC

type NodePeerGRPC struct {
	URLs []string
}

type NodePeerResolver

type NodePeerResolver interface {
	Resolve(ctx context.Context, nodeID NodeID) (*NodePeer, error)
	Watch(ctx context.Context, nodeID NodeID) (<-chan struct{}, error)
}

type NodePresence

type NodePresence struct {
	ID    NodeID
	Nonce [32]byte
	GRPC  NodePresenceGRPC
}

func (*NodePresence) Equals

func (p *NodePresence) Equals(other *NodePresence) bool

type NodePresenceGRPC

type NodePresenceGRPC struct {
	URLs []string
}

type NodePresencePublisher

type NodePresencePublisher interface {
	Publish(presence *NodePresence)
}

type NodeSeed

type NodeSeed []byte

type NodeSeedGenerator

type NodeSeedGenerator interface {
	Generate() (NodeSeed, error)
}

type NodeSeedRepository

type NodeSeedRepository interface {
	Get(ctx context.Context) (NodeSeed, error)
	Upsert(ctx context.Context, seed NodeSeed) error
}

type PendingChunk

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

func NewPendingChunk

func NewPendingChunk(id ChunkID, writerKey []byte, createdAt time.Time, expiresAt time.Time) *PendingChunk

func (*PendingChunk) CreatedAt

func (c *PendingChunk) CreatedAt() time.Time

func (*PendingChunk) DeletedAt

func (c *PendingChunk) DeletedAt() (time.Time, bool)

func (*PendingChunk) ExpiresAt

func (c *PendingChunk) ExpiresAt() (time.Time, bool)

func (*PendingChunk) ID

func (c *PendingChunk) ID() ChunkID

func (*PendingChunk) Size

func (c *PendingChunk) Size() (int64, bool)

func (*PendingChunk) State

func (*PendingChunk) State() ChunkState

func (*PendingChunk) UpdatedAt

func (c *PendingChunk) UpdatedAt() (time.Time, bool)

func (*PendingChunk) Version

func (c *PendingChunk) Version() (uint64, bool)

func (*PendingChunk) WriterKey

func (c *PendingChunk) WriterKey() []byte

type ProtocolType

type ProtocolType string

ProtocolType describes the storage command protocol. This determines queuing behavior: ATA has a single queue (depth up to 32 with NCQ), SCSI has a single deep queue, and NVMe has multiple deep queues. The zero value ("") indicates the protocol could not be determined.

const (
	// ProtocolTypeATA indicates the ATA command set (used by SATA/PATA devices).
	ProtocolTypeATA ProtocolType = "ata"
	// ProtocolTypeSCSI indicates the SCSI command set (used by SAS, USB, FireWire, iSCSI, FC).
	ProtocolTypeSCSI ProtocolType = "scsi"
	// ProtocolTypeNVMe indicates the NVMe command set.
	ProtocolTypeNVMe ProtocolType = "nvme"
)

type PutChunkOptions

type PutChunkOptions struct {
	MinTailSlackLength int64
}

type ReadyChunk

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

func NewReadyChunk

func NewReadyChunk(id ChunkID, writerKey []byte, createdAt time.Time, updatedAt time.Time, size int64, version uint64) *ReadyChunk

func (*ReadyChunk) CreatedAt

func (c *ReadyChunk) CreatedAt() time.Time

func (*ReadyChunk) DeletedAt

func (c *ReadyChunk) DeletedAt() (time.Time, bool)

func (*ReadyChunk) ExpiresAt

func (c *ReadyChunk) ExpiresAt() (time.Time, bool)

func (*ReadyChunk) ID

func (c *ReadyChunk) ID() ChunkID

func (*ReadyChunk) Size

func (c *ReadyChunk) Size() (int64, bool)

func (*ReadyChunk) State

func (*ReadyChunk) State() ChunkState

func (*ReadyChunk) UpdatedAt

func (c *ReadyChunk) UpdatedAt() (time.Time, bool)

func (*ReadyChunk) Version

func (c *ReadyChunk) Version() (uint64, bool)

func (*ReadyChunk) WriterKey

func (c *ReadyChunk) WriterKey() []byte

type Sample

type Sample[T any] struct {
	// The sampled value
	Value T
	// A monotonic increasing epoch counter incremented whenever the underlying provider attempts to update stats.
	Epoch uint64
	// The time at which the sample was taken.
	Time time.Time
	// Any error encountered while obtaining the sample.
	Error error
}

A sample of a particular statistic type T.

func (*Sample[T]) After

func (s *Sample[T]) After(t *Sample[T]) bool

func (*Sample[T]) Before

func (s *Sample[T]) Before(t *Sample[T]) bool

func (*Sample[T]) Compare

func (s *Sample[T]) Compare(t *Sample[T]) int

func (*Sample[T]) IsZero

func (s *Sample[T]) IsZero() bool

func (*Sample[T]) Valid

func (s *Sample[T]) Valid() bool

type ShrinkChunkToFitOptions

type ShrinkChunkToFitOptions struct {
	MaxTailSlackLength int64
}

type SpaceUtilizationStatistics

type SpaceUtilizationStatistics struct {
	// TotalBytes is the total space of the volume in bytes.
	TotalBytes int64
	// UsedBytes is the used space of the volume in bytes.
	UsedBytes int64
	// FreeBytes is the free space of the volume in bytes.
	FreeBytes int64
}

type VolumeCharacteristics

type VolumeCharacteristics struct {
	DeviceName   string
	Medium       MediumType
	Interconnect InterconnectType
	Protocol     ProtocolType
	Vendor       string
	Model        string
	SerialNumber string

	Filesystem FilesystemType
	Zoning     ZoningType
}

VolumeCharacteristics describes the physical properties of a storage volume. These characteristics are detected from platform-specific sources (IOKit on macOS, sysfs on Linux) and normalized into a unified representation for labeling and observability purposes.

type VolumeCharacteristicsProvider

type VolumeCharacteristicsProvider interface {
	Get() *VolumeCharacteristics
	Watch(watchCtx context.Context) <-chan struct{}
}

type VolumeChooser

type VolumeChooser interface {
	Choose(options ChooseVolumeOptions) (VolumeID, error)
	Reset(ids []VolumeID)
	Refresh(id VolumeID)
}

type VolumeHandle

type VolumeHandle interface {
	io.Closer

	Info() VolumeInfo

	GetChunkStorage() ChunkStorage

	GetCharacteristicsProvider() VolumeCharacteristicsProvider

	GetLabelSources() []VolumeLabelSource

	GetStatusProvider() VolumeStatusProvider

	GetStructuredLoggingFieldsProvider() VolumeStructuredLoggingFieldsProvider

	GetOTelAttributeProvider() VolumeOTelAttributeProvider

	GetIOKitIOBlockStorageDriverStatisticsProvider() VolumeStatisticsProvider[IOKitIOBlockStorageDriverStatistics]

	GetLinuxBlockLayerStatisticsProvider() VolumeStatisticsProvider[LinuxBlockLayerStatistics]

	GetSpaceUtilizationStatisticsProvider() VolumeStatisticsProvider[SpaceUtilizationStatistics]
}

type VolumeHealth

type VolumeHealth int
const (
	VolumeUnknown VolumeHealth = iota
	VolumeOK
	VolumeDegraded
	VolumeFailed
)

func (VolumeHealth) IsPermanent

func (h VolumeHealth) IsPermanent() bool

IsPermanent reports whether the volume health represents a terminal, non‑recoverable failure. A permanent state (Failed) means the volume cannot safely serve any I/O and requires manual intervention or rebuild.

func (VolumeHealth) IsTransient

func (h VolumeHealth) IsTransient() bool

IsTransient reports whether the volume health represents a temporary, recoverable condition. A transient state (Degraded) indicates the volume can still serve reads but should avoid writes until it recovers.

func (VolumeHealth) ShedsReads

func (h VolumeHealth) ShedsReads() bool

ShedsReads reports whether the volume should reject read operations. Only Failed volumes shed reads, because data is no longer reliably accessible in that state.

func (VolumeHealth) ShedsWrites

func (h VolumeHealth) ShedsWrites() bool

ShedsWrites reports whether the volume should reject write operations due to its current health. Degraded volumes shed writes to avoid worsening the condition, and Failed volumes shed both reads and writes.

func (VolumeHealth) String

func (h VolumeHealth) String() string

type VolumeID

type VolumeID uint16

type VolumeIDCounter

type VolumeIDCounter interface {
	Next() (VolumeID, error)
}

type VolumeInfo

type VolumeInfo struct {
	ID   VolumeID
	Node NodeID
}

type VolumeLabelPublisher

type VolumeLabelPublisher interface {
	Publish(node NodeID, labels map[VolumeID]map[string]string)
}

type VolumeLabelSource

type VolumeLabelSource interface {
	Read() map[string]string
	Watch(watchCtx context.Context) <-chan struct{}
}

type VolumeOTelAttributeProvider

type VolumeOTelAttributeProvider interface {
	Get() []attribute.KeyValue
}

type VolumeSet

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

func NewVolumeSet

func NewVolumeSet() *VolumeSet

func (*VolumeSet) AddVolume

func (s *VolumeSet) AddVolume(volume VolumeID)

func (*VolumeSet) ContainsVolume

func (s *VolumeSet) ContainsVolume(volume VolumeID) bool

func (*VolumeSet) Count

func (s *VolumeSet) Count() int

func (*VolumeSet) MarshalBinary

func (s *VolumeSet) MarshalBinary() ([]byte, error)

func (*VolumeSet) RemoveVolume

func (s *VolumeSet) RemoveVolume(volume VolumeID)

func (*VolumeSet) UnmarshalBinary

func (s *VolumeSet) UnmarshalBinary(data []byte) error

type VolumeStatisticsProvider

type VolumeStatisticsProvider[T any] interface {
	Get() Sample[T]
	Watch(watchCtx context.Context) <-chan struct{}
}

type VolumeStatus

type VolumeStatus struct {
	Health VolumeHealth
}

type VolumeStatusProvider

type VolumeStatusProvider interface {
	Get() VolumeStatus
}

type VolumeStructuredLoggingFieldsProvider

type VolumeStructuredLoggingFieldsProvider interface {
	Get() []any
}

type ZoningType

type ZoningType string

ZoningType describes the write‑ordering and zone‑management behavior required by a storage device. Zoned devices divide media into zones with sequential‑write constraints; the zoning type indicates how much of this behavior is enforced by the device versus managed by the host. The zero value ("") indicates the zoning type could not be determined.

const (
	// ZoningTypeUnknown indicates that the zoning behavior could not be detected.
	ZoningTypeUnknown ZoningType = ""

	// ZoningTypeDriveManaged indicates that the device implements zoned media
	// internally but presents a conventional block interface to the host.
	// This corresponds to drive‑managed SMR HDDs.
	ZoningTypeDriveManaged ZoningType = "drive-managed"

	// ZoningTypeHostAware indicates that the device exposes zones to the host
	// and can benefit from sequential writes, but still accepts random writes.
	// This applies to host‑aware SMR HDDs and host‑aware ZNS devices.
	ZoningTypeHostAware ZoningType = "host-aware"

	// ZoningTypeHostManaged indicates that the device requires the host to
	// issue writes sequentially within zones and to manage zone resets.
	// This applies to host‑managed SMR (HM‑SMR), SCSI ZBC, and NVMe ZNS
	// devices operating in host‑managed mode.
	ZoningTypeHostManaged ZoningType = "host-managed"
)

Jump to

Keyboard shortcuts

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