Documentation
¶
Index ¶
- Constants
- Variables
- func Chmod(ctx context.Context, dir Dentry, name string, mode cas.FileMode) error
- func DentryHash(dir Dentry, name string) string
- func Lstat(ctx context.Context, dir Dentry, name string) (cas.FileInfo, error)
- func NewCASFSAPI(mountPath string, api API, fs FS) fs.FS
- func NewFSAPI(fs FS) *namei
- func OpenFile(ctx context.Context, dir Dentry, name string, flags int, perm cas.FileMode) (fs.FSFile, error)
- func Readlink(ctx context.Context, dir Dentry, name string) (string, error)
- func Remove(ctx context.Context, dir Dentry, name string) error
- func Rename(ctx context.Context, oldDir Dentry, oldName string, newDir Dentry, ...) error
- func RenameDentries(oldEntry, newEntry Dentry)
- type API
- type ContextValue
- type Dcache
- type DcacheWatch
- type Dentry
- func CreateFile(ctx context.Context, dir Dentry, name string, mode cas.FileMode) (Dentry, error)
- func CreateTmpFile(ctx context.Context, dir Dentry, mode cas.FileMode) (Dentry, error)
- func Link(ctx context.Context, dir Dentry, name string, target Dentry) (Dentry, error)
- func Lookup(ctx context.Context, dir Dentry, name string) Dentry
- func LookupNegative(ctx context.Context, dir Dentry, name string) (Dentry, error)
- func LookupPositive(ctx context.Context, dir Dentry, name string) (Dentry, error)
- func Mkdir(ctx context.Context, dir Dentry, name string, mode cas.FileMode) (Dentry, error)
- func Mknod(ctx context.Context, dir Dentry, name string, mode cas.FileMode, rDev int) (Dentry, error)
- func Resolve(ctx context.Context, d Dentry, p string) (Dentry, error)
- func Symlink(ctx context.Context, dir Dentry, name, target string) (Dentry, error)
- type DentryState
- type Dir
- type ExtType
- type FS
- type Fifo
- type File
- type FileInfo
- type Inode
- type NodeAttr
- type Socket
- type SymLink
Constants ¶
View Source
const MaxPathLen = 4096
Variables ¶
View Source
var ( ErrEntryNotFound = fs.ErrNotExist ErrNotADirectory = errors.New("entry is not a directory") ErrNotAFile = errors.New("entry is not a file") ErrEntryExists = fs.ErrExist ErrDirNotEmpty = syscall.ENOTEMPTY ErrNotSupported = errors.New("not supported") ErrUnknownXattr = errors.New("unknown xattr") ErrInvalidXattrVal = errors.New("invalid xattr value") ErrInvalidPath = errors.New("invalid path") ErrTryAgain = errors.New("try again") ErrInvalidState = errors.New("invalid state") ErrDirty = errors.New("dirty") ErrNotDirty = errors.New("not dirty") ErrSnapshotStuck = errors.New("snapshot stuck") ErrNotCASNode = errors.New("not cas node") ErrInvalidSession = errors.New("invalid session") ErrSessionAlreadyExists = errors.New("session already exists") )
View Source
var ( ErrInvalid = os.ErrInvalid ErrNotExist = os.ErrNotExist )
Want to return os errors from these functions
View Source
var ContextKey = &contextKeyType{}
ContextKey the context key is used by the fuse implementations to send caller data through the context
Functions ¶
func DentryHash ¶
func RenameDentries ¶
func RenameDentries(oldEntry, newEntry Dentry)
Types ¶
type API ¶
type API interface {
Type(inode Inode) cas.FileMode
// Check if the path has been modified locally and not committed to the store
Dirty(inode Inode) (bool, error)
// DirList get a directory listing hash
DirList(ctx context.Context, inode Inode) (hash.Hash, error)
// Loaded check if the content at the path has been loaded locally
Loaded(inode Inode) (bool, error)
// Excluded check if the path is excluded from parent's hash calculation
Excluded(inode Inode) (bool, error)
// SetExcluded sets the excluded attribute
SetExcluded(inode Inode, val bool) error
// Hash if dirty the contents are stored to the store with a new hash value
Hash(ctx context.Context, inode Inode) (hash.Hash, error)
// SetHash set the hash of the path, only valid if the path is not yet loaded.
SetHash(inode Inode, hash hash.Hash) error
// HashStat get the hash,mode, and size of the path
HashStat(ctx context.Context, inode Inode) (*fs.HashStat, error)
// HashSet get the hash,size of a file at the given path.
HashSize(ctx context.Context, inode Inode) (hash.Hash, int64, error)
// SetHashSize set the hash,size for a file at the given path, only valid if the path
// is not yet loaded.
SetHashSize(inode Inode, hash hash.Hash, size int64) error
// SetDeepTree set the deep tree hash for the given directory path, only valid if
// the path is not yet loaded. After setting the deep tree hash all children
// nodes can answer Stat() call without accessing the backend.
SetDeepTree(inode Inode, hash hash.Hash) error
// Debug get the debug attribute of the path.
Debug(inode Inode) (bool, error)
// SetDebug set dynamic debug for the given path
SetDebug(inode Inode, val bool) error
// Create control directory under path
CreateControl(ctx context.Context, inode Inode, directory string) error
// Create a non-cas ramfs type directory under the input path
CreateRamfs(ctx context.Context, inode Inode, directory string) error
// Create GIT project under given path
CreateGit(ctx context.Context, inode Inode, directory, head string) error
// Create GIT objects only under the given path
CreateGitObjects(ctx context.Context, inode Inode, directory string) error
// Status of FS
Status() (*fs.Status, error)
}
Provide an internal CASFS API corresponding to the cas fs api using the internal inodes instead of paths
type ContextValue ¶
type ContextValue struct {
Pid uint32
}
type Dcache ¶
type Dcache interface {
Add(d Dentry) error
Create(dir Dentry, name string) Dentry
Lookup(dir Dentry, name string) Dentry
Remove(d Dentry)
Rename(oldEntry, newEntry Dentry)
Path(d Dentry) string
NotifyChange(d Dentry)
RegisterWatch(DcacheWatch)
}
func CreateDcache ¶
func CreateDcache() Dcache
type DcacheWatch ¶
type DcacheWatch interface {
Change(Dentry)
}
type Dentry ¶
type Dentry interface {
Name() string
Parent() Dentry
Path() string
Instantiate(inode Inode)
IsHashed() bool
Inode() Inode
Get()
Put()
Ext() any
SetExt(any)
Dcache() Dcache
}
func CreateFile ¶
func CreateTmpFile ¶
func LookupNegative ¶
func LookupPositive ¶
type Dir ¶
type Dir interface {
Inode
Entries(ctx context.Context) (map[string]Inode, error)
Lookup(ctx context.Context, dentry Dentry) (Inode, error)
Mkdir(ctx context.Context, dentry Dentry, perm cas.FileMode) (Inode, error)
Remove(ctx context.Context, dentry Dentry) error
CreateTmpFile(ctx context.Context, dentry Dentry, mode cas.FileMode) (Inode, error)
CreateFile(ctx context.Context, dentry Dentry, mode cas.FileMode) (Inode, error)
Symlink(ctx context.Context, dentry Dentry, target string) (Inode, error)
Rename(ctx context.Context, oldDentry Dentry, newDirInode Inode, newDentry Dentry) error
Mknod(ctx context.Context, dentry Dentry, mode cas.FileMode, rDev int) (Inode, error)
Link(ctx context.Context, source Dentry, dentry Dentry) (Inode, error)
}
Dir directory interface
type File ¶
type File interface {
Inode
SetAttr(ctx context.Context, dentry Dentry, size *int64, atime, mtime *time.Time, mode *cas.FileMode)
Open(ctx context.Context, dentry Dentry, truncate, readOnly bool) error
Close() error
Fsync(ctx context.Context) error
ReadAt(p []byte, off int64) (int, error)
WriteAt(p []byte, off int64) (int, error)
Release(ctx context.Context) error
Flush(ctx context.Context) error
Fallocate(ctx context.Context, mode int, offset, len int64) error
Lseek(ctx context.Context, offset int64, whence uint32) (int64, error)
Poll(ctx context.Context) (bool, bool)
}
File interface
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
Provide cas.FileInfo interface
type Inode ¶
type Inode interface {
Mode() cas.FileMode
Attr(ctx context.Context, dentry Dentry) *NodeAttr
Ino() uint64
Size() int64
CanCache() bool
FS() FS
}
Inode interface for all supported nodes
Click to show internal directories.
Click to hide internal directories.