Documentation
¶
Overview ¶
Package rgw contains a set of wrappers around Ceph's librgw API.
Index ¶
- Constants
- Variables
- func ShutdownRGW(rgw *RGW)
- func Version() (int, int, int)
- type AttrMask
- type CloseFlag
- type CommitFlag
- type CreateFlag
- type FS
- func (fs *FS) Close(fh *FileHandle, flags CloseFlag) error
- func (fs *FS) Commit(fh *FileHandle, offset, length uint64, flags CommitFlag) error
- func (fs *FS) Create(parentHdl *FileHandle, name string, mask AttrMask, posixFlags uint32, ...) (*FileHandle, *syscall.Stat_t, error)
- func (fs *FS) Fsync(fh *FileHandle, flags FsyncFlag) error
- func (fs *FS) GetAttr(fh *FileHandle, flags GetAttrFlag) (*syscall.Stat_t, error)
- func (fs *FS) GetRootFileHandle() *FileHandle
- func (fs *FS) Lookup(parentHdl *FileHandle, path string, stMask AttrMask, flags LookupFlag) (*FileHandle, *syscall.Stat_t, error)
- func (fs *FS) Mkdir(parentHdl *FileHandle, name string, mask AttrMask, flags MkdirFlag) (*FileHandle, *syscall.Stat_t, error)
- func (fs *FS) Mount(rgw *RGW, uid, key, secret string, flags MountFlag) error
- func (fs *FS) Open(fh *FileHandle, posixFlags uint32, flags OpenFlag) error
- func (fs *FS) Read(fh *FileHandle, offset, length uint64, buffer []byte, flags ReadFlag) (bytes_read uint64, err error)
- func (fs *FS) ReadDir(parentHdl *FileHandle, cb ReadDirCallback, offset uint64, flags ReadDirFlag) (uint64, bool, error)
- func (fs *FS) Rename(oldDirHdl *FileHandle, oldName string, newDirHdl *FileHandle, newName string, ...) error
- func (fs *FS) SetAttr(fh *FileHandle, stat *syscall.Stat_t, mask AttrMask, flags SetAttrFlag) error
- func (fs *FS) StatFS(pFH *FileHandle, flags StatFSFlag) (*StatVFS, error)
- func (fs *FS) Truncate(fh *FileHandle, size uint64, flags TruncFlag) error
- func (fs *FS) Umount(flags UmountFlag) error
- func (fs *FS) Unlink(parentHdl *FileHandle, path string, flags UnlinkFlag) error
- func (fs *FS) Write(fh *FileHandle, buffer []byte, offset uint64, length uint64, flags uint32) (bytesWritten uint, err error)
- type FileHandle
- type FsyncFlag
- type GetAttrFlag
- type LookupFlag
- type MkdirFlag
- type MountFlag
- type OpenFlag
- type RGW
- type ReadDirCallback
- type ReadDirFlag
- type ReadFlag
- type RenameFlag
- type SetAttrFlag
- type StatFSFlag
- type StatVFS
- type TruncFlag
- type UmountFlag
- type UnlinkFlag
- type WriteFlag
Constants ¶
const ( // ErrNotConnected may be returned when client is not connected // to a cluster. ErrNotConnected = rgwError(-C.ENOTCONN) )
Variables ¶
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 ShutdownRGW ¶
func ShutdownRGW(rgw *RGW)
ShutdownRGW shutdown a RGW instance
Implements:
void librgw_shutdown(librgw_t rgw)
Types ¶
type AttrMask ¶
type AttrMask uint32
AttrMask specifies which part(s) of attrs is/are concerned
const ( // AttrMode mode is concerned AttrMode AttrMask = 1 // AttrUid uid is concerned AttrUid AttrMask = 2 // AttrGid gid is concerned AttrGid AttrMask = 4 // AttrMtime mtime is concerned AttrMtime AttrMask = 8 // AttrAtime atime is concerned AttrAtime AttrMask = 16 // AttrSize size is concerned AttrSize AttrMask = 32 // AttrCtime ctime is concerned AttrCtime AttrMask = 64 )
type CommitFlag ¶
type CommitFlag uint32
CommitFlag is used to control behavior of Commit()
const ( // CommitFlagNone keep the default behavior of Commit() CommitFlagNone CommitFlag = 0 )
type CreateFlag ¶
type CreateFlag uint32
CreateFlag is used to control behavor of Create()
const ( // CreateFlagNone keep the default behavior of Create() CreateFlagNone CreateFlag = 0 )
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS represents a rgw fs
FS exports ceph's rgw_fs from include/rados/rgw_file.h
func (*FS) Close ¶
func (fs *FS) Close(fh *FileHandle, flags CloseFlag) error
Close file
Implements:
int rgw_close(rgw_fs *fs, rgw_file_handle *fh, uint32_t flags)
func (*FS) Commit ¶
func (fs *FS) Commit(fh *FileHandle, offset, length uint64, flags CommitFlag) error
Commit nfs commit operation
Implements:
int rgw_commit(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh, uint64_t offset, uint64_t length, uint32_t flags)
func (*FS) Create ¶
func (fs *FS) Create(parentHdl *FileHandle, name string, mask AttrMask, posixFlags uint32, flags CreateFlag) ( *FileHandle, *syscall.Stat_t, error)
Create file
Implements:
int rgw_create(rgw_fs *fs, rgw_file_handle *parent_fh, const char *name, stat *st, uint32_t mask, rgw_file_handle **fh, uint32_t posix_flags, uint32_t flags)
func (*FS) Fsync ¶
func (fs *FS) Fsync(fh *FileHandle, flags FsyncFlag) error
Fsync sync written data. NOTE: Actually, do nothing
Implements:
int rgw_fsync(rgw_fs *fs, rgw_file_handle *fh, uint32_t flags)
func (*FS) GetAttr ¶
func (fs *FS) GetAttr(fh *FileHandle, flags GetAttrFlag) (*syscall.Stat_t, error)
GetAttr gets unix attributes for object
Implements:
int rgw_getattr(rgw_fs *fs, rgw_file_handle *fh, stat *st, uint32_t flags)
func (*FS) GetRootFileHandle ¶
func (fs *FS) GetRootFileHandle() *FileHandle
GetRootFileHandle get the root file handle
func (*FS) Lookup ¶
func (fs *FS) Lookup(parentHdl *FileHandle, path string, stMask AttrMask, flags LookupFlag) (*FileHandle, *syscall.Stat_t, error)
Lookup object by name (POSIX style)
Implements:
int rgw_lookup(rgw_fs *fs, rgw_file_handle *parent_fh, const char *path, rgw_file_handle **fh, stat* st, uint32_t st_mask, uint32_t flags)
func (*FS) Mkdir ¶
func (fs *FS) Mkdir(parentHdl *FileHandle, name string, mask AttrMask, flags MkdirFlag) ( *FileHandle, *syscall.Stat_t, error)
Mkdir creates a new directory
Implements:
int rgw_mkdir(rgw_fs *fs, rgw_file_handle *parent_fh, const char *name, stat *st, uint32_t mask, rgw_file_handle **fh, uint32_t flags)
func (*FS) Mount ¶
Mount the filesystem
Implements:
int rgw_mount(librgw_t rgw, const char *uid, const char *key, const char *secret, rgw_fs **fs, uint32_t flags)
func (*FS) Open ¶
func (fs *FS) Open(fh *FileHandle, posixFlags uint32, flags OpenFlag) error
Open file
Implements:
int rgw_open(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh, uint32_t posix_flags, uint32_t flags)
func (*FS) Read ¶
func (fs *FS) Read(fh *FileHandle, offset, length uint64, buffer []byte, flags ReadFlag) (bytes_read uint64, err error)
Read data from file
Implements:
int rgw_read(rgw_fs *fs, rgw_file_handle *fh, uint64_t offset, size_t length, size_t *bytes_read, void *buffer, uint32_t flags)
func (*FS) ReadDir ¶
func (fs *FS) ReadDir(parentHdl *FileHandle, cb ReadDirCallback, offset uint64, flags ReadDirFlag) (uint64, bool, error)
ReadDir read directory content
Implements:
int rgw_readdir(struct rgw_fs *rgw_fs, struct rgw_file_handle *parent_fh, uint64_t *offset, rgw_readdir_cb rcb, void *cb_arg, bool *eof, uint32_t flags)
func (*FS) Rename ¶
func (fs *FS) Rename(oldDirHdl *FileHandle, oldName string, newDirHdl *FileHandle, newName string, flags RenameFlag) error
Rename object
Implements:
int rgw_rename(rgw_fs *fs, rgw_file_handle *olddir, const char* old_name, rgw_file_handle *newdir, const char* new_name, uint32_t flags)
func (*FS) SetAttr ¶
func (fs *FS) SetAttr(fh *FileHandle, stat *syscall.Stat_t, mask AttrMask, flags SetAttrFlag) error
SetAttr sets unix attributes for object
Implements:
int rgw_setattr(rgw_fs *fs, rgw_file_handle *fh, stat *st, uint32_t mask, uint32_t flags)
func (*FS) StatFS ¶
func (fs *FS) StatFS(pFH *FileHandle, flags StatFSFlag) (*StatVFS, error)
StatFS returns file system wide statistics.
Implements:
int rgw_statfs(rgw_fs *fs, rgw_file_handle *parent_fh, rgw_statvfs *vfs_st, uint32_t flags)
func (*FS) Truncate ¶
func (fs *FS) Truncate(fh *FileHandle, size uint64, flags TruncFlag) error
Truncate file. Actually, do nothing
Implements:
int rgw_truncate(rgw_fs *fs, rgw_file_handle *fh, uint64_t size, uint32_t flags)
func (*FS) Umount ¶
func (fs *FS) Umount(flags UmountFlag) error
Umount the file system.
Implements:
int rgw_umount(rgw_fs *fs, uint32_t flags)
func (*FS) Unlink ¶
func (fs *FS) Unlink(parentHdl *FileHandle, path string, flags UnlinkFlag) error
Unlink remove file or directory
Implements:
int rgw_unlink(rgw_fs *fs, rgw_file_handle *parent_fh, const char* path, uint32_t flags)
func (*FS) Write ¶
func (fs *FS) Write(fh *FileHandle, buffer []byte, offset uint64, length uint64, flags uint32) (bytesWritten uint, err error)
Write data to file
Implements:
int rgw_write(rgw_fs *fs, rgw_file_handle *fh, uint64_t offset, size_t length, size_t *bytes_written, void *buffer, uint32_t flags)
type FileHandle ¶
type FileHandle struct {
// contains filtered or unexported fields
}
FileHandle represents a file/dir
struct rgw_file_handle
type FsyncFlag ¶
type FsyncFlag uint32
FsyncFlag is used to control behavior of Fsync()
const ( // FsyncFlagNone keep the default behavior of Fsync() FsyncFlagNone FsyncFlag = 0 )
type GetAttrFlag ¶
type GetAttrFlag uint32
GetAttrFlag is used to control behavior of GetAttr()
const ( // GetAttrFlagNone keep the default behavior of GetAttr() GetAttrFlagNone GetAttrFlag = 0 )
type LookupFlag ¶
type LookupFlag uint32
LookupFlag is used to control behavor of Lookup()
const ( // LookupFlagNone keep the default behavior of Lookup() LookupFlagNone LookupFlag = 0 // LookupFlagCreate create if not exist LookupFlagCreate LookupFlag = 1 // LookupFlagRCB readdir callback hint LookupFlagRCB LookupFlag = 2 // LookupFlagDir FileHandle type is dir LookupFlagDir LookupFlag = 4 // LookupFlagFile FileHandle type is file LookupFlagFile LookupFlag = 8 // LookupTypeFlags FileHandle type is file or dir LookupTypeFlags LookupFlag = LookupFlagDir | LookupFlagFile )
type MkdirFlag ¶
type MkdirFlag uint32
MkdirFlag is used to control behavor of Mkdir()
const ( // MkdirFlagNone keep the default behavior of Mkdir() MkdirFlagNone MkdirFlag = 0 )
type MountFlag ¶
type MountFlag uint32
MountFlag is used to control behavior of Mount()
const ( // MountFlagNone keep the default behavior of Mount() MountFlagNone MountFlag = 0 )
type RGW ¶
type RGW struct {
// contains filtered or unexported fields
}
RGW represents a librgw handle
typedef void* librgw_t;
type ReadDirCallback ¶
type ReadDirCallback interface {
Callback(name string, st *syscall.Stat_t, mask AttrMask, flags uint32, offset uint64) bool
}
ReadDirCallback will be applied to each dentry when ReadDir() is called
type ReadDirFlag ¶
type ReadDirFlag uint32
ReadDirFlag is used to control behavor of ReadDir()
const ( // ReadDirFlagNone keep the default behavior of ReadDir() ReadDirFlagNone ReadDirFlag = 0 // ReadDirFlagDotDot send dot names ReadDirFlagDotDot ReadDirFlag = 1 )
type ReadFlag ¶
type ReadFlag uint32
ReadFlag is used to control behavior of Read()
const ( // ReadFlagNone keep the default behavior of Read() ReadFlagNone ReadFlag = 0 )
type RenameFlag ¶
type RenameFlag uint32
RenameFlag is used to control behavior of Rename()
const ( // RenameFlagNone keep the default behavior of Rename() RenameFlagNone RenameFlag = 0 )
type SetAttrFlag ¶
type SetAttrFlag uint32
SetAttrFlag is used to control behavior of SetAttr()
const ( // SetAttrFlagNone keep the default behavior of SetAttr() SetAttrFlagNone SetAttrFlag = 0 )
type StatFSFlag ¶
type StatFSFlag uint32
StatFSFlag is used to control behavior of StatFS()
const ( // StatFSFlagNone keep the default behavior of StatFS() StatFSFlagNone StatFSFlag = 0 )
type StatVFS ¶
type StatVFS 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 [2]int64 // Flag reports the file system mount flags. Flag int64 // Namemax reports the maximum file name length. Namemax int64 }
StatVFS instances are returned from the StatFS call. It reports file-system wide statistics.
type TruncFlag ¶
type TruncFlag uint32
TruncFlag is used to control behavior of Truncate()
const ( // TruncFlagNone keep the default behavior of Truncate() TruncFlagNone TruncFlag = 0 )
type UmountFlag ¶
type UmountFlag uint32
UmountFlag is used to control behavior of Umount()
const ( // UmountFlagNone keep the default behavior of Umount() UmountFlagNone UmountFlag = 0 )
type UnlinkFlag ¶
type UnlinkFlag uint32
UnlinkFlag is used to control behavior of Unlink()
const ( // UnlinkFlagNone keep the default behavior of Unlink() UnlinkFlagNone UnlinkFlag = 0 )