cephfs

package
Version: v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 11 Imported by: 4

Documentation

Overview

Package cephfs contains a set of wrappers around Ceph's libcephfs API.

Index

Constants

View Source
const (
	// DTypeBlk indicates a directory entry is a block device.
	DTypeBlk = DType(C.DT_BLK)
	// DTypeChr indicates a directory entry is a character device.
	DTypeChr = DType(C.DT_CHR)
	// DTypeDir indicates a directory entry is a directory.
	DTypeDir = DType(C.DT_DIR)
	// DTypeFIFO indicates a directory entry is a named pipe (FIFO).
	DTypeFIFO = DType(C.DT_FIFO)
	// DTypeLnk indicates a directory entry is a symbolic link.
	DTypeLnk = DType(C.DT_LNK)
	// DTypeReg indicates a directory entry is a regular file.
	DTypeReg = DType(C.DT_REG)
	// DTypeSock indicates a directory entry is a UNIX domain socket.
	DTypeSock = DType(C.DT_SOCK)
	// DTypeUnknown indicates that the file type could not be determined.
	DTypeUnknown = DType(C.DT_UNKNOWN)
)
View Source
const (
	// SeekSet is used with Seek to set the absolute position in the file.
	SeekSet = int(C.SEEK_SET)
	// SeekCur is used with Seek to position the file relative to the current
	// position.
	SeekCur = int(C.SEEK_CUR)
	// SeekEnd is used with Seek to position the file relative to the end.
	SeekEnd = int(C.SEEK_END)
)
View Source
const (
	// SyncAll will synchronize both data and metadata.
	SyncAll = SyncChoice(0)
	// SyncDataOnly will synchronize only data.
	SyncDataOnly = SyncChoice(1)
)
View Source
const (
	// FallocNoFlag means default option.
	FallocNoFlag = FallocFlags(0)
	// FallocFlKeepSize specifies that the file size will not be changed.
	FallocFlKeepSize = FallocFlags(C.FALLOC_FL_KEEP_SIZE)
	// FallocFlPunchHole specifies that the operation is to deallocate
	// space and zero the byte range.
	FallocFlPunchHole = FallocFlags(C.FALLOC_FL_PUNCH_HOLE)
)
View Source
const (
	// LockSH places a shared lock.
	// More than one process may hold a shared lock for a given file at a given time.
	LockSH = LockOp(C.LOCK_SH)
	// LockEX places an exclusive lock.
	// Only one process may hold an exclusive lock for a given file at a given time.
	LockEX = LockOp(C.LOCK_EX)
	// LockUN removes an existing lock held by this process.
	LockUN = LockOp(C.LOCK_UN)
	// LockNB can be ORed with any of the above to make a nonblocking call.
	LockNB = LockOp(C.LOCK_NB)
)
View Source
const (
	// XattrDefault specifies that set-xattr calls use the default behavior of
	// creating or updating an xattr.
	XattrDefault = XattrFlags(0)
	// XattrCreate specifies that set-xattr calls only set new xattrs.
	XattrCreate = XattrFlags(C.XATTR_CREATE)
	// XattrReplace specifies that set-xattr calls only replace existing xattr
	// values.
	XattrReplace = XattrFlags(C.XATTR_REPLACE)
)
View Source
const (
	// StatxMode requests the mode value be filled in.
	StatxMode = StatxMask(C.CEPH_STATX_MODE)
	// StatxNlink requests the nlink value be filled in.
	StatxNlink = StatxMask(C.CEPH_STATX_NLINK)
	// StatxUid requests the uid value be filled in.
	StatxUid = StatxMask(C.CEPH_STATX_UID)
	// StatxRdev requests the rdev value be filled in.
	StatxRdev = StatxMask(C.CEPH_STATX_RDEV)
	// StatxAtime requests the access-time value be filled in.
	StatxAtime = StatxMask(C.CEPH_STATX_ATIME)
	// StatxMtime requests the modified-time value be filled in.
	StatxMtime = StatxMask(C.CEPH_STATX_MTIME)
	// StatxIno requests the inode be filled in.
	StatxIno = StatxMask(C.CEPH_STATX_INO)
	// StatxSize requests the size value be filled in.
	StatxSize = StatxMask(C.CEPH_STATX_SIZE)
	// StatxBlocks requests the blocks value be filled in.
	StatxBlocks = StatxMask(C.CEPH_STATX_BLOCKS)
	// StatxBasicStats requests all the fields that are part of a
	// traditional stat call.
	StatxBasicStats = StatxMask(C.CEPH_STATX_BASIC_STATS)
	// StatxBtime requests the birth-time value be filled in.
	StatxBtime = StatxMask(C.CEPH_STATX_BTIME)
	// StatxVersion requests the version value be filled in.
	StatxVersion = StatxMask(C.CEPH_STATX_VERSION)
	// StatxAllStats requests all known stat values be filled in.
	StatxAllStats = StatxMask(C.CEPH_STATX_ALL_STATS)
)
View Source
const (
	// AtStatxDontSync requests that the stat call only fetch locally-cached
	// values if possible, avoiding round trips to a back-end server.
	AtStatxDontSync = AtFlags(C.AT_STATX_DONT_SYNC)
	// AtNoAttrSync requests that the stat call only fetch locally-cached
	// values if possible, avoiding round trips to a back-end server.
	//
	// Deprecated: replaced by AtStatxDontSync
	AtNoAttrSync = AtStatxDontSync
	// AtSymlinkNofollow indicates the call should not follow symlinks
	// but operate on the symlink itself.
	AtSymlinkNofollow = AtFlags(C.AT_SYMLINK_NOFOLLOW)
)
View Source
const (
	// ErrNotConnected may be returned when client is not connected
	// to a cluster.
	ErrNotConnected = cephFSError(-C.ENOTCONN)
)

