daosfs

package
v0.0.0-...-26b8ccb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	// OIDBatchSize is the number of OIDs to claim in a batch
	OIDBatchSize uint64 = 4096 // TODO: Figure out what makes sense here.
)

Variables

View Source
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
)
View Source
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

func (*Attr) CMode

func (a *Attr) CMode() uint32

CMode converts the os.FileMode value into a C.mode_t suitable for use as st_mode in a C.struct_stat.

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 DirEntry

type DirEntry struct {
	Name string
	Oid  *daos.ObjectID
	Type os.FileMode
}

DirEntry holds information about the child of a directory Node

func (*DirEntry) Inode

func (entry *DirEntry) Inode() uint64

Inode returns lowest 64 bits of Oid

type Error

type Error int
const (
	ErrNoXattr Error = 1000 + iota
)

func (Error) Error

func (e Error) Error() string

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

func (*FileHandle) Read

func (fh *FileHandle) Read(offset, size int64, data []byte) (int64, error)

func (*FileHandle) Write

func (fh *FileHandle) Write(offset int64, data []byte) (int64, error)

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) Fini

func (fs *FileSystem) Fini() error

Fini shuts everything down

func (*FileSystem) GetNode

func (fs *FileSystem) GetNode(oid *daos.ObjectID, epoch *daos.Epoch) (*Node, error)

GetNode returns a *Node for the given ObjectID and Epoch

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.

func (*FileSystem) Root

func (fs *FileSystem) Root() *Node

Root returns the root node

type LockableObjectHandle

type LockableObjectHandle struct {
	sync.RWMutex
	daos.ObjectHandle
}

LockableObjectHandle wraps a daos.ObjectHandle with a sync.RWMutex

func (*LockableObjectHandle) OH

OH returns the wrapped *daos.ObjectHandle

type MkdirRequest

type MkdirRequest struct {
	Uid  uint32 // nolint
	Gid  uint32 // nolint
	Mode os.FileMode
	Name string
}

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) Children

func (n *Node) Children() ([]*DirEntry, error)

Children returns a slice of *DirEntry

func (*Node) Close

func (n *Node) Close() (err error)

Close closes the node's filehandle

func (*Node) Create

func (n *Node) Create(req *CreateRequest) (*Node, error)

Create attempts to create a new child file

func (*Node) Epoch

func (n *Node) Epoch() daos.Epoch

Epoch returns the node's read epoch; either a snapshot or HCE.

func (*Node) GetAttr

func (n *Node) GetAttr() (*Attr, error)

GetAttr retrieves the latest attributes for a node

func (*Node) GetSize

func (n *Node) GetSize() (int64, error)

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

func (n *Node) Getxattr(name string) ([]byte, error)

Getxattr returns the value of the node's extended attribute for the given name

func (*Node) Inode

func (n *Node) Inode() uint64

Inode returns the node's Inode representation

func (*Node) IsOpen

func (n *Node) IsOpen() bool

IsOpen indicates whether or not the node has been opened as a file

func (*Node) IsRoot

func (n *Node) IsRoot() bool

IsRoot indicates whether or not the node is the root node of the filesystem

func (*Node) IsSnapshot

func (n *Node) IsSnapshot() bool

IsSnapshot is true if the Node refers to snapshot version of a object

func (*Node) Listxattr

func (n *Node) Listxattr() ([]string, error)

Listxattr returns a slice of extended attribute names for the node

func (*Node) Lookup

func (n *Node) Lookup(name string) (*Node, error)

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) Open

func (n *Node) Open(flags uint32) error

Open creates a filehandle if the node is a regular file

func (*Node) Removexattr

func (n *Node) Removexattr(name string) error

Removexattr removes a node's extended attribute for the given name

func (*Node) Rmdir

func (n *Node) Rmdir(name string) error

Rmdir removes a directory

func (*Node) SetAttr

func (n *Node) SetAttr(attr *Attr, mask uint32) error

SetAttr sets attributes for a node

func (*Node) Setxattr

func (n *Node) Setxattr(name string, value []byte, flags uint32) error

Setxattr sets a node's extended attribute to the given value

func (*Node) String

func (n *Node) String() string

func (*Node) Type

func (n *Node) Type() os.FileMode

Type returns the node type (ModeDir, ModeSymlink, etc)

func (n *Node) Unlink(name string) error

Unlink removes a file

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL