Documentation
¶
Index ¶
- Constants
- Variables
- func FormatBytes(b float64, mode Mode) string
- func MFSStrerror(code uint8) string
- func Pack(data ...interface{}) []byte
- func PackCmd(cmd uint32, data ...interface{}) []byte
- func ParseBytes(str string) (uint64, error)
- func UnPack(in []byte, out ...interface{})
- type CSClient
- type CSData
- func (d *CSData) Read(buf []byte, off uint64) (n uint32, err error)
- func (d *CSData) ReadBlock(c *CSClient, buf []byte, off uint64) (n uint32, err error)
- func (d *CSData) Write(buf []byte, off uint64) (n uint32, err error)
- func (d *CSData) WriteBlock(c *CSClient, wid uint32, blockNum, off uint16, buf []byte) (err error)
- type CSItem
- type CSItemMap
- type CSPool
- type Client
- func (c *Client) Chdir(path string) (err error)
- func (c *Client) Chmod(path string, mode uint16) (fi *FileInfo, err error)
- func (c *Client) Chown(path string, uid, gid uint32) (fi *FileInfo, err error)
- func (c *Client) Close()
- func (c *Client) Create(path string) (f *File, err error)
- func (c *Client) GetDirStats(path string) (ds *DirStats, err error)
- func (c *Client) Mkdir(path string) (err error)
- func (c *Client) Open(path string) (f *File, err error)
- func (c *Client) OpenOrCreate(path string) (f *File, err error)
- func (c *Client) ReadFile(path, localPath string) (err error)
- func (c *Client) Readdir(path string) (infoMap ReaddirInfoMap, err error)
- func (c *Client) Rmdir(path string) (err error)
- func (c *Client) Unlink(path string) (err error)
- func (c *Client) WriteFile(localPath, path string) (err error)
- type DirStats
- type File
- type FileInfo
- type MAClient
- func (c *MAClient) Access(inode uint32, mode uint16) (err error)
- func (c *MAClient) AllQuotaInfo() (quota QuotaInfoMap, err error)
- func (c *MAClient) Chmod(inode uint32, mode uint16) (fi *FileInfo, err error)
- func (c *MAClient) Chown(inode uint32, uid, gid uint32) (fi *FileInfo, err error)
- func (c *MAClient) Close()
- func (c *MAClient) CloseSession() (err error)
- func (c *MAClient) Connect() (err error)
- func (c *MAClient) Create(parent uint32, name string, mode uint16) (fi *FileInfo, err error)
- func (c *MAClient) CreateSession() (err error)
- func (c *MAClient) GetAttr(inode uint32) (fi *FileInfo, err error)
- func (c *MAClient) GetDirStats(inode uint32) (ds *DirStats, err error)
- func (c *MAClient) Link(inode, inodeDst uint32, nameDst string) (fi *FileInfo, err error)
- func (c *MAClient) ListSession() (ids []uint32, err error)
- func (c *MAClient) Lookup(parent uint32, name string) (fi *FileInfo, err error)
- func (c *MAClient) MasterVersion() error
- func (c *MAClient) Mkdir(parent uint32, name string, mode uint16) (fi *FileInfo, err error)
- func (c *MAClient) Mknod(parent uint32, name string, mode uint16) (fi *FileInfo, err error)
- func (c *MAClient) Open(inode uint32, flags uint8) (fi *FileInfo, err error)
- func (c *MAClient) Purge(inode uint32) (err error)
- func (c *MAClient) QuotaControl(info *QuotaInfo, mode QuotaMode) (err error)
- func (c *MAClient) ReadChunk(inode, index uint32, flags uint8) (cs *CSData, err error)
- func (c *MAClient) ReadLink(inode uint32) (path string, err error)
- func (c *MAClient) Readdir(parent uint32) (infoMap ReaddirInfoMap, err error)
- func (c *MAClient) ReaddirAttr(parent uint32) (infoMap ReaddirInfoAttrMap, err error)
- func (c *MAClient) Recv(buf []byte) (n int, err error)
- func (c *MAClient) RemoveSession(sessionId uint32) (err error)
- func (c *MAClient) Rename(inodeSrc uint32, nameSrc string, inodeDst uint32, nameDst string) (fi *FileInfo, err error)
- func (c *MAClient) Rmdir(parent uint32, name string) (err error)
- func (c *MAClient) Send(msg []byte) error
- func (c *MAClient) SetAttr(inode uint32, setmask uint8, mode uint16, uid, gid, atime, mtime uint32) (fi *FileInfo, err error)
- func (c *MAClient) Statfs() (st *StatInfo, err error)
- func (c *MAClient) Symlink(parent uint32, name string, path string) (fi *FileInfo, err error)
- func (c *MAClient) Truncate(inode uint32, flags uint8) (fi *FileInfo, err error)
- func (c *MAClient) UnPackQuota(buf []byte) *QuotaInfo
- func (c *MAClient) Undel(inode uint32) (err error)
- func (c *MAClient) Unlink(parent uint32, name string) (err error)
- func (c *MAClient) WriteChunk(inode, index uint32, flags uint8) (cs *CSData, err error)
- func (c *MAClient) WriteChunkEnd(chunkId uint64, inode, index uint32, length uint64, flags uint8) (err error)
- type Mode
- type QuotaInfo
- type QuotaInfoMap
- type QuotaMode
- type ReaddirInfo
- type ReaddirInfoAttr
- type ReaddirInfoAttrMap
- type ReaddirInfoMap
- type StatInfo
- type Version
Constants ¶
View Source
const ( MFSBLOCKSINCHUNK = 0x400 MFSCHUNKSIZE = 0x04000000 MFSCHUNKMASK = 0x03FFFFFF MFSCHUNKBITS = 26 MFSCHUNKBLOCKMASK = 0x03FF0000 MFSBLOCKSIZE = 0x10000 MFSBLOCKMASK = 0x0FFFF MFSBLOCKNEGMASK = 0x7FFF0000 MFSBLOCKBITS = 16 MFSCRCEMPTY = 0xD7978EEB MFSHDRSIZE = 0x2000 )
View Source
const ( TYPE_FILE = iota + 1 TYPE_DIRECTORY TYPE_SYMLINK TYPE_FIFO TYPE_BLOCKDEV TYPE_CHARDEV TYPE_SOCKET TYPE_TRASH TYPE_SUSTAINED )
View Source
const ( SET_WINATTR_FLAG = 1 << iota SET_MODE_FLAG SET_UID_FLAG SET_GID_FLAG SET_MTIME_NOW_FLAG SET_MTIME_FLAG SET_ATIME_FLAG SET_ATIME_NOW_FLAG )
for setmask
View Source
const ( CHUNKOPFLAG_CANMODTIME = 1 << iota CHUNKOPFLAG_CONTINUEOP CHUNKOPFLAG_CANUSERESERVESPACE )
chunkopflags
View Source
const ANTOAN_GET_VERSION = 10
View Source
const ANTOAN_NOP = 0
View Source
const ANTOCS_GET_CHUNK_CHECKSUM = 300
View Source
const ANTOCS_GET_CHUNK_CHECKSUM_TAB = 302
View Source
const CLTOCS_READ = 200
View Source
const CLTOCS_WRITE = 210
View Source
const CLTOCS_WRITE_DATA = 212
View Source
const CLTOCS_WRITE_FINISH = 213
View Source
const CLTOMA_FUSE_ACCESS = 404
View Source
const CLTOMA_FUSE_APPEND_SLICE = 438
View Source
const CLTOMA_FUSE_ARCHCTL = 496
View Source
const CLTOMA_FUSE_CHECK = 440
View Source
const CLTOMA_FUSE_CREATE = 482
View Source
const CLTOMA_FUSE_FLOCK = 492
View Source
const CLTOMA_FUSE_FSYNC = 498
View Source
const CLTOMA_FUSE_GETATTR = 408
View Source
const CLTOMA_FUSE_GETDETACHEDATTR = 452
View Source
const CLTOMA_FUSE_GETDIRSTATS = 462
View Source
const CLTOMA_FUSE_GETEATTR = 472
View Source
const CLTOMA_FUSE_GETFACL = 488
View Source
const CLTOMA_FUSE_GETSCLASS = 446
View Source
const CLTOMA_FUSE_GETSUSTAINED = 470
View Source
const CLTOMA_FUSE_GETTRASH = 450
View Source
const CLTOMA_FUSE_GETTRASHPATH = 454
View Source
const CLTOMA_FUSE_GETTRASHTIME = 442
View Source
const CLTOMA_FUSE_GETXATTR = 478
View Source
const CLTOMA_FUSE_LINK = 426
View Source
const CLTOMA_FUSE_LOOKUP = 406
View Source
const CLTOMA_FUSE_MKDIR = 418
View Source
const CLTOMA_FUSE_MKNOD = 416
View Source
const CLTOMA_FUSE_OPEN = 430
View Source
const CLTOMA_FUSE_PARENTS = 484
View Source
const CLTOMA_FUSE_PATHS = 486
View Source
const CLTOMA_FUSE_POSIX_LOCK = 494
View Source
const CLTOMA_FUSE_PURGE = 460
View Source
const CLTOMA_FUSE_QUOTACONTROL = 476
View Source
const CLTOMA_FUSE_READDIR = 428
View Source
const CLTOMA_FUSE_READLINK = 412
View Source
const CLTOMA_FUSE_READ_CHUNK = 432
View Source
const CLTOMA_FUSE_REGISTER = 400
View Source
const CLTOMA_FUSE_RENAME = 424
View Source
const CLTOMA_FUSE_REPAIR = 466
View Source
const CLTOMA_FUSE_RMDIR = 422
View Source
const CLTOMA_FUSE_SETATTR = 410
View Source
const CLTOMA_FUSE_SETEATTR = 474
View Source
const CLTOMA_FUSE_SETFACL = 490
View Source
const CLTOMA_FUSE_SETSCLASS = 448
View Source
const CLTOMA_FUSE_SETTRASHPATH = 456
View Source
const CLTOMA_FUSE_SETTRASHTIME = 444
View Source
const CLTOMA_FUSE_SETXATTR = 480
View Source
const CLTOMA_FUSE_SNAPSHOT = 468
View Source
const CLTOMA_FUSE_STATFS = 402
View Source
const CLTOMA_FUSE_SYMLINK = 414
View Source
const CLTOMA_FUSE_TRUNCATE = 464
View Source
const CLTOMA_FUSE_UNDEL = 458
View Source
const CLTOMA_FUSE_UNLINK = 420
View Source
const CLTOMA_FUSE_WRITE_CHUNK = 434
View Source
const CLTOMA_FUSE_WRITE_CHUNK_END = 436
View Source
const CLTOMA_INFO = 510
View Source
const CLTOMA_QUOTA_INFO = 518
View Source
const CLTOMA_SESSION_COMMAND = 526
View Source
const CLTOMA_SESSION_LIST = 508
View Source
const CSTOAN_CHUNK_CHECKSUM = 301
View Source
const CSTOAN_CHUNK_CHECKSUM_TAB = 303
View Source
const CSTOCL_READ_DATA = 202
View Source
const CSTOCL_READ_STATUS = 201
View Source
const CSTOCL_WRITE_STATUS = 211
View Source
const FUSE_REGISTER_BLOB_ACL = "DjI1GAQDULI5d2YjA26ypc3ovkhjvhciTQVx3CS4nYgtBoUcsljiVpsErJENHaw0"
View Source
const MASTER_HEARTBEAT_INTERVAL = 5 * time.Second
View Source
const MFS_NAME_MAX = 255
View Source
const MFS_PATH_MAX = 1024
View Source
const MFS_ROOT_ID = 1
View Source
const MFS_SYMLINK_MAX = 4096
View Source
const MFS_VERSION string = "3.0.103"
View Source
const MIN_SPECIAL_INODE = 0x7FFFFFF0
View Source
const REGISTER_CLOSESESSION uint8 = 6
View Source
const REGISTER_GETRANDOM uint8 = 1
View Source
const REGISTER_NEWMETASESSION uint8 = 5
View Source
const REGISTER_NEWSESSION uint8 = 2
View Source
const REGISTER_RECONNECT uint8 = 3
View Source
const REGISTER_TOOLS uint8 = 4
View Source
const TCP_CONNECT_TIMEOUT = 30 * time.Second
View Source
const TCP_RETRY_TIMES = 3
View Source
const TCP_RW_TIMEOUT = time.Minute
Variables ¶
View Source
var ERROR_TABLE = []string{
"OK",
"Operation not permitted",
"Not a directory",
"No such file or directory",
"Permission denied",
"File exists",
"Invalid argument",
"Directory not empty",
"Chunk lost",
"Out of memory",
"Index too big",
"Chunk locked",
"No chunk servers",
"No such chunk",
"Chunk is busy",
"Incorrect register BLOB",
"Operation not completed",
"File not opened",
"Write not started",
"Wrong chunk version",
"Chunk already exists",
"No space left",
"IO error",
"Incorrect block number",
"Incorrect size",
"Incorrect offset",
"Can't connect",
"Incorrect chunk id",
"Disconnected",
"CRC error",
"Operation delayed",
"Can't create path",
"Data mismatch",
"Read-only file system",
"Quota exceeded",
"Bad session id",
"Password is needed",
"Incorrect password",
"Attribute not found",
"Operation not supported",
"Result too large",
"Entity not found",
"Entity is active",
"Chunkserver not present",
"Waiting on lock",
"Resource temporarily unavailable",
"Interrupted system call",
"Operation canceled",
"No such file or directory (not cacheable)",
"Operation not permitted (mfs admin only)",
"Class name already in use",
"Maximum number of classes reached",
"No such class",
"Class in use",
"Unknown MFS error",
}
Functions ¶
func FormatBytes ¶
func MFSStrerror ¶
Types ¶
type CSClient ¶
type CSClient struct { Version // contains filtered or unexported fields }
chunk server client
func NewCSClient ¶
type CSData ¶
type CSData struct { ProtocolId uint8 Length uint64 ChunkId uint64 Version uint32 CSItems CSItemMap }
reponse data from master
type Client ¶
type Client struct { Cwd string // contains filtered or unexported fields }
func NewClientFull ¶
type FileInfo ¶
type FileInfo struct { Flags uint8 Type uint8 Inode uint32 Uid uint32 Gid uint32 Mode os.FileMode NLink uint32 ATime time.Time MTime time.Time CTime time.Time Size uint64 }
flags: 01 noacache 02 noecache 04 allowdatacache
08 noxattr 10 directmode
'floating-point' size examples:
1200 = 12.00 B
1023443 = 234.43 kB 2052312 = 523.12 MB 3001298 = 12.98 GB 4001401 = 14.01 TB
type MAClient ¶
type MAClient struct { Password string Subdir string //remote subdir RootPath string //local root path sync.Mutex Version // contains filtered or unexported fields }
mfs master client
func NewMAClient ¶
func NewMAClientPwd ¶
func (*MAClient) AllQuotaInfo ¶
func (c *MAClient) AllQuotaInfo() (quota QuotaInfoMap, err error)
func (*MAClient) CloseSession ¶
func (*MAClient) CreateSession ¶
func (*MAClient) GetDirStats ¶
func (*MAClient) ListSession ¶
func (*MAClient) MasterVersion ¶
func (*MAClient) QuotaControl ¶
func (*MAClient) Readdir ¶
func (c *MAClient) Readdir(parent uint32) (infoMap ReaddirInfoMap, err error)
func (*MAClient) ReaddirAttr ¶
func (c *MAClient) ReaddirAttr(parent uint32) (infoMap ReaddirInfoAttrMap, err error)
func (*MAClient) RemoveSession ¶
func (*MAClient) Truncate ¶
msgid:32 inode:32 flags:8 uid:32 gcnt:32 gcnt * [ gid:32 ] length:64 (version >= 2.0.89/3.0.25)
func (*MAClient) UnPackQuota ¶
func (*MAClient) WriteChunk ¶
type QuotaInfoMap ¶
func GetUsage ¶
func GetUsage(masterAddr string) (QuotaInfoMap, error)
get all usage of mfs by sending command to mfs master
type ReaddirInfo ¶
type ReaddirInfoAttr ¶
type ReaddirInfoAttrMap ¶
type ReaddirInfoAttrMap map[uint32]*ReaddirInfoAttr
type ReaddirInfoMap ¶
type ReaddirInfoMap map[uint32]*ReaddirInfo
type Version ¶
type Version uint32
func GetVersion ¶
func ParseVersionInt ¶
func ParseVersionString ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.