Variables

View Source
var (
	// ErrEmptyArgument may be returned if a function argument is passed
	// a zero-length slice or map.
	ErrEmptyArgument = errors.New("Argument must contain at least one item")
)

Functions

func Version added in v0.12.0

func Version() (int, int, int)

Version returns the major, minor, and patch level of the libcephfs library.

Types

type AtFlags added in v0.4.0

type AtFlags uint

AtFlags represent flags to be passed to calls that control how files are used or referenced. For example, not following symlinks.

type CephStatVFS added in v0.5.0

type CephStatVFS struct {
	// Bsize reports the file system's block size.
	Bsize int64
	// Fragment reports the file system's fragment size.
	Frsize int64
	// Blocks reports the number of blocks in the file system.
	Blocks uint64
	// Bfree reports the number of free blocks.
	Bfree uint64
	// Bavail reports the number of free blocks for unprivileged users.
	Bavail uint64
	// Files reports the number of inodes in the file system.
	Files uint64
	// Ffree reports the number of free indoes.
	Ffree uint64
	// Favail reports the number of free indoes for unprivileged users.
	Favail uint64
	// Fsid reports the file system ID number.
	Fsid int64
	// Flag reports the file system mount flags.
	Flag int64
	// Namemax reports the maximum file name length.
	Namemax int64
}

CephStatVFS instances are returned from the StatFS call. It reports file-system wide statistics.

type CephStatx added in v0.4.0

type CephStatx struct {
	// Mask is a bitmask indicating what fields have been set.
	Mask StatxMask
	// Blksize represents the file system's block size.
	Blksize uint32
	// Nlink is the number of links for the file.
	Nlink uint32
	// Uid (user id) value for the file.
	Uid uint32
	// Gid (group id) value for the file.
	Gid uint32
	// Mode is the file's type and mode value.
	Mode uint16
	// Inode value for the file.
	Inode Inode
	// Size of the file in bytes.
	Size uint64
	// Blocks indicates the number of blocks allocated to the file.
	Blocks uint64
	// Dev describes the device containing this file system.
	Dev uint64
	// Rdev describes the device of this file, if the file is a device.
	Rdev uint64
	// Atime is the access time of this file.
	Atime Timespec
	// Ctime is the status change time of this file.
	Ctime Timespec
	// Mtime is the modification time of this file.
	Mtime Timespec
	// Btime is the creation (birth) time of this file.
	Btime Timespec
	// Version value for the file.
	Version uint64
}

CephStatx instances are returned by extended stat (statx) calls. Note that CephStatx results are similar to but not identical to (Linux) system statx results.

type DType added in v0.4.0

type DType uint8

DType values are used to determine, when possible, the file type of a directory entry.

type DirEntry added in v0.3.0

type DirEntry struct {
	// contains filtered or unexported fields
}

DirEntry represents an entry within a directory.

func (*DirEntry) DType added in v0.4.0

func (d *DirEntry) DType() DType

DType returns the Directory-entry's Type, indicating if it is a regular file, directory, etc. DType may be unknown and thus require an additional call (stat for example) if Unknown.

func (*DirEntry) Inode added in v0.3.0

func (d *DirEntry) Inode() Inode

Inode returns the directory entry's inode number.

func (*DirEntry) Name added in v0.3.0

func (d *DirEntry) Name() string

Name returns the directory entry's name.

type DirEntryPlus added in v0.4.0

type DirEntryPlus struct {
	DirEntry
	// contains filtered or unexported fields
}

DirEntryPlus is a DirEntry plus additional data (stat) for an entry within a directory.

func (*DirEntryPlus) Statx added in v0.4.0

func (d *DirEntryPlus) Statx() *CephStatx

Statx returns cached stat metadata for the directory entry. This call does not incur an actual file system stat.

type Directory added in v0.3.0

type Directory struct {
	// contains filtered or unexported fields
}

Directory represents an open directory handle.

func (*Directory) Close added in v0.3.0

func (dir *Directory) Close() error

Close the open directory handle.

Implements:

int ceph_closedir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp);

func (*Directory) ReadDir added in v0.3.0

func (dir *Directory) ReadDir() (*DirEntry, error)

ReadDir reads a single directory entry from the open Directory. A nil DirEntry pointer will be returned when the Directory stream has been exhausted.

Implements:

int ceph_readdir_r(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, struct dirent *de);

func (*Directory) ReadDirPlus added in v0.4.0

func (dir *Directory) ReadDirPlus(
	want StatxMask, flags AtFlags) (*DirEntryPlus, error)

ReadDirPlus reads a single directory entry and stat information from the open Directory. A nil DirEntryPlus pointer will be returned when the Directory stream has been exhausted. See Statx for a description of the wants and flags parameters.

Implements:

int ceph_readdirplus_r(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, struct dirent *de,
                       struct ceph_statx *stx, unsigned want, unsigned flags, struct Inode **out);

func (*Directory) RewindDir added in v0.3.0

func (dir *Directory) RewindDir()

RewindDir sets the directory stream to the beginning of the directory.

Implements:

void ceph_rewinddir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp);

type FallocFlags added in v0.4.0

type FallocFlags int

FallocFlags represent flags which determine the operation to be performed on the given range. CephFS supports only following two flags.

type File added in v0.4.0

type File struct {
	// contains filtered or unexported fields
}

File represents an open file descriptor in cephfs.

func (*File) Close added in v0.4.0

func (f *File) Close() error

Close the file.

Implements:

int ceph_close(struct ceph_mount_info *cmount, int fd);

func (*File) Fallocate added in v0.4.0

func (f *File) Fallocate(mode FallocFlags, offset, length int64) error

Fallocate preallocates or releases disk space for the file for the given byte range, the flags determine the operation to be performed on the given range.

Implements:

int ceph_fallocate(struct ceph_mount_info *cmount, int fd, int mode,
							  int64_t offset, int64_t length);

func (*File) Fchmod added in v0.4.0

func (f *File) Fchmod(mode uint32) error

Fchmod changes the mode bits (permissions) of a file.

Implements:

int ceph_fchmod(struct ceph_mount_info *cmount, int fd, mode_t mode);

func (*File) Fchown added in v0.4.0

func (f *File) Fchown(user uint32, group uint32) error

Fchown changes the ownership of a file.

Implements:

int ceph_fchown(struct ceph_mount_info *cmount, int fd, int uid, int gid);

func (*File) Flock added in v0.4.0

func (f *File) Flock(operation LockOp, owner uint64) error

Flock applies or removes an advisory lock on an open file. Param owner is the user-supplied identifier for the owner of the lock, must be an arbitrary integer.

Implements:

int ceph_flock(struct ceph_mount_info *cmount, int fd, int operation, uint64_t owner);

func (*File) Fstatx added in v0.4.0

func (f *File) Fstatx(want StatxMask, flags AtFlags) (*CephStatx, error)

Fstatx returns information about an open file.

Implements:

int ceph_fstatx(struct ceph_mount_info *cmount, int fd, struct ceph_statx *stx,
                unsigned int want, unsigned int flags);

