Documentation
¶
Index ¶
- Constants
- Variables
- type CreateOptions
- type CreateResult
- type DirEntry
- type Dirent
- type Dispatcher
- type FSUsage
- type FileType
- type Home
- type HomeState
- type InodeMeta
- type IntentKind
- type IntentState
- type LeaseReapStats
- type MoveJob
- type MovePhase
- type OpenHandleLease
- type OperationalObserver
- type Option
- func WithCapacity(capacity uint64) Option
- func WithChunkSize(size uint64) Option
- func WithClock(now func() time.Time) Option
- func WithHomeSlotAllocator(homeSlot func(uint64) uint64) Option
- func WithIDAllocator(alloc func() (uint64, error)) Option
- func WithMaxFiles(maxFiles uint64) Option
- func WithOpenHandleLeaseTTL(ttl time.Duration) Option
- func WithOperationalObserver(observer OperationalObserver) Option
- type PlacementStats
- type ReaddirResult
- type RecoveryStats
- type Service
- func (s *Service) Create(ctx context.Context, parent uint64, name []byte, opts CreateOptions) (CreateResult, error)
- func (s *Service) Flush(context.Context, uint64, uint64) error
- func (s *Service) Fsync(ctx context.Context, inode uint64, _ uint64, _ bool) error
- func (s *Service) GetAttr(ctx context.Context, inode uint64) (Stat, error)
- func (s *Service) GetFileHome(ctx context.Context, inode uint64) (Home, error)
- func (s *Service) InitializeRoot(ctx context.Context, mode uint32, uid uint32, gid uint32) error
- func (s *Service) ListFilePlacementStats(ctx context.Context) (PlacementStats, error)
- func (s *Service) Mkdir(ctx context.Context, parent uint64, name []byte, opts CreateOptions) (CreateResult, error)
- func (s *Service) MoveFile(ctx context.Context, inode uint64, targetGroup uint64) (MoveJob, error)
- func (s *Service) Open(ctx context.Context, inode uint64, clientID []byte) (uint64, error)
- func (s *Service) Read(ctx context.Context, inode uint64, _ uint64, offset uint64, size uint64) ([]byte, error)
- func (s *Service) Readdir(ctx context.Context, inode uint64, cookie string, limit int) (ReaddirResult, error)
- func (s *Service) ReapExpiredOpenHandleLeases(ctx context.Context, limit int) (LeaseReapStats, error)
- func (s *Service) RecoverIntents(ctx context.Context, limit int) (RecoveryStats, error)
- func (s *Service) RefreshOpenHandleLease(ctx context.Context, inode uint64, fh uint64, clientID []byte) error
- func (s *Service) Release(ctx context.Context, inode uint64, fh uint64, clientID []byte) error
- func (s *Service) Rename(ctx context.Context, oldParent uint64, oldName []byte, newParent uint64, ...) error
- func (s *Service) Resolve(ctx context.Context, parent uint64, name []byte) (uint64, error)
- func (s *Service) ResumeMoveFile(ctx context.Context, jobID []byte) (MoveJob, error)
- func (s *Service) Rmdir(ctx context.Context, parent uint64, name []byte) error
- func (s *Service) SetAttr(ctx context.Context, inode uint64, mask SetAttrMask, attrs SetAttr) (Stat, error)
- func (s *Service) StatFS(ctx context.Context, _ uint64) (StatFS, error)
- func (s *Service) Truncate(ctx context.Context, inode uint64, size uint64) error
- func (s *Service) Unlink(ctx context.Context, parent uint64, name []byte) error
- func (s *Service) Write(ctx context.Context, inode uint64, _ uint64, offset uint64, data []byte) (int, error)
- type SetAttr
- type SetAttrMask
- type Stat
- type StatFS
Constants ¶
const ( RootInode uint64 = 1 DefaultChunkSize = 4 * bytesPerMiB )
Variables ¶
var ( ErrStoreRequired = errors.New("filesystem: store is required") ErrDispatcherRequired = errors.New("filesystem: dispatcher is required") ErrNotFound = errors.New("filesystem: no such file or directory") ErrExists = errors.New("filesystem: file exists") ErrNotDir = errors.New("filesystem: not a directory") ErrIsDir = errors.New("filesystem: is a directory") ErrNotEmpty = errors.New("filesystem: directory not empty") ErrCrossDevice = errors.New("filesystem: cross-domain rename") ErrInvalid = errors.New("filesystem: invalid argument") ErrUnsupported = errors.New("filesystem: operation not supported") ErrStaleHome = errors.New("filesystem: stale or migrating file home") ErrMoveJobNotFound = errors.New("filesystem: move job not found") ErrMoveFenceLost = errors.New("filesystem: move job lost its epoch fence") ErrPlacementRequired = errors.New("filesystem: placement resolver is required") ErrInodeCollisionLimit = errors.New("filesystem: inode allocation collision limit reached") )
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
type CreateResult ¶
type Dispatcher ¶
type Dispatcher interface {
Dispatch(context.Context, *kv.OperationGroup[kv.OP]) (*kv.CoordinateResponse, error)
}
type InodeMeta ¶
type InodeMeta struct {
Inode uint64 `json:"inode"`
Parent uint64 `json:"parent"`
Type FileType `json:"type"`
Mode uint32 `json:"mode"`
UID uint32 `json:"uid"`
GID uint32 `json:"gid"`
Size uint64 `json:"size"`
AtimeNsec int64 `json:"atime_nsec"`
MtimeNsec int64 `json:"mtime_nsec"`
CtimeNsec int64 `json:"ctime_nsec"`
ChunkSize uint64 `json:"chunk_size"`
HomeSlot uint64 `json:"home_slot"`
Epoch uint64 `json:"epoch"`
Nlink uint32 `json:"nlink"`
Generation uint64 `json:"generation"`
Orphaned bool `json:"orphaned,omitempty"`
}
type IntentKind ¶
type IntentKind string
const ( IntentKindCreate IntentKind = "create" IntentKindDelete IntentKind = "delete" IntentKindMove IntentKind = "move" )
type IntentState ¶
type IntentState struct {
ID []byte `json:"id"`
Kind IntentKind `json:"kind"`
Phase string `json:"phase"`
Inode uint64 `json:"inode,omitempty"`
Parent uint64 `json:"parent,omitempty"`
Name []byte `json:"name,omitempty"`
JobID []byte `json:"job_id,omitempty"`
CreatedAt int64 `json:"created_at_nsec"`
UpdatedAt int64 `json:"updated_at_nsec"`
}
type LeaseReapStats ¶
type MoveJob ¶
type MoveJob struct {
ID []byte `json:"id"`
Inode uint64 `json:"inode"`
SourceHome uint64 `json:"source_home"`
TargetHome uint64 `json:"target_home"`
TargetGroup uint64 `json:"target_group"`
MigrationEpoch uint64 `json:"migration_epoch"`
SwitchEpoch uint64 `json:"switch_epoch,omitempty"`
Phase MovePhase `json:"phase"`
Cursor []byte `json:"cursor,omitempty"`
CopiedChunks uint64 `json:"copied_chunks,omitempty"`
CleanedChunks uint64 `json:"cleaned_chunks,omitempty"`
CreatedAt int64 `json:"created_at_nsec"`
UpdatedAt int64 `json:"updated_at_nsec"`
}
type OpenHandleLease ¶
type OperationalObserver ¶
type Option ¶
type Option func(*Service)
func WithCapacity ¶
func WithChunkSize ¶
func WithHomeSlotAllocator ¶
func WithIDAllocator ¶
func WithMaxFiles ¶
func WithOpenHandleLeaseTTL ¶
func WithOperationalObserver ¶
func WithOperationalObserver(observer OperationalObserver) Option
type PlacementStats ¶
type ReaddirResult ¶
type RecoveryStats ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, parent uint64, name []byte, opts CreateOptions) (CreateResult, error)
func (*Service) GetFileHome ¶
GetFileHome returns the durable placement state for an inode.
func (*Service) InitializeRoot ¶
func (*Service) ListFilePlacementStats ¶
func (s *Service) ListFilePlacementStats(ctx context.Context) (PlacementStats, error)
ListFilePlacementStats computes operator-facing placement state at one fenced snapshot and publishes it to the configured observer.
func (*Service) Mkdir ¶
func (s *Service) Mkdir(ctx context.Context, parent uint64, name []byte, opts CreateOptions) (CreateResult, error)
func (*Service) MoveFile ¶
MoveFile synchronously executes a resumable whole-file migration. The job is durable before any chunk copy starts, so RecoverIntents can resume it after a process or leader restart.
func (*Service) ReapExpiredOpenHandleLeases ¶
func (*Service) RecoverIntents ¶
RecoverIntents resumes durable move jobs and aborts prepared namespace intents. Create/delete publish their intent before the atomic namespace txn and delete it inside that txn, so a surviving marker proves the namespace mutation did not commit and is safe to clear.
func (*Service) RefreshOpenHandleLease ¶
func (*Service) ResumeMoveFile ¶
ResumeMoveFile advances a durable migration state machine until completion.