Documentation
¶
Overview ¶
Package files exposes authoritative namespace cores over WebSocket control RPC and bounded HTTP file transfers, with an injected metadata authority gate.
Index ¶
- Constants
- func NewComputeHandler(cfg ComputeServerConfig) (cluster.RPCHandler, error)
- type Admission
- type Client
- func (c *Client) ChunkSize() int
- func (c *Client) Close() error
- func (c *Client) Consistency() option.ConsistencyConfig
- func (c *Client) Create(ctx context.Context, parent uint64, name string, kind meta.Kind, ...) (meta.Entry, error)
- func (c *Client) CreateData(ctx context.Context, parent uint64, name string, size int64) (core.DataFile, error)
- func (c *Client) CreateDevice(ctx context.Context, parent uint64, name string, kind meta.Kind, ...) (meta.Entry, error)
- func (c *Client) DirectoryPageSize() int
- func (c *Client) EnsureBlockGeometry(ctx context.Context, inode uint64, size int64, readOnly bool) error
- func (c *Client) Format() fsformat.Volume
- func (c *Client) GetAttr(ctx context.Context, inode uint64) (meta.Entry, error)
- func (c *Client) GetXattr(ctx context.Context, inode uint64, name string) ([]byte, error)
- func (c *Client) HasWriteback() bool
- func (c *Client) HomeWriter() option.HomeWriter
- func (c *Client) IsRemote() bool
- func (c *Client) Link(ctx context.Context, inode, parent uint64, name string) (meta.Entry, error)
- func (c *Client) ListXattr(ctx context.Context, inode uint64) ([]byte, error)
- func (c *Client) Lookup(ctx context.Context, parent uint64, name string) (meta.Entry, error)
- func (c *Client) MetadataCacheTTL() time.Duration
- func (c *Client) OpenData(ctx context.Context, inode uint64) (core.DataFile, error)
- func (c *Client) ReadDirectory(ctx context.Context, parent uint64, cursor string, limit int) ([]meta.Entry, error)
- func (c *Client) Readlink(ctx context.Context, inode uint64) (string, error)
- func (c *Client) Remove(ctx context.Context, inode uint64) error
- func (c *Client) RemoveXattr(ctx context.Context, inode uint64, name string) error
- func (c *Client) Rename(ctx context.Context, inode, parent uint64, name string) error
- func (c *Client) RenameEntry(ctx context.Context, parent uint64, name string, newParent uint64, ...) error
- func (c *Client) RenameEntryFlags(ctx context.Context, parent uint64, name string, newParent uint64, ...) error
- func (c *Client) RetainInode(ctx context.Context, inode uint64) (core.InodeReference, error)
- func (c *Client) SetAttr(ctx context.Context, inode uint64, a core.AttrUpdate) (meta.Entry, error)
- func (c *Client) SetXattr(ctx context.Context, inode uint64, name string, value []byte, flags uint32) error
- func (c *Client) Symlink(ctx context.Context, parent uint64, name, target string, uid, gid uint32) (meta.Entry, error)
- func (c *Client) Sync(ctx context.Context) error
- func (c *Client) SyncMetadata(ctx context.Context) error
- func (c *Client) Unlink(ctx context.Context, parent uint64, name string, kind meta.UnlinkKind) error
- func (c *Client) VolumeID() string
- type ClientConfig
- type ComputeMembers
- type ComputePlan
- type ComputePolicy
- type ComputeServerConfig
- type File
- func (f *File) Close(ctx context.Context) error
- func (f *File) CloseLocal(ctx context.Context) error
- func (f *File) Discard(ctx context.Context, off, size int64) error
- func (f *File) Flush(ctx context.Context) syscall.Errno
- func (f *File) Fsync(ctx context.Context) syscall.Errno
- func (f *File) Inode() uint64
- func (f *File) Read(ctx context.Context, p []byte, off int64) (core.ReadResult, syscall.Errno)
- func (f *File) ReadAt(ctx context.Context, p []byte, off int64) (int, error)
- func (f *File) Release(ctx context.Context) syscall.Errno
- func (f *File) SetAttr(ctx context.Context, a core.AttrUpdate) (meta.Entry, error)
- func (f *File) Stat(ctx context.Context) (meta.Entry, error)
- func (f *File) Sync(ctx context.Context, backend bool) error
- func (f *File) Truncate(ctx context.Context, size int64) error
- func (f *File) WriteAt(ctx context.Context, p []byte, off int64) (int, error)
- type MetadataCacheConfig
- type MetadataState
- type Server
- func (s *Server) AddNamespace(id string, child *Server) error
- func (s *Server) Close(ctx context.Context) error
- func (s *Server) Quiesce(ctx context.Context, capture func() error) error
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetNamespaceResolver(resolve func(context.Context, string) (*Server, error))
- type ServerConfig
- type Storage
- type VolumeInfo
Constants ¶
const DefaultMaxIO = 4 << 20
const NamespaceVersion = 14
const Version = 13
Variables ¶
This section is empty.
Functions ¶
func NewComputeHandler ¶
func NewComputeHandler(cfg ComputeServerConfig) (cluster.RPCHandler, error)
NewComputeHandler issues bounded compute-only STS to volume writers. The caller's Members callback must exclude expired registry leases. Encoding remains an uncommitted computation; grants confer no data or namespace write.
Types ¶
type Admission ¶
type Admission struct {
// contains filtered or unexported fields
}
Admission shares a bounded, work-conserving weighted FIFO scheduler across namespace services. A permit owns one request until its release function runs.
func NewAdmission ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Consistency ¶
func (c *Client) Consistency() option.ConsistencyConfig
Consistency reports the normalized remote policy used for this session.
func (*Client) CreateData ¶
func (*Client) CreateDevice ¶
func (*Client) DirectoryPageSize ¶
func (*Client) EnsureBlockGeometry ¶
func (*Client) HasWriteback ¶
func (*Client) HomeWriter ¶
func (c *Client) HomeWriter() option.HomeWriter
HomeWriter reports the authority fence returned by the server volume handshake. It is useful to bind a caller's subsequent work to one home generation without exposing mutable client state.
func (*Client) MetadataCacheTTL ¶
MetadataCacheTTL reports the explicitly configured bounded-stale lease for metadata queries. A zero result means strict metadata RPCs (or a client which has no cache). Export adapters may use this optional capability to align positive FUSE attribute/dentry leases with the same policy; it does not enable directory page caching or alter data I/O.
func (*Client) ReadDirectory ¶
func (*Client) RemoveXattr ¶
func (*Client) RenameEntry ¶
func (*Client) RenameEntryFlags ¶
func (*Client) RetainInode ¶
type ClientConfig ¶
type ClientConfig struct {
NamespaceID string
Server string
DataRoute string
ClusterID, NodeID, AccessKeyID, SecretAccessKey string
HTTPClient *http.Client
Consistency option.ConsistencyConfig
// MetadataCache explicitly permits bounded-stale metadata reads. Nil keeps
// every metadata query on the authoritative, gated RPC path.
MetadataCache *MetadataCacheConfig
}
type ComputeMembers ¶
type ComputeMembers struct {
Version int `json:"version"`
Members []compute.Member `json:"members"`
Policy ComputePolicy `json:"policy"`
}
type ComputePlan ¶
type ComputePlan struct {
Job compute.Job `json:"job"`
Credentials cluster.Credentials `json:"credentials"`
}
type ComputePolicy ¶
type ComputePolicy struct {
MaxChunkBytes int64 `json:"max_chunk_bytes"`
MaxConcurrent int `json:"max_concurrent"`
QueueDepth int `json:"queue_depth"`
RemoteTimeout time.Duration `json:"remote_timeout"`
MinBytes int64 `json:"min_bytes"`
LocalBytesPerSecond float64 `json:"local_bytes_per_second"`
NetworkBytesPerSecond float64 `json:"network_bytes_per_second"`
RoundTrip time.Duration `json:"round_trip"`
EstimatedRatio float64 `json:"estimated_ratio"`
ForceRemote bool `json:"force_remote"`
}
ComputePolicy contains scheduling estimates, never codec implementation or credential material. Zero fields retain codec/cluster defaults.
type ComputeServerConfig ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a server-owned handle. The server orders operations with all other handles of the same inode. Handle operations always use the server; the optional namespace metadata cache never hides a stale handle generation.
type MetadataCacheConfig ¶
type MetadataCacheConfig = option.MetadataCacheConfig
MetadataCacheConfig explicitly opts into bounded-stale remote metadata reads. It is shared with storage options; nil retains strict per-query authority RPC.
type MetadataState ¶
type MetadataState struct {
Consistency option.ConsistencyMode
HomeEpoch string
MinSeq uint64
}
MetadataState describes the metadata generation and committed position currently served by a namespace. The position must reflect the namespace's visible state, rather than a replica log which has not been published yet.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(cfg ServerConfig) (*Server, error)
func (*Server) AddNamespace ¶
AddNamespace publishes a fully initialized service. Ownership transfers only on success; the caller closes an unpublished child after any error.
type ServerConfig ¶
type ServerConfig struct {
// NamespaceID is derived from the authenticated identity, never a request path.
NamespaceID string
// Namespaces contains additional, independently owned file services. The
// default service routes authenticated requests and owns their lifecycle.
Namespaces map[string]*Server
ResolveNamespace func(context.Context, string) (*Server, error)
AuthorizePrincipal func(context.Context, cluster.Principal) error
BeginPrincipal func(context.Context, cluster.Principal) (func(), error)
Admission *Admission
FileSystem core.Access
Store *clusterstore.Store
DataKeys map[string]cluster.NodeKeys
Encoder string
Gate func(context.Context) error
// ReadMetadataChanges is an immediate, bounded journal read. The caller
// explicitly enables the namespace journal and owns its lifetime. Waiting
// polls may invoke it without Gate for a private RAM-only change hint; only
// freshly gated samples are delivered. It must not block or access storage.
ReadMetadataChanges func(context.Context, meta.ChangeCursor, int) (meta.ChangePage, error)
// MetadataCacheEpoch changes on authority term/activation transitions. A
// random server-instance ID additionally fences service reconstruction.
MetadataCacheEpoch func() string
// MetadataState samples one coherent metadata position during each gated
// volume handshake. The caller owns publication and durability; an error
// rejects the handshake rather than advertising an older fallback state.
MetadataState func(context.Context) (MetadataState, error)
// HomeEpoch and MinSeq provide a static strict fence when MetadataState is
// nil. Dynamic authority implementations should supply MetadataState.
HomeEpoch string
MinSeq uint64
ClusterID, NodeID string
Keys map[string]cluster.Identity
Authority *cluster.Authority
Issue cluster.Issuer
Authenticate cluster.Authenticator
MaxIO, MaxHandles, MaxPlans int
PlanTTL, SessionTTL time.Duration
// Other handles node registration and discovery without exposing storage KV.
Other cluster.RPCHandler
Compute cluster.RPCHandler
}
type Storage ¶
Storage owns either a local core or its remote connection. Close it after all export adapters have stopped, before closing any injected local resources.
type VolumeInfo ¶
type VolumeInfo struct {
NamespaceID string `json:"namespace_id,omitempty"`
Direct bool `json:"direct,omitempty"`
Encoder string `json:"encoder,omitempty"`
Version int `json:"version"`
VolumeID string `json:"volume_id"`
Format fsformat.Volume `json:"format"`
DirectoryPageSize int `json:"directory_page_size"`
HasWriteback bool `json:"has_writeback"`
MaxIO int `json:"max_io"`
NodeID string `json:"node_id"`
MetadataChanges bool `json:"metadata_changes,omitempty"`
// HomeEpoch and MinSeq fence clients to an authority generation and the
// minimum committed sequence observed by this service.
HomeEpoch string `json:"home_epoch,omitempty"`
MinSeq uint64 `json:"min_seq,omitempty"`
// Consistency is the server's admission policy. Strict clients reject an
// eventual server; an omitted value preserves the legacy strict policy.
Consistency option.ConsistencyMode `json:"consistency,omitempty"`
}