func (*File) Fsync added in v0.4.0

func (f *File) Fsync(sync SyncChoice) error

Fsync ensures the file content that may be cached is committed to stable storage. Pass SyncAll to have this call behave like standard fsync and synchronize all data and metadata. Pass SyncDataOnly to have this call behave more like fdatasync (on linux).

Implements:

int ceph_fsync(struct ceph_mount_info *cmount, int fd, int syncdataonly);

func (*File) GetXattr added in v0.5.0

func (f *File) GetXattr(name string) ([]byte, error)

GetXattr gets an extended attribute from the open file.

Implements:

int ceph_fgetxattr(struct ceph_mount_info *cmount, int fd, const char *name,
                   void *value, size_t size);

func (*File) ListXattr added in v0.5.0

func (f *File) ListXattr() ([]string, error)

ListXattr returns a slice containing strings for the name of each xattr set on the file.

Implements:

int ceph_flistxattr(struct ceph_mount_info *cmount, int fd, char *list, size_t size);

func (*File) Preadv added in v0.6.0

func (f *File) Preadv(data [][]byte, offset int64) (int, error)

Preadv will read data from the file, starting at the given offset, into the byte-slice data buffers sequentially. The number of bytes read will be returned. When nothing is left to read from the file the return values will be: 0, io.EOF.

Implements:

int ceph_preadv(struct ceph_mount_info *cmount, int fd, const struct iovec *iov, int iovcnt,
                int64_t offset);

func (*File) Pwritev added in v0.6.0

func (f *File) Pwritev(data [][]byte, offset int64) (int, error)

Pwritev writes data from the slice of byte-slice buffers to the file at the specified offset. The number of bytes written is returned.

Implements:

int ceph_pwritev(struct ceph_mount_info *cmount, int fd, const struct iovec *iov, int iovcnt,
                 int64_t offset);

func (*File) Read added in v0.4.0

func (f *File) Read(buf []byte) (int, error)

Read data from file. Up to len(buf) bytes will be read from the file. The number of bytes read will be returned. When nothing is left to read from the file, Read returns, 0, io.EOF.

func (*File) ReadAt added in v0.4.0

func (f *File) ReadAt(buf []byte, offset int64) (int, error)

ReadAt will read data from the file starting at the given offset. Up to len(buf) bytes will be read from the file. The number of bytes read will be returned. When nothing is left to read from the file, ReadAt returns, 0, io.EOF.

func (*File) RemoveXattr added in v0.5.0

func (f *File) RemoveXattr(name string) error

RemoveXattr removes the named xattr from the open file.

Implements:

int ceph_fremovexattr(struct ceph_mount_info *cmount, int fd, const char *name);

func (*File) Seek added in v0.4.0

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek will reposition the file stream based on the given offset.

Implements:

int64_t ceph_lseek(struct ceph_mount_info *cmount, int fd, int64_t offset, int whence);

func (*File) SetXattr added in v0.5.0

func (f *File) SetXattr(name string, value []byte, flags XattrFlags) error

SetXattr sets an extended attribute on the open file.

NOTE: Attempting to set an xattr value with an empty value may cause the xattr to be unset on some older versions of ceph. Please refer to https://tracker.ceph.com/issues/46084

Implements:

int ceph_fsetxattr(struct ceph_mount_info *cmount, int fd, const char *name,
                   const void *value, size_t size, int flags);

func (*File) Sync added in v0.4.0

func (f *File) Sync() error

Sync ensures the file content that may be cached is committed to stable storage. Sync behaves like Go's os package File.Sync function.

func (*File) Truncate added in v0.7.0

func (f *File) Truncate(size int64) error

Truncate sets the size of the open file. NOTE: In some versions of ceph a bug exists where calling ftruncate on a file open for read-only is permitted. The go-ceph wrapper does no additional checking and will inherit the issue on affected versions of ceph. Please refer to the following issue for details: https://tracker.ceph.com/issues/48202

Implements:

int ceph_ftruncate(struct ceph_mount_info *cmount, int fd, int64_t size);

func (*File) Write added in v0.4.0

func (f *File) Write(buf []byte) (int, error)

Write data from buf to the file. The number of bytes written is returned.

func (*File) WriteAt added in v0.4.0

func (f *File) WriteAt(buf []byte, offset int64) (int, error)

