Documentation ¶
Index ¶
- Constants
- type AbandonBlockParam
- type AddBlockParam
- type BlockQueryParam
- type BlockReportParam
- type BlockReportResponse
- type BlockStatus
- type CatBlock
- type CatFileLease
- type CatFileStatus
- type CatLease
- type ClientData
- type ClientMaster
- type CloseParam
- type CreateFileParam
- type DataBlockReport
- type DataMaster
- type DataProtocol
- type DataServerStatus
- type DeleteParam
- type GetBlockParam
- type GetBlocksLocationResponse
- type HeartbeatParam
- type HeartbeatResponse
- type InterData
- type ListDirParam
- type ListDirResponse
- type MasterBackup
- type MasterCommand
- type MasterCommandType
- type MasterProtocol
- type MkdirParam
- type OpenFileParam
- type OpenFileResponse
- type PrepareBlockParam
- type RegisterDataParam
- type RenameParam
- type SendingBlockParam
- type ServerLocation
Constants ¶
View Source
const ( // Read lock LEASE_READ = iota // Write lock LEASE_WRITE )
View Source
const ( OPEN_MODE_READ = iota OPEN_MODE_WRITE )
View Source
const (
LEASE_DURATION = time.Minute
)
View Source
const READ_MODE int = 1
Client Master Params
View Source
const WRITE_MODE int = 2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbandonBlockParam ¶
type AbandonBlockParam struct { // The abs path of the file Path string // Block Block *CatBlock // The lease of a file Lease *CatFileLease }
type AddBlockParam ¶
type AddBlockParam struct { // The abs path of the file Path string // The lease of a file Lease *CatFileLease }
type BlockQueryParam ¶
type BlockQueryParam struct { // The abs path of a file Path string // The offset of a file Offset int64 // The length wanted Length int64 // The lease of a file Lease *CatFileLease }
Query for blocks of a specific file
type CatBlock ¶
type CatBlock struct { // The Id of a block ID string // The location of data server (Indexes) // The first one is the primary Locations []ServerLocation }
The Information of a block
type CatFileLease ¶
type CatFileLease struct { // The id the the lease // It works like a transaction ID ID string // Type of the lease Type int // Expire time of the lease Expire time.Time }
func NewFileLease ¶
func NewFileLease(tp int) *CatFileLease
func (*CatFileLease) New ¶
func (self *CatFileLease) New(tp int)
func (*CatFileLease) Renew ¶
func (self *CatFileLease) Renew(oldLease *CatFileLease)
type CatFileStatus ¶
type CatFileStatus struct { // The name of the file Filename string // The length of the file Length int64 // Time of last status change CTime time.Time // Time of last modification MTime time.Time // Time of last access ATime time.Time // Is Dir IsDir bool // Owner of the file Owner string // Group of the file Group string // Permission of the file // u:rwx g:rwx o:rwx Mode int16 }
type CatLease ¶
type ClientData ¶
type ClientData interface { // Prepare send a block to datanode PrepareSendBlock(param *PrepareBlockParam, lease *CatLease) error // Wait util blocks reach destination // The block will be sent by a pipeline SendingBlock(param *SendingBlockParam, succ *bool) error // Get the block from data server // Will start an tcp connect to request block GetBlock(param *GetBlockParam, lease *CatLease) error }
client: client server: data server
type ClientMaster ¶
type ClientMaster interface { // Get location of the block of the specified file within the specified range GetBlockLocation(query *BlockQueryParam, blocks *GetBlocksLocationResponse) error // Create a file in a given path Create(param *CreateFileParam, response *OpenFileResponse) error // Open a file to add block Open(param *OpenFileParam, response *OpenFileResponse) error // Drop a block AbandonBlock(param *AbandonBlockParam, succ *bool) error // Add a block to a specific path (file) AddBlock(param *AddBlockParam, block *CatBlock) error // Complete an operation, // delete the lease (lock) Close(param *CloseParam, succ *bool) error // Rename Rename(param *RenameParam, succ *bool) error // Delete a file Delete(param *DeleteParam, succ *bool) error // Create a dir Mkdirs(param *MkdirParam, succ *bool) error // List dir Listdir(param *ListDirParam, response *ListDirResponse) error // Renew a lease RenewLease(oldLease *CatFileLease, newLease *CatFileLease) error // File info GetFileInfo(path string, filestatus *CatFileStatus) error }
client: client server: master server
type CloseParam ¶
type CloseParam struct { // The abs path of the file Path string // The lease of a file Lease *CatFileLease // User User string }
type CreateFileParam ¶
type DataBlockReport ¶
type DataBlockReport struct { ID string Status BlockStatus }
type DataMaster ¶
type DataMaster interface { // Register a data server RegisterDataServer(param *RegisterDataParam, succ *bool) error // Send heartbeat to master SendHeartbeat(param *HeartbeatParam, rep *HeartbeatResponse) error // Send blockreport to master BlockReport(param *BlockReportParam, rep *BlockReportResponse) error }
client: data server server: master server
type DataProtocol ¶
type DataProtocol interface { ClientData InterData }
type DataServerStatus ¶
type DataServerStatus struct { Location ServerLocation AvaiableSize uint64 DataSize uint64 TotalSize uint64 Errors []string BlockReports map[string]*DataBlockReport }
type DeleteParam ¶
type GetBlockParam ¶
type GetBlockParam struct { // Transaction id returned by prepare block Block *CatBlock }
type HeartbeatParam ¶
type HeartbeatParam struct {
Status *DataServerStatus
}
type HeartbeatResponse ¶
type HeartbeatResponse struct { // a list of command from the master Command []*MasterCommand }
type ListDirParam ¶
type ListDirResponse ¶
type ListDirResponse struct {
Files []*CatFileStatus
}
type MasterBackup ¶
type MasterBackup interface { }
client: master server server: master backup server
type MasterCommand ¶
type MasterCommand struct { Command MasterCommandType Blocks []string DstMachine ServerLocation }
type MasterCommandType ¶
type MasterCommandType int
const ( // remove some blocks // Blocks is the uuid of the blocks // DstMachine is not important CleanCommand MasterCommandType = iota // Copy blocks from a machine to another machine // Blocks is the uuid of the blocks // DstMachine is the destination of the blocks MigrationCommand )
type MasterProtocol ¶
type MasterProtocol interface { ClientMaster DataMaster MasterBackup }
type MkdirParam ¶
type OpenFileParam ¶
type OpenFileResponse ¶
type OpenFileResponse struct { // the status of the file Filestatus *CatFileStatus // the file lease Lease *CatFileLease }
type PrepareBlockParam ¶
type PrepareBlockParam struct { // The block to send Block *CatBlock }
func (*PrepareBlockParam) NextPipeParam ¶
func (self *PrepareBlockParam) NextPipeParam() *PrepareBlockParam
func (*PrepareBlockParam) ServerLocation ¶
func (self *PrepareBlockParam) ServerLocation() ServerLocation
type RegisterDataParam ¶
type RegisterDataParam struct {
Status *DataServerStatus
}
type RenameParam ¶
type SendingBlockParam ¶
type SendingBlockParam struct { // Transaction id returned by prepare block Lease *CatLease }
type ServerLocation ¶
type ServerLocation int
Click to show internal directories.
Click to hide internal directories.