Documentation
¶
Overview ¶
Package smoothfs provides the low-coupling userspace contract for the smoothfs kernel module. It intentionally carries the generic-netlink client, event decoder, and managed-pool helpers that consumers can import as a versioned dependency.
Index ¶
- Constants
- Variables
- func DestroyManagedPool(p ManagedPool) error
- func MountpointForPool(base, name string) string
- func RenderMountUnit(p ManagedPool) (string, error)
- func UnitFilenameFor(mountpoint string) string
- func ValidatePoolName(name string) error
- func ValidateTiers(tiers []string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) Inspect(poolUUID uuid.UUID, oid [OIDLen]byte) (*InspectResult, error)
- func (c *Client) MoveCutover(poolUUID uuid.UUID, oid [OIDLen]byte, seq uint64) error
- func (c *Client) MoveCutoverVerifyWriteSeq(poolUUID uuid.UUID, oid [OIDLen]byte, seq, writeSeq uint64) error
- func (c *Client) MovePlan(poolUUID uuid.UUID, oid [OIDLen]byte, destTier uint8, seq uint64) error
- func (c *Client) MovePlanForce(poolUUID uuid.UUID, oid [OIDLen]byte, destTier uint8, seq uint64, force bool) error
- func (c *Client) Quiesce(poolUUID uuid.UUID) error
- func (c *Client) Receive() ([]genetlink.Message, error)
- func (c *Client) Reconcile(poolUUID uuid.UUID, reason string) error
- func (c *Client) RevokeMappings(poolUUID uuid.UUID, oid [OIDLen]byte) error
- type CreateManagedPoolRequest
- type Event
- type HeatSampleRecord
- type InspectResult
- type ManagedPool
- type MountedTier
- type MoveStateEvent
- type MovementState
- type PinState
- type SpillEvent
- type TierFaultEvent
Constants ¶
const ( GenlFamilyName = "smoothfs" GenlFamilyVersion = 1 GenlMcastGroup = "events" OIDLen = 16 )
const ( CmdUnspec uint8 = 0 CmdRegisterPool uint8 = 1 CmdPolicyPush uint8 = 2 CmdMovePlan uint8 = 3 CmdTierDown uint8 = 4 CmdReconcile uint8 = 5 CmdQuiesce uint8 = 6 CmdInspect uint8 = 7 CmdReprobe uint8 = 8 EventMountReady uint8 = 9 EventHeatSample uint8 = 10 EventMoveState uint8 = 11 EventTierFault uint8 = 12 CmdMoveCutover uint8 = 13 CmdRevokeMappings uint8 = 14 EventSpill uint8 = 15 )
Generic netlink commands. Keep in sync with src/smoothfs/uapi_smoothfs.h.
const ( AttrUnspec uint16 = 0 AttrPoolUUID uint16 = 1 AttrPoolName uint16 = 2 AttrFSID uint16 = 3 AttrTierRank uint16 = 4 AttrTierCaps uint16 = 5 AttrTierPath uint16 = 6 AttrTierID uint16 = 7 AttrObjectID uint16 = 8 AttrGeneration uint16 = 9 AttrMovementState uint16 = 10 AttrCurrentTier uint16 = 11 AttrIntendedTier uint16 = 12 AttrTransactionSeq uint16 = 13 AttrPinState uint16 = 14 AttrHeatSampleBlob uint16 = 15 AttrCheckpointSeq uint16 = 16 AttrReconcileReason uint16 = 17 AttrTiers uint16 = 18 AttrRelPath uint16 = 19 AttrForce uint16 = 20 AttrSizeBytes uint16 = 21 AttrAnySpillSinceMount uint16 = 22 AttrWriteSeq uint16 = 23 AttrRangeStaged uint16 = 24 )
Generic netlink attributes. Keep in sync with src/smoothfs/uapi_smoothfs.h.
const DefaultMountBase = "/mnt/smoothfs"
const HeatSampleRecordSize = 56
const SystemdUnitDir = "/etc/systemd/system"
Variables ¶
var ErrNotLoaded = errors.New("smoothfs kernel module not loaded")
ErrNotLoaded is returned by Open if the smoothfs kernel module is not loaded (the genetlink family doesn't exist).
Functions ¶
func DestroyManagedPool ¶
func DestroyManagedPool(p ManagedPool) error
func MountpointForPool ¶
func RenderMountUnit ¶
func RenderMountUnit(p ManagedPool) (string, error)
func UnitFilenameFor ¶
func ValidatePoolName ¶
func ValidateTiers ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a thin generic-netlink wrapper for the "smoothfs" family.
func (*Client) MoveCutover ¶
func (*Client) MoveCutoverVerifyWriteSeq ¶
func (*Client) MovePlanForce ¶
type Event ¶
type Event struct {
PoolUUID uuid.UUID
Type uint8
PoolName string
AnySpillSinceMount bool
HeatSamples []HeatSampleRecord
Tiers []MountedTier
Move *MoveStateEvent
Tier *TierFaultEvent
Spill *SpillEvent
}
Event is the tagged union of multicast messages from the kernel.
type HeatSampleRecord ¶
type HeatSampleRecord struct {
OID [OIDLen]byte
OpenCountDelta uint32
ReadBytesDelta uint64
WriteBytesDelta uint64
LastAccessNS uint64
SampleWindowNS uint64
// contains filtered or unexported fields
}
HeatSampleRecord matches the 56-byte on-wire layout in uapi_smoothfs.h.
type InspectResult ¶
type ManagedPool ¶
type ManagedPool struct {
Name string `json:"name"`
UUID uuid.UUID `json:"uuid"`
Tiers []string `json:"tiers"`
Mountpoint string `json:"mountpoint"`
UnitPath string `json:"unit_path"`
}
func CreateManagedPool ¶
func CreateManagedPool(req CreateManagedPoolRequest) (*ManagedPool, error)
type MountedTier ¶
type MoveStateEvent ¶
type MoveStateEvent struct {
OID [OIDLen]byte
NewState MovementState
TransactionSeq uint64
}
type MovementState ¶
type MovementState string
MovementState mirrors the on-disk movement_state CHECK column + kernel-internal enum.
const ( StatePlaced MovementState = "placed" StatePlanAccepted MovementState = "plan_accepted" StateDestinationReserved MovementState = "destination_reserved" StateCopyInProgress MovementState = "copy_in_progress" StateCopyComplete MovementState = "copy_complete" StateCopyVerified MovementState = "copy_verified" StateCutoverInProgress MovementState = "cutover_in_progress" StateSwitched MovementState = "switched" StateCleanupInProgress MovementState = "cleanup_in_progress" StateCleanupComplete MovementState = "cleanup_complete" StateFailed MovementState = "failed" StateStale MovementState = "stale" )
type SpillEvent ¶
type TierFaultEvent ¶
type TierFaultEvent struct {
TierRank uint8
}