WriteAt writes data from buf to the file at the specified offset. The number of bytes written is returned.

type Inode added in v0.3.0

type Inode uint64

Inode represents an inode number in the file system.

type LockOp added in v0.4.0

type LockOp int

LockOp determines operations/type of locks which can be applied on a file.

type MountInfo

type MountInfo struct {
	// contains filtered or unexported fields
}

MountInfo exports ceph's ceph_mount_info from libcephfs.cc

func CreateFromRados

func CreateFromRados(conn *rados.Conn) (*MountInfo, error)

CreateFromRados creates a mount handle using an existing rados cluster connection.

Implements:

int ceph_create_from_rados(struct ceph_mount_info **cmount, rados_t cluster);

func CreateMount

func CreateMount() (*MountInfo, error)

CreateMount creates a mount handle for interacting with Ceph.

func CreateMountWithId

func CreateMountWithId(id string) (*MountInfo, error)

CreateMountWithId creates a mount handle for interacting with Ceph. The caller can specify a unique id that will identify this client.

func (*MountInfo) ChangeDir

func (mount *MountInfo) ChangeDir(path string) error

ChangeDir changes the current working directory.

func (*MountInfo) Chmod

func (mount *MountInfo) Chmod(path string, mode uint32) error

Chmod changes the mode bits (permissions) of a file/directory.

func (*MountInfo) Chown

func (mount *MountInfo) Chown(path string, user uint32, group uint32) error

Chown changes the ownership of a file/directory.

func (*MountInfo) CurrentDir

func (mount *MountInfo) CurrentDir() string

CurrentDir gets the current working directory.

func (*MountInfo) GetConfigOption added in v0.3.0

func (mount *MountInfo) GetConfigOption(option string) (string, error)

GetConfigOption returns the value of the Ceph configuration option identified by the given name.

Implements:

int ceph_conf_get(struct ceph_mount_info *cmount, const char *option, char *buf, size_t len);

func (*MountInfo) GetFsCid added in v0.3.0

func (mount *MountInfo) GetFsCid() (int64, error)

GetFsCid returns the cluster ID for a mounted ceph file system. If the object does not refer to a mounted file system, an error will be returned.

Note:

Only supported in Ceph Nautilus and newer.

Implements:

int64_t ceph_get_fs_cid(struct ceph_mount_info *cmount);

func (*MountInfo) GetXattr added in v0.5.0

func (mount *MountInfo) GetXattr(path, name string) ([]byte, error)

GetXattr gets an extended attribute from the file at the supplied path.

Implements:

int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
                  void *value, size_t size);

func (*MountInfo) Init added in v0.4.0

func (mount *MountInfo) Init() error

Init the file system client without actually mounting the file system.

Implements:

int ceph_init(struct ceph_mount_info *cmount);

func (*MountInfo) IsMounted

func (mount *MountInfo) IsMounted() bool

IsMounted checks mount status.

func (*MountInfo) Lchown added in v0.10.0

func (mount *MountInfo) Lchown(path string, user uint32, group uint32) error

Lchown changes the ownership of a file/directory/etc without following symbolic links

func (*MountInfo) LgetXattr added in v0.5.0

func (mount *MountInfo) LgetXattr(path, name string) ([]byte, error)

LgetXattr gets an extended attribute from the file at the supplied path.

Implements:

int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
                  void *value, size_t size);
func (mount *MountInfo) Link(oldname, newname string) error

Link creates a new link to an existing file.

Implements:

int ceph_link (struct ceph_mount_info *cmount, const char *existing, const char *newname);

func (*MountInfo) ListXattr added in v0.5.0

func (mount *MountInfo) ListXattr(path string) ([]string, error)

ListXattr returns a slice containing strings for the name of each xattr set on the file at the supplied path.

Implements:

int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);

func (*MountInfo) LlistXattr added in v0.5.0

func (mount *MountInfo) LlistXattr(path string) ([]string, error)

LlistXattr returns a slice containing strings for the name of each xattr set on the file at the supplied path.

Implements:

int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);

func (*MountInfo) LremoveXattr added in v0.5.0

func (mount *MountInfo) LremoveXattr(path, name string) error

LremoveXattr removes the named xattr from the open file.

Implements:

int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name);

func (*MountInfo) LsetXattr added in v0.5.0

func (mount *MountInfo) LsetXattr(path, name string, value []byte, flags XattrFlags) error

