Documentation ¶
Overview ¶
fs package implements fuse.RawFileSystem on top of the other modules of go-tfhfs project.
The low-level API is more or less mandatory as e.g. list of files from huge directory is not feasible to provide in one chunk, and we want to have fairly dynamic relationship with the tree.
fstest provides (raw) fuse filesystem code
Tests are mostly written with DummyUser module which provides ~os module functionality across the fuse APIs. This does NOT intentionally really mount the filesystem for obvious reasons.
(parallel testing, arbitrary permission simulation with nonroot user)
Index ¶
- Constants
- func BytesToNodeData(bd []byte) *ibtree.NodeData
- func IterateInoSubTypeKeys(t *ibtree.Transaction, ino uint64, bst BlockSubType, ...)
- func MergeTo3(tr *hugger.Transaction, src, dst *ibtree.Node, local bool)
- type BlockKey
- func NewBlockKey(ino uint64, st BlockSubType, data string) BlockKey
- func NewBlockKeyDirFilename(ino uint64, filename string) BlockKey
- func NewBlockKeyNameBlock(name, id string) BlockKey
- func NewBlockKeyNameEnd(name string) BlockKey
- func NewBlockKeyOffset(ino uint64, offset uint64) BlockKey
- func NewBlockKeyReverseDirFilename(ino, dirIno uint64, filename string) BlockKey
- type BlockSubType
- func (z *BlockSubType) DecodeMsg(dc *msgp.Reader) (err error)
- func (z BlockSubType) EncodeMsg(en *msgp.Writer) (err error)
- func (z BlockSubType) MarshalMsg(b []byte) (o []byte, err error)
- func (z BlockSubType) Msgsize() (s int)
- func (z *BlockSubType) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *BlockSubType) UnmarshalMsgWithCfg(bts []byte, cfg *msgp.RuntimeConfig) (o []byte, err error)
- type FSUser
- func (self *FSUser) Chmod(path string, mode os.FileMode) (err error)
- func (self *FSUser) Chown(path string, uid, gid int) (err error)
- func (self *FSUser) Chtimes(path string, atime time.Time, mtime time.Time) (err error)
- func (self *FSUser) GetXAttr(path, attr string) (b []byte, err error)
- func (self *FSUser) Link(oldpath, newpath string) (err error)
- func (self *FSUser) ListDir(name string) (ret []string, err error)
- func (self *FSUser) ListXAttr(path string) (s []string, err error)
- func (self *FSUser) Mkdir(path string, perm os.FileMode) (err error)
- func (self *FSUser) OpenFile(path string, flag uint32, perm uint32) (f *fsFile, err error)
- func (self *FSUser) ReadDir(dirname string) (ret []os.FileInfo, err error)
- func (self *FSUser) Readlink(path string) (s string, err error)
- func (self *FSUser) Remove(path string) (err error)
- func (self *FSUser) RemoveXAttr(path, attr string) (err error)
- func (self *FSUser) Rename(oldpath, newpath string) (err error)
- func (self *FSUser) SetXAttr(path, attr string, data []byte) (err error)
- func (self *FSUser) Stat(path string) (fi os.FileInfo, err error)
- func (self *FSUser) String() string
- func (self *FSUser) Symlink(oldpath, newpath string) (err error)
- type Fs
- func (self *Fs) AddFile(file *inodeFH)
- func (self *Fs) Close()
- func (self *Fs) CreateInode() *inode
- func (self *Fs) Flush()
- func (self *Fs) GetFileByFh(fh uint64) *inodeFH
- func (self *Fs) GetInode(ino uint64) *inode
- func (self *Fs) Init(fs *Fs)
- func (self *Fs) ListDir(ino uint64) (ret []string)
- func (self *Fs) RemoveFile(file *inodeFH)
- func (self *Fs) WithoutParallelWrites(cb func())
- type InodeMeta
- func (z *InodeMeta) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *InodeMeta) EncodeMsg(en *msgp.Writer) (err error)
- func (z *InodeMeta) MarshalMsg(b []byte) (o []byte, err error)
- func (z *InodeMeta) Msgsize() (s int)
- func (z *InodeMeta) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *InodeMeta) UnmarshalMsgWithCfg(bts []byte, cfg *msgp.RuntimeConfig) (o []byte, err error)
- type InodeMetaAtomicPointer
- type InodeMetaData
- func (z *InodeMetaData) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *InodeMetaData) EncodeMsg(en *msgp.Writer) (err error)
- func (self *InodeMetaData) IsDir() bool
- func (z *InodeMetaData) MarshalMsg(b []byte) (o []byte, err error)
- func (z *InodeMetaData) Msgsize() (s int)
- func (self *InodeMetaData) SetATimeNow()
- func (self *InodeMetaData) SetCTimeNow()
- func (self *InodeMetaData) SetCreateIn(input *fuse.CreateIn)
- func (self *InodeMetaData) SetMTimeNow()
- func (self *InodeMetaData) SetMkdirIn(input *fuse.MkdirIn)
- func (self *InodeMetaData) SetMknodIn(input *fuse.MknodIn)
- func (z *InodeMetaData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *InodeMetaData) UnmarshalMsgWithCfg(bts []byte, cfg *msgp.RuntimeConfig) (o []byte, err error)
Constants ¶
const ( // MV_NEW indicates the preference in src->dst tree delta MV_NEW mergeVerdict = iota // MV_EXISTING indicates the preference of status quo MV_EXISTING // MV_NONE indicates preference for getting rid of ALL data // for particular inode. MV_NONE )
const (
BDT_EXTENT ibtree.BlockDataType = 0x42
)
const EmbeddedSize = 1024
Variables ¶
This section is empty.
Functions ¶
func BytesToNodeData ¶
func IterateInoSubTypeKeys ¶
func IterateInoSubTypeKeys(t *ibtree.Transaction, ino uint64, bst BlockSubType, keycb func(key BlockKey) bool)
func MergeTo3 ¶
func MergeTo3(tr *hugger.Transaction, src, dst *ibtree.Node, local bool)
MergeTo3 performs 3-way merge. It iterates changes in orig -> new, and then compares them with the current state in the tree that is handed in as the Transaction. If local is set, all changes are assumed to be dealt with on per-leaf node difference basis. Otherwise metadata of the particular inode is used to determine which version of the truth is preferrable.
Types ¶
type BlockKey ¶
type BlockKey string
func NewBlockKey ¶
func NewBlockKey(ino uint64, st BlockSubType, data string) BlockKey
func NewBlockKeyDirFilename ¶
func NewBlockKeyNameBlock ¶
func NewBlockKeyNameEnd ¶
func NewBlockKeyOffset ¶
func (BlockKey) SubType ¶
func (self BlockKey) SubType() BlockSubType
func (BlockKey) SubTypeData ¶
type BlockSubType ¶
type BlockSubType byte
const ( // should not occur in real world // (can be used as end-of-range marker given ino+1 + this OST) BST_NONE BlockSubType = 0 // value: InodeMeta BST_META BlockSubType = 1 // key: k (string->bytes), value: data (bytes) BST_XATTR BlockSubType = 2 // key: fnvhash.name, value: 8 byte inode BST_DIR_NAME2INODE BlockSubType = 0x10 // key: inode (dir it is in) . filename BST_FILE_INODEFILENAME BlockSubType = 0x20 // key: 8 byte offset, value: data block id (for data @ offset) BST_FILE_OFFSET2EXTENT BlockSubType = 0x21 // should not occur in real world // (can be used as end-of-range marker) BST_LAST = 0x2f BST_NAMEHASH_NAME_BLOCK BlockSubType = 0x30 )
func (*BlockSubType) DecodeMsg ¶
func (z *BlockSubType) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable We treat empty fields as if we read a Nil from the wire.
func (BlockSubType) EncodeMsg ¶
func (z BlockSubType) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (BlockSubType) MarshalMsg ¶
func (z BlockSubType) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (BlockSubType) Msgsize ¶
func (z BlockSubType) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BlockSubType) UnmarshalMsg ¶
func (z *BlockSubType) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
func (*BlockSubType) UnmarshalMsgWithCfg ¶
func (z *BlockSubType) UnmarshalMsgWithCfg(bts []byte, cfg *msgp.RuntimeConfig) (o []byte, err error)
type FSUser ¶
func (*FSUser) RemoveXAttr ¶
type Fs ¶
func (*Fs) CreateInode ¶
func (self *Fs) CreateInode() *inode
func (*Fs) GetFileByFh ¶
func (self *Fs) GetFileByFh(fh uint64) *inodeFH
func (*Fs) ListDir ¶
ListDir provides testing utility as output of ReadDir/ReadDirPlus is binary garbage and I am too lazy to write a decoder for it.
func (*Fs) RemoveFile ¶
func (self *Fs) RemoveFile(file *inodeFH)
func (*Fs) WithoutParallelWrites ¶
func (self *Fs) WithoutParallelWrites(cb func())
WithoutParallelWrites ensures the data being read is entirely consistent. This means that there is no locks on filehandles, and that all pending data has been written to Storage (which will persist it eventually).
type InodeMeta ¶
type InodeMeta struct { InodeMetaData Data []byte `zid:"10"` }
func (*InodeMeta) DecodeMsg ¶
DecodeMsg implements msgp.Decodable We treat empty fields as if we read a Nil from the wire.
func (*InodeMeta) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*InodeMeta) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*InodeMeta) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
func (*InodeMeta) UnmarshalMsgWithCfg ¶
type InodeMetaAtomicPointer ¶
type InodeMetaAtomicPointer struct {
// contains filtered or unexported fields
}
InodeMetaAtomicPointer provides typesafe access to type
func (*InodeMetaAtomicPointer) Get ¶
func (self *InodeMetaAtomicPointer) Get() *InodeMeta
func (*InodeMetaAtomicPointer) Set ¶
func (self *InodeMetaAtomicPointer) Set(value *InodeMeta)
func (*InodeMetaAtomicPointer) SetIfEqualTo ¶
func (self *InodeMetaAtomicPointer) SetIfEqualTo(newAtomicPointer, oldAtomicPointer *InodeMeta) bool
type InodeMetaData ¶
type InodeMetaData struct { // int64 st_ino = 1; // ^ part of key, not data StMode uint32 `zid:"0"` StRdev uint32 `zid:"1"` StUid uint32 `zid:"2"` StGid uint32 `zid:"3"` StAtimeNs uint64 `zid:"4"` StCtimeNs uint64 `zid:"5"` StMtimeNs uint64 `zid:"6"` StSize uint64 `zid:"7"` StNlink uint32 `zid:"8"` // What is ino of our parent (directory-only) ParentIno uint64 `zid:"9"` }
func (*InodeMetaData) DecodeMsg ¶
func (z *InodeMetaData) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable We treat empty fields as if we read a Nil from the wire.
func (*InodeMetaData) EncodeMsg ¶
func (z *InodeMetaData) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*InodeMetaData) IsDir ¶
func (self *InodeMetaData) IsDir() bool
func (*InodeMetaData) MarshalMsg ¶
func (z *InodeMetaData) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*InodeMetaData) Msgsize ¶
func (z *InodeMetaData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*InodeMetaData) SetATimeNow ¶
func (self *InodeMetaData) SetATimeNow()
func (*InodeMetaData) SetCTimeNow ¶
func (self *InodeMetaData) SetCTimeNow()
func (*InodeMetaData) SetCreateIn ¶
func (self *InodeMetaData) SetCreateIn(input *fuse.CreateIn)
func (*InodeMetaData) SetMTimeNow ¶
func (self *InodeMetaData) SetMTimeNow()
func (*InodeMetaData) SetMkdirIn ¶
func (self *InodeMetaData) SetMkdirIn(input *fuse.MkdirIn)
func (*InodeMetaData) SetMknodIn ¶
func (self *InodeMetaData) SetMknodIn(input *fuse.MknodIn)
func (*InodeMetaData) UnmarshalMsg ¶
func (z *InodeMetaData) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
func (*InodeMetaData) UnmarshalMsgWithCfg ¶
func (z *InodeMetaData) UnmarshalMsgWithCfg(bts []byte, cfg *msgp.RuntimeConfig) (o []byte, err error)