Documentation
¶
Overview ¶
Package cephfs contains a set of wrappers around Ceph's libcephfs API.
Index ¶
- Constants
- type CephFSError
- type DType
- type DirEntry
- type Directory
- type File
- func (f *File) Close() error
- func (f *File) Read(buf []byte) (int, error)
- func (f *File) ReadAt(buf []byte, offset int64) (int, error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Write(buf []byte) (int, error)
- func (f *File) WriteAt(buf []byte, offset int64) (int, error)
- type Inode
- type MountInfo
- func (mount *MountInfo) ChangeDir(path string) error
- func (mount *MountInfo) Chmod(path string, mode uint32) error
- func (mount *MountInfo) Chown(path string, user uint32, group uint32) error
- func (mount *MountInfo) CurrentDir() string
- func (mount *MountInfo) GetConfigOption(option string) (string, error)
- func (mount *MountInfo) GetFsCid() (int64, error)
- func (mount *MountInfo) Init() error
- func (mount *MountInfo) IsMounted() bool
- func (mount *MountInfo) Link(oldname, newname string) error
- func (mount *MountInfo) MakeDir(path string, mode uint32) error
- func (mount *MountInfo) MdsCommand(mdsSpec string, args [][]byte) ([]byte, string, error)
- func (mount *MountInfo) MdsCommandWithInputBuffer(mdsSpec string, args [][]byte, inputBuffer []byte) ([]byte, string, error)
- func (mount *MountInfo) Mount() error
- func (mount *MountInfo) MountWithRoot(root string) error
- func (mount *MountInfo) Open(path string, flags int, mode uint32) (*File, error)
- func (mount *MountInfo) OpenDir(path string) (*Directory, error)
- func (mount *MountInfo) ReadDefaultConfigFile() error
- func (mount *MountInfo) Readlink(path string) (string, error)
- func (mount *MountInfo) Release() error
- func (mount *MountInfo) RemoveDir(path string) error
- func (mount *MountInfo) SetConfigOption(option, value string) error
- func (mount *MountInfo) SetMountPerms(perm *UserPerm) error
- func (mount *MountInfo) Symlink(existing, newname string) error
- func (mount *MountInfo) SyncFs() error
- func (mount *MountInfo) Unlink(path string) error
- func (mount *MountInfo) Unmount() error
- type UserPerm
Constants ¶
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) )
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) )
const ( // ErrNotConnected may be returned when client is not connected // to a cluster. ErrNotConnected = CephFSError(-C.ENOTCONN) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CephFSError ¶
type CephFSError int
CephFSError represents an error condition returned from the CephFS APIs.
func (CephFSError) Error ¶
func (e CephFSError) Error() string
Error returns the error string for the CephFSError type.
type DType ¶
type DType uint8
DType values are used to determine, when possible, the file type of a directory entry.
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry represents an entry within a directory.
func (*DirEntry) 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.
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory represents an open directory handle.
func (*Directory) Close ¶
Close the open directory handle.
Implements:
int ceph_closedir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp);
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents an open file descriptor in cephfs.
func (*File) Close ¶
Close the file.
Implements:
int ceph_close(struct ceph_mount_info *cmount, int fd);
func (*File) Read ¶
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 ¶
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) Seek ¶
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);
type MountInfo ¶
type MountInfo struct {
// contains filtered or unexported fields
}
MountInfo exports ceph's ceph_mount_info from libcephfs.cc
func CreateFromRados ¶
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 ¶
CreateMount creates a mount handle for interacting with Ceph.
func CreateMountWithId ¶
CreateMountWithId creates a mount handle for interacting with Ceph. The caller can specify a unique id that will identify this client.
func (*MountInfo) CurrentDir ¶
CurrentDir gets the current working directory.
func (*MountInfo) GetConfigOption ¶
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 ¶
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) Init ¶
Init the file system client without actually mounting the file system.
Implements:
int ceph_init(struct ceph_mount_info *cmount);
func (*MountInfo) Link ¶
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) MdsCommand ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) ReadDefaultConfigFile ¶
ReadDefaultConfigFile loads the ceph configuration from the specified config file.
func (*MountInfo) Readlink ¶
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 ¶
Release destroys the mount handle.
Implements:
int ceph_release(struct ceph_mount_info *cmount);
func (*MountInfo) SetConfigOption ¶
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 ¶
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) Symlink ¶
Symlink creates a symbolic link to an existing path.
Implements:
int ceph_symlink(struct ceph_mount_info *cmount, const char *existing, const char *newname);
type UserPerm ¶
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 ¶
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);