LsetXattr sets an extended attribute on the file at the supplied path.

NOTE: Attempting to set an xattr value with an empty value may cause the xattr to be unset. Please refer to https://tracker.ceph.com/issues/46084

Implements:

int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
                  const void *value, size_t size, int flags);

func (*MountInfo) MakeDir

func (mount *MountInfo) MakeDir(path string, mode uint32) error

MakeDir creates a directory.

func (*MountInfo) MdsCommand

func (mount *MountInfo) MdsCommand(mdsSpec string, args [][]byte) ([]byte, string, error)

MdsCommand sends commands to the specified MDS.

func (*MountInfo) MdsCommandWithInputBuffer

func (mount *MountInfo) MdsCommandWithInputBuffer(mdsSpec string, args [][]byte, inputBuffer []byte) ([]byte, string, error)

MdsCommandWithInputBuffer sends commands to the specified MDS, with an input buffer.

func (*MountInfo) Mount

func (mount *MountInfo) Mount() error

Mount the file system, establishing a connection capable of I/O.

Implements:

int ceph_mount(struct ceph_mount_info *cmount, const char *root);

func (*MountInfo) MountWithRoot added in v0.3.0

func (mount *MountInfo) MountWithRoot(root string) error

MountWithRoot mounts the file system using the path provided for the root of the mount. This establishes a connection capable of I/O.

Implements:

int ceph_mount(struct ceph_mount_info *cmount, const char *root);

func (*MountInfo) Open added in v0.4.0

func (mount *MountInfo) Open(path string, flags int, mode uint32) (*File, error)

Open a file at the given path. The flags are the same os flags as a local open call. Mode is the same mode bits as a local open call.

Implements:

int ceph_open(struct ceph_mount_info *cmount, const char *path, int flags, mode_t mode);

func (*MountInfo) OpenDir added in v0.3.0

func (mount *MountInfo) OpenDir(path string) (*Directory, error)

OpenDir returns a new Directory handle open for I/O.

Implements:

int ceph_opendir(struct ceph_mount_info *cmount, const char *name, struct ceph_dir_result **dirpp);

func (*MountInfo) ParseConfigArgv added in v0.5.0

func (mount *MountInfo) ParseConfigArgv(argv []string) error

ParseConfigArgv configures the mount using a unix style command line argument vector.

Implements:

int ceph_conf_parse_argv(struct ceph_mount_info *cmount, int argc, const char **argv);

func (*MountInfo) ParseDefaultConfigEnv added in v0.5.0

func (mount *MountInfo) ParseDefaultConfigEnv() error

ParseDefaultConfigEnv configures the mount from the default Ceph environment variable CEPH_ARGS.

Implements:

int ceph_conf_parse_env(struct ceph_mount_info *cmount, const char *var);

func (*MountInfo) ReadConfigFile added in v0.11.0

func (mount *MountInfo) ReadConfigFile(path string) error

ReadConfigFile loads the ceph configuration from the specified config file.

Implements:

int ceph_conf_read_file(struct ceph_mount_info *cmount, const char *path_list);

func (*MountInfo) ReadDefaultConfigFile

func (mount *MountInfo) ReadDefaultConfigFile() error

ReadDefaultConfigFile loads the ceph configuration from the default config file.

Implements:

int ceph_conf_read_file(struct ceph_mount_info *cmount, const char *path_list);
func (mount *MountInfo) Readlink(path string) (string, error)

Readlink returns the value of a symbolic link.

Implements:

int ceph_readlink(struct ceph_mount_info *cmount, const char *path, char *buf, int64_t size);

func (*MountInfo) Release

func (mount *MountInfo) Release() error

Release destroys the mount handle.

Implements:

int ceph_release(struct ceph_mount_info *cmount);

func (*MountInfo) RemoveDir

func (mount *MountInfo) RemoveDir(path string) error

RemoveDir removes a directory.

func (*MountInfo) RemoveXattr added in v0.5.0

func (mount *MountInfo) RemoveXattr(path, name string) error

RemoveXattr removes the named xattr from the open file.

Implements:

int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name);

func (*MountInfo) Rename added in v0.4.0

func (mount *MountInfo) Rename(from, to string) error

Rename a file or directory.

Implements:

int ceph_rename(struct ceph_mount_info *cmount, const char *from, const char *to);

