cfs

package
v0.0.0-...-4cd6a09 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	O_RDONLY = os.O_RDONLY // 0    00000000000000000000000000000000
	O_WRONLY = os.O_WRONLY // 1    00000000000000000000000000000001
	O_RDWR   = os.O_RDWR   // 2    00000000000000000000000000000010
	O_APPEND = os.O_APPEND // 1024 00000000000000000000010000000000
	O_CREATE = os.O_CREATE // 64   00000000000000000000000001000000
	O_TRUNC  = os.O_TRUNC  // 512  00000000000000000000001000000000
	O_EXCL   = os.O_EXCL   // 0x4000

	O_MVOPT  = O_RDONLY | 0x20000
	O_TAROPT = O_MVOPT | syscall.O_NONBLOCK
	O_SCPOPT = O_RDONLY | syscall.O_NONBLOCK
)

Variables

View Source
var EtcdEndPoints []string
View Source
var MetaNodeAddr string
View Source
var VolMgrAddr string

Functions

func ChooseMetaLeaderWatcher

func ChooseMetaLeaderWatcher()

func CreateVol

func CreateVol(name string, capacity string) int32

func DialData

func DialData(host string) (*grpc.ClientConn, error)

func DialMeta

func DialMeta() (*grpc.ClientConn, error)

func DialVolmgr

func DialVolmgr(host string) (*grpc.ClientConn, error)

func GetFSInfo

func GetFSInfo(name string) (int32, *mp.GetFSInfoAck)

func GetMetaLeader

func GetMetaLeader()

func GetVolInfo

func GetVolInfo(name string) (int32, *vp.GetVolInfoAck)

func ProcessLocalBuffer

func ProcessLocalBuffer(buffer []byte, cfile *CFile)

func ReadLocalAndWriteCFS

func ReadLocalAndWriteCFS(filePth string, bufSize int, hookfn func([]byte, *CFile), cfile *CFile) error

Types

type CFS

type CFS struct {
	VolID  string
	Status int // 0 ok , 1 readonly 2 invaild
}

func OpenFileSystem

func OpenFileSystem(UUID string) *CFS

func (*CFS) AllocateChunk

func (cfs *CFS) AllocateChunk(path string) (int32, *mp.ChunkInfoWithBG)

func (*CFS) CreateDir

func (cfs *CFS) CreateDir(path string) int32

func (*CFS) CreateFile

func (cfs *CFS) CreateFile(path string, flags int) (int32, *CFile)

func (*CFS) DeleteDir

func (cfs *CFS) DeleteDir(path string) int32

func (*CFS) DeleteFile

func (cfs *CFS) DeleteFile(path string) int32

func (*CFS) GetFileChunks

func (cfs *CFS) GetFileChunks(path string) (int32, []*mp.ChunkInfoWithBG)

func (*CFS) List

func (cfs *CFS) List(path string) (int32, []*mp.InodeInfo)

func (*CFS) OpenFile

func (cfs *CFS) OpenFile(path string, flags int) (int32, *CFile)

func (*CFS) Rename

func (cfs *CFS) Rename(path1 string, path2 string) int32

func (*CFS) Stat

func (cfs *CFS) Stat(path string) (int32, *mp.InodeInfo)

func (*CFS) UpdateOpenFile

func (cfs *CFS) UpdateOpenFile(cfile *CFile, flags int) int32

type CFile

type CFile struct {
	Path     string
	OpenFlag int
	FileSize int64

	// for write
	WMutex sync.Mutex
	Writer int32

	// for read
	//lastoffset int64
	RMutex sync.Mutex

	//readBuf    []byte
	ReaderMap map[fuse.HandleID]*ReaderInfo
	// contains filtered or unexported fields
}

func (*CFile) Close

func (cfile *CFile) Close(flags int) int32

func closeP(cfile *CFile) { cfile = nil }

func (*CFile) DestroyChannel

func (cfile *CFile) DestroyChannel()

func (*CFile) Flush

func (cfile *CFile) Flush() int32

func (*CFile) Read

func (cfile *CFile) Read(handleId fuse.HandleID, data *[]byte, offset int64, readsize int64) int64

func (*CFile) Sync

func (cfile *CFile) Sync() int32

func (*CFile) Write

func (cfile *CFile) Write(buf []byte, len int32) int32

type ReaderInfo

type ReaderInfo struct {
	LastOffset int64

	Ch chan *bytes.Buffer
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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