Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func FromBytes(b []byte, s interface{}) error
- func ToBytes(s interface{}) []byte
- type BlockClient
- type BlockRequest
- type ClientPool
- type DataRPCClient
- func (self *DataRPCClient) Call(method string, args interface{}, reply interface{}) error
- func (self *DataRPCClient) CloseConn() error
- func (self *DataRPCClient) Connect() error
- func (self *DataRPCClient) GetBlock(param *proc.GetBlockParam, lease *proc.CatLease) error
- func (self *DataRPCClient) PrepareSendBlock(param *proc.PrepareBlockParam, lease *proc.CatLease) error
- func (self *DataRPCClient) SendingBlock(param *proc.SendingBlockParam, succ *bool) error
- type MasterRPCClient
- func (self *MasterRPCClient) AbandonBlock(param *proc.AbandonBlockParam, succ *bool) error
- func (self *MasterRPCClient) AddBlock(param *proc.AddBlockParam, block *proc.CatBlock) error
- func (self *MasterRPCClient) BlockReport(param *proc.BlockReportParam, rep *proc.BlockReportResponse) error
- func (self *MasterRPCClient) Call(method string, args interface{}, reply interface{}) error
- func (self *MasterRPCClient) Close(param *proc.CloseParam, succ *bool) error
- func (self *MasterRPCClient) CloseConn() error
- func (self *MasterRPCClient) Connect() error
- func (self *MasterRPCClient) Create(param *proc.CreateFileParam, rep *proc.OpenFileResponse) error
- func (self *MasterRPCClient) Delete(param *proc.DeleteParam, succ *bool) error
- func (self *MasterRPCClient) GetBlockLocation(query *proc.BlockQueryParam, blocks *proc.GetBlocksLocationResponse) error
- func (self *MasterRPCClient) GetFileInfo(path string, filestatus *proc.CatFileStatus) error
- func (self *MasterRPCClient) Listdir(param *proc.ListDirParam, files *proc.ListDirResponse) error
- func (self *MasterRPCClient) Mkdirs(param *proc.MkdirParam, succ *bool) error
- func (self *MasterRPCClient) Open(param *proc.OpenFileParam, rep *proc.OpenFileResponse) error
- func (self *MasterRPCClient) RegisterDataServer(param *proc.RegisterDataParam, succ *bool) error
- func (self *MasterRPCClient) Rename(param *proc.RenameParam, succ *bool) error
- func (self *MasterRPCClient) RenewLease(oldLease *proc.CatFileLease, newLease *proc.CatFileLease) error
- func (self *MasterRPCClient) SendHeartbeat(param *proc.HeartbeatParam, rep *proc.HeartbeatResponse) error
Constants ¶
View Source
const ( BLOCK_BUFFER_SIZE_PACED = 1 << 11 BLOCK_BUFFER_SIZE = 1 << 10 BLOCK_REQUEST_SIZE = 100 BLOCK_SEND_SIZE = 1 << 9 DEFAULT_CHAN_SIZE = 10 )
View Source
const ( REQUEST_SEND_BLOCK = iota REQUEST_GET_BLOCK )
View Source
const ( BLOCK_FINISHED = iota BLOCK_NOT_FINISHED )
View Source
const (
MAX_RECONNECT = 5
)
Variables ¶
View Source
var ( RESPONSE_PELEASE_SEND = []byte("ack") ErrShutdown = errors.New("Operation Error") )
View Source
var (
DefaultClientPool = NewClientPool()
)
Functions ¶
Types ¶
type BlockClient ¶
type BlockClient struct {
// contains filtered or unexported fields
}
func NewBlockClient ¶
func NewBlockClient(index int) *BlockClient
func (*BlockClient) GetBlock ¶
func (self *BlockClient) GetBlock(c chan []byte, transID string)
func (*BlockClient) SendBlock ¶
func (self *BlockClient) SendBlock(c chan []byte, transID string)
func (*BlockClient) SendBlockAll ¶
func (self *BlockClient) SendBlockAll(data []byte, transID string) error
type BlockRequest ¶
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
func (*ClientPool) DataServer ¶
func (self *ClientPool) DataServer(index proc.ServerLocation) *DataRPCClient
Get the Data Server Client
func (*ClientPool) MasterServer ¶
func (self *ClientPool) MasterServer() *MasterRPCClient
Get the Master Server Client
func (*ClientPool) NewBlockClient ¶
func (self *ClientPool) NewBlockClient(index proc.ServerLocation) *BlockClient
Get new Block Client
type DataRPCClient ¶
type DataRPCClient struct {
// contains filtered or unexported fields
}
func DataServer ¶
func DataServer(index proc.ServerLocation) *DataRPCClient
func NewDataClient ¶
func NewDataClient(index int) *DataRPCClient
func (*DataRPCClient) Call ¶
func (self *DataRPCClient) Call(method string, args interface{}, reply interface{}) error
func (*DataRPCClient) CloseConn ¶
func (self *DataRPCClient) CloseConn() error
func (*DataRPCClient) Connect ¶
func (self *DataRPCClient) Connect() error
func (*DataRPCClient) GetBlock ¶
func (self *DataRPCClient) GetBlock(param *proc.GetBlockParam, lease *proc.CatLease) error
Get the block from data server Will start an tcp connect to request block
func (*DataRPCClient) PrepareSendBlock ¶
func (self *DataRPCClient) PrepareSendBlock(param *proc.PrepareBlockParam, lease *proc.CatLease) error
Prepare send a block to datanode
func (*DataRPCClient) SendingBlock ¶
func (self *DataRPCClient) SendingBlock(param *proc.SendingBlockParam, succ *bool) error
Wait util blocks reach destination The block will be sent by a pipeline
type MasterRPCClient ¶
type MasterRPCClient struct {
// contains filtered or unexported fields
}
func MasterServer ¶
func MasterServer() *MasterRPCClient
func NewMasterClient ¶
func NewMasterClient() *MasterRPCClient
func (*MasterRPCClient) AbandonBlock ¶
func (self *MasterRPCClient) AbandonBlock(param *proc.AbandonBlockParam, succ *bool) error
Drop a block
func (*MasterRPCClient) AddBlock ¶
func (self *MasterRPCClient) AddBlock(param *proc.AddBlockParam, block *proc.CatBlock) error
Add a block to a specific path (file)
func (*MasterRPCClient) BlockReport ¶
func (self *MasterRPCClient) BlockReport(param *proc.BlockReportParam, rep *proc.BlockReportResponse) error
Send blockreport to master
func (*MasterRPCClient) Call ¶
func (self *MasterRPCClient) Call(method string, args interface{}, reply interface{}) error
func (*MasterRPCClient) Close ¶
func (self *MasterRPCClient) Close(param *proc.CloseParam, succ *bool) error
Complete an operation, delete the lease (lock)
func (*MasterRPCClient) CloseConn ¶
func (self *MasterRPCClient) CloseConn() error
func (*MasterRPCClient) Connect ¶
func (self *MasterRPCClient) Connect() error
func (*MasterRPCClient) Create ¶
func (self *MasterRPCClient) Create(param *proc.CreateFileParam, rep *proc.OpenFileResponse) error
Create a file in a given path
func (*MasterRPCClient) Delete ¶
func (self *MasterRPCClient) Delete(param *proc.DeleteParam, succ *bool) error
Delete a file
func (*MasterRPCClient) GetBlockLocation ¶
func (self *MasterRPCClient) GetBlockLocation(query *proc.BlockQueryParam, blocks *proc.GetBlocksLocationResponse) error
Get location of the block of the specified file within the specified range
func (*MasterRPCClient) GetFileInfo ¶
func (self *MasterRPCClient) GetFileInfo(path string, filestatus *proc.CatFileStatus) error
File info
func (*MasterRPCClient) Listdir ¶
func (self *MasterRPCClient) Listdir(param *proc.ListDirParam, files *proc.ListDirResponse) error
List dir
func (*MasterRPCClient) Mkdirs ¶
func (self *MasterRPCClient) Mkdirs(param *proc.MkdirParam, succ *bool) error
Create a dir
func (*MasterRPCClient) Open ¶
func (self *MasterRPCClient) Open(param *proc.OpenFileParam, rep *proc.OpenFileResponse) error
Open a file to add block
func (*MasterRPCClient) RegisterDataServer ¶
func (self *MasterRPCClient) RegisterDataServer(param *proc.RegisterDataParam, succ *bool) error
Register a data server
func (*MasterRPCClient) Rename ¶
func (self *MasterRPCClient) Rename(param *proc.RenameParam, succ *bool) error
Rename
func (*MasterRPCClient) RenewLease ¶
func (self *MasterRPCClient) RenewLease(oldLease *proc.CatFileLease, newLease *proc.CatFileLease) error
Renew a lease
func (*MasterRPCClient) SendHeartbeat ¶
func (self *MasterRPCClient) SendHeartbeat(param *proc.HeartbeatParam, rep *proc.HeartbeatResponse) error
Send heartbeat to master
Click to show internal directories.
Click to hide internal directories.