func (*MountInfo) SetConfigOption added in v0.3.0

func (mount *MountInfo) SetConfigOption(option, value string) error

SetConfigOption sets the value of the configuration option identified by the given name.

Implements:

int ceph_conf_set(struct ceph_mount_info *cmount, const char *option, const char *value);

func (*MountInfo) SetMountPerms added in v0.4.0

func (mount *MountInfo) SetMountPerms(perm *UserPerm) error

SetMountPerms applies the given UserPerm to the mount object, which it will then use to define the connection's ownership credentials. This function must be called after Init but before Mount.

Implements:

int ceph_mount_perms_set(struct ceph_mount_info *cmount, UserPerm *perm);

func (*MountInfo) SetXattr added in v0.5.0

func (mount *MountInfo) SetXattr(path, name string, value []byte, flags XattrFlags) error

SetXattr sets an extended attribute on the file at the supplied path.

NOTE: Attempting to set an xattr value with an empty value may cause the xattr to be unset. Please refer to https://tracker.ceph.com/issues/46084

Implements:

int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
                  const void *value, size_t size, int flags);

func (*MountInfo) StatFS added in v0.5.0

func (mount *MountInfo) StatFS(path string) (*CephStatVFS, error)

StatFS returns file system wide statistics. NOTE: Many of the statistics fields reported by ceph are not filled in with useful values.

Implements:

int ceph_statfs(struct ceph_mount_info *cmount, const char *path, struct statvfs *stbuf);

func (*MountInfo) Statx added in v0.4.0

func (mount *MountInfo) Statx(path string, want StatxMask, flags AtFlags) (*CephStatx, error)

Statx returns information about a file/directory.

Implements:

int ceph_statx(struct ceph_mount_info *cmount, const char *path, struct ceph_statx *stx,
               unsigned int want, unsigned int flags);
func (mount *MountInfo) Symlink(existing, newname string) error

Symlink creates a symbolic link to an existing path.

Implements:

int ceph_symlink(struct ceph_mount_info *cmount, const char *existing, const char *newname);

func (*MountInfo) SyncFs

func (mount *MountInfo) SyncFs() error

SyncFs synchronizes all filesystem data to persistent media.

func (*MountInfo) Truncate added in v0.7.0

func (mount *MountInfo) Truncate(path string, size int64) error

Truncate sets the size of the specified file.

Implements:

int ceph_truncate(struct ceph_mount_info *cmount, const char *path, int64_t size);
func (mount *MountInfo) Unlink(path string) error

Unlink removes a file.

Implements:

int ceph_unlink(struct ceph_mount_info *cmount, const char *path);

func (*MountInfo) Unmount

func (mount *MountInfo) Unmount() error

Unmount the file system.

Implements:

int ceph_unmount(struct ceph_mount_info *cmount);

type StatxMask added in v0.4.0

type StatxMask uint32

StatxMask values contain bit-flags indicating what data should be populated by a statx-type call.

type SyncChoice added in v0.4.0

type SyncChoice int

SyncChoice is used to control how metadata and/or data is sync'ed to the file system.

type Timespec added in v0.4.0

type Timespec ts.Timespec

Timespec is a public type for the internal C 'struct timespec'

type UserPerm added in v0.4.0

type UserPerm struct {
	// contains filtered or unexported fields
}

UserPerm types may be used to get or change the credentials used by the connection or some operations.

func NewUserPerm added in v0.4.0

func NewUserPerm(uid, gid int, gidlist []int) *UserPerm

NewUserPerm creates a UserPerm pointer and the underlying ceph resources.

Implements:

UserPerm *ceph_userperm_new(uid_t uid, gid_t gid, int ngids, gid_t *gidlist);

func (*UserPerm) Destroy added in v0.4.0

func (p *UserPerm) Destroy()

Destroy will explicitly free ceph resources associated with the UserPerm.

Implements:

void ceph_userperm_destroy(UserPerm *perm);

type XattrFlags added in v0.5.0

type XattrFlags int

XattrFlags are used to control the behavior of set-xattr calls.

Directories

Path Synopsis
Package admin is a convenience layer to support the administration of CephFS volumes, subvolumes, etc.
Package admin is a convenience layer to support the administration of CephFS volumes, subvolumes, etc.

Jump to

Keyboard shortcuts

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