Documentation
¶
Index ¶
- Constants
- Variables
- type Attr
- type CreateRequest
- type DirEntry
- type Error
- type FileHandle
- type FileSystem
- func (fs *FileSystem) CloseObject(oid *daos.ObjectID)
- func (fs *FileSystem) DeclareObject(oid *daos.ObjectID, oc daos.OClassID) (*LockableObjectHandle, error)
- func (fs *FileSystem) DeclareObjectEpoch(oid *daos.ObjectID, epoch daos.Epoch, oc daos.OClassID) (*LockableObjectHandle, error)
- func (fs *FileSystem) Device() uint32
- func (fs *FileSystem) DiscardEpoch(e daos.Epoch) error
- func (fs *FileSystem) Fini() error
- func (fs *FileSystem) GetNode(oid *daos.ObjectID, epoch *daos.Epoch) (*Node, error)
- func (fs *FileSystem) GetReadEpoch() daos.Epoch
- func (fs *FileSystem) GetWriteEpoch() (daos.Epoch, error)
- func (fs *FileSystem) GetWriteTransaction() (*WriteTransaction, error)
- func (fs *FileSystem) OpenObject(oid *daos.ObjectID) (*LockableObjectHandle, error)
- func (fs *FileSystem) OpenObjectEpoch(oid *daos.ObjectID, epoch daos.Epoch) (*LockableObjectHandle, error)
- func (fs *FileSystem) ReleaseEpoch(e daos.Epoch) error
- func (fs *FileSystem) Root() *Node
- type LockableObjectHandle
- type MkdirRequest
- type Node
- func (n *Node) Children() ([]*DirEntry, error)
- func (n *Node) Close() (err error)
- func (n *Node) Create(req *CreateRequest) (*Node, error)
- func (n *Node) Epoch() daos.Epoch
- func (n *Node) GetAttr() (*Attr, error)
- func (n *Node) GetSize() (int64, error)
- func (n *Node) Getxattr(name string) ([]byte, error)
- func (n *Node) Inode() uint64
- func (n *Node) IsOpen() bool
- func (n *Node) IsRoot() bool
- func (n *Node) IsSnapshot() bool
- func (n *Node) Listxattr() ([]string, error)
- func (n *Node) Lookup(name string) (*Node, error)
- func (n *Node) Mkdir(req *MkdirRequest) (*Node, error)
- func (n *Node) Open(flags uint32) error
- func (n *Node) Removexattr(name string) error
- func (n *Node) Rmdir(name string) error
- func (n *Node) SetAttr(attr *Attr, mask uint32) error
- func (n *Node) Setxattr(name string, value []byte, flags uint32) error
- func (n *Node) String() string
- func (n *Node) Type() os.FileMode
- func (n *Node) Unlink(name string) error
- type WriteTransaction
Constants ¶
const ( // WriteAttrMode indicates that Mode was set WriteAttrMode = 1 << iota // WriteAttrUID indicates that UID was set WriteAttrUID // WriteAttrGID indicates that GID was set WriteAttrGID // WriteAttrMtime indicates that Mtime was set WriteAttrMtime // WriteAttrAtime indicates that Atime was set WriteAttrAtime // WriteAttrSize indicates that Size was set WriteAttrSize // WriteAttrCtime indicates that Ctime was set WriteAttrCtime // WriteAttrAll indicates that all known fields were set WriteAttrAll = 0xFF )
const ( // OIDBatchSize is the number of OIDs to claim in a batch OIDBatchSize uint64 = 4096 // TODO: Figure out what makes sense here. )
Variables ¶
var ( // RootOID is the root of the filesystem RootOID = daos.ObjectIDInit(0, 0, 1, daos.ClassTinyRW) // MetaOID is the object where misc. filesystem metadata is stashed MetaOID = daos.ObjectIDInit(0, 1, 1, daos.ClassTinyRW) // HandleCacheSize is the max number of open object handles allowed // in cache HandleCacheSize = 1024 )
var ErrStrings map[Error]string = map[Error]string{ ErrNoXattr: "No attribute", }
ErrStrings are erorr messages for Daosfs errors
Functions ¶
This section is empty.
Types ¶
type Attr ¶
type Attr struct { Device uint32 Inode uint64 // fuse only handles a uint64 Mode os.FileMode Nlink uint64 Uid uint32 // nolint Gid uint32 // nolint Rdev uint64 Size int64 Blksize int64 Blocks int64 Atime time.Time Mtime time.Time Ctime time.Time }
Attr represents a Node's file attributes
type CreateRequest ¶
type CreateRequest struct { Uid uint32 // nolint Gid uint32 // nolint Flags uint32 Mode os.FileMode Name string }
CreateRequest contains the information needed to complete a create() request
type FileHandle ¶
type FileHandle struct { Flags uint32 // contains filtered or unexported fields }
FileHandle encapsulates functionality for performing file i/o
func NewReadHandle ¶
func NewReadHandle(node *Node, epoch *daos.Epoch, flags uint32) *FileHandle
NewReadHandle returns a *FileHandle for file reads at the given epoch
func NewReadWriteHandle ¶
func NewReadWriteHandle(node *Node, tx *WriteTransaction, flags uint32) *FileHandle
NewReadWriteHandle returns a *FileHandle for file writes with the given transaction and reads at that transaction's epoch.
func NewWriteHandle ¶
func NewWriteHandle(node *Node, tx *WriteTransaction, flags uint32) *FileHandle
NewWriteHandle returns a *FileHandle for file writes with the given transaction.
func (*FileHandle) CanRead ¶
func (fh *FileHandle) CanRead() bool
CanRead indicates whether or not the *FileHandle is in a state for reading data
func (*FileHandle) CanWrite ¶
func (fh *FileHandle) CanWrite() bool
CanWrite indicates whether or not the *FileHandle is in a state for writing data
func (*FileHandle) Close ¶
func (fh *FileHandle) Close() (err error)
Close completes the write transaction, if one exists
func (*FileHandle) Commit ¶
func (fh *FileHandle) Commit()
Commit commits the write transaction, if one exists
type FileSystem ¶
type FileSystem struct { Name string // contains filtered or unexported fields }
FileSystem provides a filesystem-like interface to DAOS
func NewFileSystem ¶
func NewFileSystem(group, pool, container string) (*FileSystem, error)
NewFileSystem connects to the given pool and creates a container for the given filesystem name
func (*FileSystem) CloseObject ¶
func (fs *FileSystem) CloseObject(oid *daos.ObjectID)
CloseObject removes the object handle from cache and closes it
func (*FileSystem) DeclareObject ¶
func (fs *FileSystem) DeclareObject(oid *daos.ObjectID, oc daos.OClassID) (*LockableObjectHandle, error)
DeclareObject first declares an object, then opens it and returns an open *daos.ObjectHandle for the given oid and current epoch
func (*FileSystem) DeclareObjectEpoch ¶
func (fs *FileSystem) DeclareObjectEpoch(oid *daos.ObjectID, epoch daos.Epoch, oc daos.OClassID) (*LockableObjectHandle, error)
DeclareObjectEpoch first declares an object, then opens it and returns an open *daos.ObjectHandle for the given oid and epoch
func (*FileSystem) Device ¶
func (fs *FileSystem) Device() uint32
Device returns a uint32 suitable for use as st_dev to identify the filesystem.
func (*FileSystem) DiscardEpoch ¶
func (fs *FileSystem) DiscardEpoch(e daos.Epoch) error
DiscardEpoch will discard any changes made at the given epoch and release it. Any other holders of that epoch will get an error if they attempt to commit their changes.
func (*FileSystem) GetReadEpoch ¶
func (fs *FileSystem) GetReadEpoch() daos.Epoch
GetReadEpoch always returns an epoch that is less than or equal to GHCE. As a result, reads at this epoch are guaranteed to be consistent, but may not contain the latest data.
func (*FileSystem) GetWriteEpoch ¶
func (fs *FileSystem) GetWriteEpoch() (daos.Epoch, error)
GetWriteEpoch returns an epoch that hasn't been committed yet as far as we know at this time. We can guarantee that the epoch won't be committed by this process until ReleaseEpoch() is called, but we can't guarantee that the epoch wasn't committed by another process.
func (*FileSystem) GetWriteTransaction ¶
func (fs *FileSystem) GetWriteTransaction() (*WriteTransaction, error)
GetWriteTransaction returns a transaction object which contains a writable epoch. It is intended to be used in a deferred function which will ensure that the epoch is discarded or committed when the enclosing function exits.
func (*FileSystem) OpenObject ¶
func (fs *FileSystem) OpenObject(oid *daos.ObjectID) (*LockableObjectHandle, error)
OpenObject returns an open *daos.ObjectHandle for the given oid and current epoch
func (*FileSystem) OpenObjectEpoch ¶
func (fs *FileSystem) OpenObjectEpoch(oid *daos.ObjectID, epoch daos.Epoch) (*LockableObjectHandle, error)
OpenObjectEpoch returns an open *daos.ObjectHandle for the given oid and epoch
func (*FileSystem) ReleaseEpoch ¶
func (fs *FileSystem) ReleaseEpoch(e daos.Epoch) error
ReleaseEpoch attempts to commit any changes at the given epoch -- in addition to any changes made at earlier epochs which have been fully released but have not yet been committed to DAOS. If the given epoch is the lowest or only held epoch known by this process, then the epoch will be committed immediately. Otherwise, the epoch will be committed when all lower epochs have been committed.
type LockableObjectHandle ¶
type LockableObjectHandle struct { sync.RWMutex daos.ObjectHandle }
LockableObjectHandle wraps a daos.ObjectHandle with a sync.RWMutex
func (*LockableObjectHandle) OH ¶
func (loh *LockableObjectHandle) OH() *daos.ObjectHandle
OH returns the wrapped *daos.ObjectHandle
type MkdirRequest ¶
MkdirRequest contains the information needed to complete a mkdir() request
type Node ¶
type Node struct { FileHandle *FileHandle Parent *Node Oid *daos.ObjectID Name string // contains filtered or unexported fields }
Node represents a file or directory stored in DAOS
func (*Node) Create ¶
func (n *Node) Create(req *CreateRequest) (*Node, error)
Create attempts to create a new child file
func (*Node) GetSize ¶
GetSize returns the current Size attribute FIXME: It would probably be better to make a more flexible version of GetAttr() to specify desired attributes by mask or whatever.
func (*Node) Getxattr ¶
Getxattr returns the value of the node's extended attribute for the given name
func (*Node) IsSnapshot ¶
IsSnapshot is true if the Node refers to snapshot version of a object
func (*Node) Lookup ¶
Lookup attempts to find the object associated with the name and returns a *daos.Node if found
func (*Node) Mkdir ¶
func (n *Node) Mkdir(req *MkdirRequest) (*Node, error)
Mkdir attempts to create a new child directory
func (*Node) Removexattr ¶
Removexattr removes a node's extended attribute for the given name
type WriteTransaction ¶
type WriteTransaction struct { Epoch daos.Epoch Error error // contains filtered or unexported fields }
WriteTransaction wraps a writable epoch with some transactional logic that will ensure the epoch is discarded or committed when used in a deferred function.
func (*WriteTransaction) Commit ¶
func (wt *WriteTransaction) Commit()
Commit sets the transaction's complete function to the supplied commit function.
func (*WriteTransaction) Complete ¶
func (wt *WriteTransaction) Complete() error
Complete triggers a call to the transaction's complete function.