Documentation ¶
Index ¶
- Constants
- Variables
- type BTree
- func (b *BTree) Ascend(fn func(i BtreeItem) bool)
- func (b *BTree) AscendGreaterOrEqual(pivot BtreeItem, iterator func(i BtreeItem) bool)
- func (b *BTree) AscendRange(greaterOrEqual, lessThan BtreeItem, iterator func(i BtreeItem) bool)
- func (b *BTree) Delete(key BtreeItem) BtreeItem
- func (b *BTree) Find(key BtreeItem, fn func(i BtreeItem))
- func (b *BTree) Get(key BtreeItem) BtreeItem
- func (b *BTree) GetTree() *BTree
- func (b *BTree) Has(key BtreeItem) bool
- func (b *BTree) Len() int
- func (b *BTree) ReplaceOrInsert(key BtreeItem, replace bool) (BtreeItem, bool)
- func (b *BTree) Reset()
- type BtreeItem
- type CreateDentryReq
- type CreateInoReq
- type CreateInoResp
- type CreateMetaRangeReq
- type CreateMetaRangeResp
- type DataPartition
- type DataPartitionsView
- type DeleteDentryReq
- type DeleteDentryResp
- type DeleteInoReq
- type DeleteInoResp
- type Dentry
- func (d *Dentry) Less(than btree.Item) (less bool)
- func (d *Dentry) Marshal() (result []byte, err error)
- func (d *Dentry) MarshalKey() (k []byte)
- func (d *Dentry) MarshalValue() (k []byte)
- func (d *Dentry) Unmarshal(raw []byte) (err error)
- func (d *Dentry) UnmarshalKey(k []byte) (err error)
- func (d *Dentry) UnmarshalValue(val []byte) (err error)
- type EvictInodeReq
- type ExtentsTruncateReq
- type ExtentsTruncateResp
- type Inode
- func (i *Inode) AppendExtents(ext proto.ExtentKey)
- func (i *Inode) Less(than btree.Item) bool
- func (i *Inode) Marshal() (result []byte, err error)
- func (i *Inode) MarshalKey() (k []byte)
- func (i *Inode) MarshalValue() (val []byte)
- func (i *Inode) String() string
- func (i *Inode) Unmarshal(raw []byte) (err error)
- func (i *Inode) UnmarshalKey(k []byte) (err error)
- func (i *Inode) UnmarshalValue(val []byte) (err error)
- type InodeGetReq
- type InodeGetReqBatch
- type ItemIterator
- type LinkInodeReq
- type LinkInodeResp
- type LookupReq
- type LookupResp
- type MetaItem
- type MetaManager
- type MetaManagerConfig
- type MetaNode
- type MetaPartition
- type MetaPartitionConfig
- type OpDentry
- type OpExtent
- type OpInode
- type OpMeta
- type OpPartition
- type OpenReq
- type Packet
- type ReadDirReq
- type ReadDirResp
- type ResponseDentry
- type ResponseInode
- type SetattrRequest
- type UpdateDentryReq
- type UpdateDentryResp
- type UpdatePartitionReq
- type UpdatePartitionResp
- type Vol
Constants ¶
const ( StateStandby uint32 = iota StateStart StateRunning StateShutdown StateStopped )
const ( ForceCloseConnect = true NoCloseConnect = false )
const ( AsyncDeleteInterval = 10 * time.Second UpdateVolTicket = 5 * time.Minute BatchCounts = 100 )
const (
DataPartitionViewUrl = "/client/dataPartitions"
)
Variables ¶
var ( ErrNonLeader = errors.New("non leader") ErrNotLeader = errors.New("not leader") )
var ( ErrIllegalHeartbeatAddress = errors.New("illegal heartbeat address") ErrIllegalReplicateAddress = errors.New("illegal replicate address") )
var (
ErrInodeOutOfRange = errors.New("inode ID out of range")
)
Errors
var (
UMPKey string
)
Functions ¶
This section is empty.
Types ¶
type BTree ¶
func (*BTree) AscendGreaterOrEqual ¶
func (*BTree) AscendRange ¶
func (*BTree) ReplaceOrInsert ¶
type CreateDentryReq ¶
type CreateDentryReq = proto.CreateDentryRequest
Client -> MetaNode create Dentry request struct
type CreateInoReq ¶
type CreateInoReq = proto.CreateInodeRequest
Client -> MetaNode create Inode request struct
type CreateInoResp ¶
type CreateInoResp = proto.CreateInodeResponse
MetaNode -> Client create Inode response struct
type CreateMetaRangeReq ¶
type CreateMetaRangeReq = proto.CreateMetaPartitionRequest
Master -> MetaNode create metaPartition request struct
type CreateMetaRangeResp ¶
type CreateMetaRangeResp = proto.CreateMetaPartitionResponse
MetaNode -> Master create metaPartition response struct
type DataPartition ¶
type DataPartition struct { PartitionID uint32 Status int8 ReplicaNum uint8 PartitionType string Hosts []string }
func (*DataPartition) GetAllAddrs ¶
func (dp *DataPartition) GetAllAddrs() (m string)
type DataPartitionsView ¶
type DataPartitionsView struct {
DataPartitions []*DataPartition
}
type DeleteDentryReq ¶
type DeleteDentryReq = proto.DeleteDentryRequest
Client -> MetaNode delete Dentry request struct
type DeleteDentryResp ¶
type DeleteDentryResp = proto.DeleteDentryResponse
MetaNode -> Client delete Dentry response struct
type DeleteInoReq ¶
type DeleteInoReq = proto.DeleteInodeRequest
Client -> MetaNode delete Inode request struct
type DeleteInoResp ¶
type DeleteInoResp = proto.DeleteInodeResponse
MetaNode -> Client delete Inode response
type Dentry ¶
type Dentry struct { ParentId uint64 // FileId value of parent inode. Name string // Name of current dentry. Inode uint64 // FileId value of current inode. Type uint32 // Dentry type. }
Dentry wraps necessary properties of `Dentry` information in file system. Marshal key:
+-------+----------+------+ | item | ParentId | Name | +-------+----------+------+ | bytes | 8 | rest | +-------+----------+------+
Marshal value:
+-------+-------+------+ | item | Inode | Type | +-------+-------+------+ | bytes | 8 | 4 | +-------+-------+------+
Marshal entity:
+-------+-----------+--------------+-----------+--------------+ | item | KeyLength | MarshaledKey | ValLength | MarshaledVal | +-------+-----------+--------------+-----------+--------------+ | bytes | 4 | KeyLength | 4 | ValLength | +-------+-----------+--------------+-----------+--------------+
func (*Dentry) Less ¶
Less tests whether the current Dentry item is less than the given one. This method is necessary fot B-Tree item implementation.
func (*Dentry) MarshalKey ¶
MarshalKey is the bytes version of MarshalKey method which returns byte slice result.
func (*Dentry) MarshalValue ¶
MarshalValue marshal key to bytes.
func (*Dentry) UnmarshalKey ¶
UnmarshalKey unmarshal key from bytes.
func (*Dentry) UnmarshalValue ¶
UnmarshalValue unmarshal value from bytes.
type Inode ¶
type Inode struct { Inode uint64 // Inode ID Type uint32 Uid uint32 Gid uint32 Size uint64 Generation uint64 CreateTime int64 AccessTime int64 ModifyTime int64 LinkTarget []byte // SymLink target name NLink uint32 // NodeLink counts MarkDelete uint8 // 0: false; 1: true Extents *proto.StreamKey }
Inode wraps necessary properties of `Inode` information in file system. Marshal key:
+-------+-------+ | item | Inode | +-------+-------+ | bytes | 8 | +-------+-------+
Marshal value:
+-------+------+------+-----+----+----+----+--------+------------------+ | item | Type | Size | Gen | CT | AT | MT | ExtLen | MarshaledExtents | +-------+------+------+-----+----+----+----+--------+------------------+ | bytes | 4 | 8 | 8 | 8 | 8 | 8 | 4 | ExtLen | +-------+------+------+-----+----+----+----+--------+------------------+
Marshal entity:
+-------+-----------+--------------+-----------+--------------+ | item | KeyLength | MarshaledKey | ValLength | MarshaledVal | +-------+-----------+--------------+-----------+--------------+ | bytes | 4 | KeyLength | 4 | ValLength | +-------+-----------+--------------+-----------+--------------+
func NewInode ¶
NewInode returns a new Inode instance pointer with specified Inode ID, name and Inode type code. The AccessTime and ModifyTime of new instance will be set to current time.
func (*Inode) AppendExtents ¶
func (*Inode) Less ¶
Less tests whether the current Inode item is less than the given one. This method is necessary fot B-Tree item implementation.
func (*Inode) MarshalValue ¶
MarshalValue marshal value to bytes.
func (*Inode) UnmarshalKey ¶
UnmarshalKey unmarshal key from bytes.
func (*Inode) UnmarshalValue ¶
UnmarshalValue unmarshal value from bytes.
type ItemIterator ¶
type ItemIterator struct {
// contains filtered or unexported fields
}
func NewMetaItemIterator ¶
func NewMetaItemIterator(applyID uint64, ino, den *BTree) *ItemIterator
func (*ItemIterator) ApplyIndex ¶
func (si *ItemIterator) ApplyIndex() uint64
func (*ItemIterator) Close ¶
func (si *ItemIterator) Close()
func (*ItemIterator) Next ¶
func (si *ItemIterator) Next() (data []byte, err error)
type LinkInodeReq ¶
type LinkInodeReq = proto.LinkInodeRequest
Client -> MetaNode create Link Request
type LinkInodeResp ¶
type LinkInodeResp = proto.LinkInodeResponse
MetaNode -> Client create Link Response
type MetaItem ¶
func NewMetaItem ¶
func (*MetaItem) MarshalBinary ¶
MarshalBinary marshal this MetaItem entity to binary data. Binary frame structure:
+------+----+------+------+------+------+ | Item | Op | LenK | K | LenV | V | +------+----+------+------+------+------+ | byte | 4 | 4 | LenK | 4 | LenV | +------+----+------+------+------+------+
func (*MetaItem) UnmarshalBinary ¶
MarshalBinary unmarshal this MetaItem entity from binary data. Binary frame structure:
+------+----+------+------+------+------+ | Item | Op | LenK | K | LenV | V | +------+----+------+------+------+------+ | byte | 4 | 4 | LenK | 4 | LenV | +------+----+------+------+------+------+
func (*MetaItem) UnmarshalJson ¶
UnmarshalJson unmarshal binary data to MetaItem entity.
type MetaManager ¶
type MetaManager interface { Start() error Stop() //CreatePartition(id string, start, end uint64, peers []proto.Peer) error HandleMetaOperation(conn net.Conn, p *Packet) error GetPartition(id uint64) (MetaPartition, error) }
MetaManager manage all metaPartition and make mapping between volName and metaPartition.
func NewMetaManager ¶
func NewMetaManager(conf MetaManagerConfig) MetaManager
type MetaManagerConfig ¶
type MetaNode ¶
type MetaNode struct {
// contains filtered or unexported fields
}
The MetaNode manage Dentry and Inode information in multiple metaPartition, and through the RaftStore algorithm and other MetaNodes in the RageGroup for reliable data synchronization to maintain data consistency within the MetaGroup.
type MetaPartition ¶
func NewMetaPartition ¶
func NewMetaPartition(conf *MetaPartitionConfig) MetaPartition
NewMetaPartition create and init a new meta partition with specified configuration.
type MetaPartitionConfig ¶
type MetaPartitionConfig struct { PartitionId uint64 `json:"partition_id"` VolName string `json:"vol_name"` Start uint64 `json:"start"` End uint64 `json:"end"` Peers []proto.Peer `json:"peers"` Cursor uint64 `json:"-"` NodeId uint64 `json:"-"` RootDir string `json:"-"` BeforeStart func() `json:"-"` AfterStart func() `json:"-"` BeforeStop func() `json:"-"` AfterStop func() `json:"-"` RaftStore raftstore.RaftStore `json:"-"` ConnPool *pool.ConnectPool `json:"-"` }
MetRangeConfig used by create metaPartition and serialize
PartitionId: Identity for raftStore group,RaftStore nodes in same raftStore group must have same groupID. Start: Minimal Inode ID of this range. (Required when initialize) End: Maximal Inode ID of this range. (Required when initialize) Cursor: Cursor ID value of Inode what have been already assigned. Peers: Peers information for raftStore.
func (*MetaPartitionConfig) Dump ¶
func (c *MetaPartitionConfig) Dump() ([]byte, error)
func (*MetaPartitionConfig) Load ¶
func (c *MetaPartitionConfig) Load(bytes []byte) error
type OpDentry ¶
type OpDentry interface { CreateDentry(req *CreateDentryReq, p *Packet) (err error) DeleteDentry(req *DeleteDentryReq, p *Packet) (err error) UpdateDentry(req *UpdateDentryReq, p *Packet) (err error) ReadDir(req *ReadDirReq, p *Packet) (err error) Lookup(req *LookupReq, p *Packet) (err error) }
type OpExtent ¶
type OpExtent interface { ExtentAppend(req *proto.AppendExtentKeyRequest, p *Packet) (err error) ExtentsList(req *proto.GetExtentsRequest, p *Packet) (err error) ExtentsTruncate(req *ExtentsTruncateReq, p *Packet) (err error) }
type OpInode ¶
type OpInode interface { CreateInode(req *CreateInoReq, p *Packet) (err error) DeleteInode(req *DeleteInoReq, p *Packet) (err error) InodeGet(req *InodeGetReq, p *Packet) (err error) InodeGetBatch(req *InodeGetReqBatch, p *Packet) (err error) Open(req *OpenReq, p *Packet) (err error) CreateLinkInode(req *LinkInodeReq, p *Packet) (err error) EvictInode(req *EvictInodeReq, p *Packet) (err error) SetAttr(reqData []byte, p *Packet) (err error) }
type OpPartition ¶
type OpPartition interface { IsLeader() (leaderAddr string, isLeader bool) GetCursor() uint64 GetBaseConfig() MetaPartitionConfig StoreMeta() (err error) ChangeMember(changeType raftproto.ConfChangeType, peer raftproto.Peer, context []byte) (resp interface{}, err error) DeletePartition() (err error) UpdatePartition(req *UpdatePartitionReq, resp *UpdatePartitionResp) (err error) DeleteRaft() error }
type Packet ¶
func NewExtentDeletePacket ¶
func NewExtentDeletePacket(dp *DataPartition, extentId uint64) *Packet
For send delete request to dataNode
type ReadDirResp ¶
type ReadDirResp = proto.ReadDirResponse
MetaNode -> Client read dir response struct
type ResponseDentry ¶
func NewResponseDentry ¶
func NewResponseDentry() *ResponseDentry
type ResponseInode ¶
func NewResponseInode ¶
func NewResponseInode() *ResponseInode
type UpdateDentryReq ¶
type UpdateDentryReq = proto.UpdateDentryRequest
Client -> MetaNode updateDentry request struct
type UpdateDentryResp ¶
type UpdateDentryResp = proto.UpdateDentryResponse
MetaNode -> Client updateDentry response struct
type UpdatePartitionReq ¶
type UpdatePartitionReq = proto.UpdateMetaPartitionRequest
Master -> MetaNode
type UpdatePartitionResp ¶
type UpdatePartitionResp = proto.UpdateMetaPartitionResponse
MetaNode -> Master
type Vol ¶
func (*Vol) GetPartition ¶
func (v *Vol) GetPartition(partitionID uint32) *DataPartition
func (*Vol) UpdatePartitions ¶
func (v *Vol) UpdatePartitions(partitions *DataPartitionsView)
Source Files ¶
- btree.go
- const.go
- datapartition.go
- dentry.go
- free_list.go
- inode.go
- manager.go
- manager_op.go
- manager_proxy.go
- manager_resp.go
- metanode.go
- metanode_handler.go
- packet.go
- partition.go
- partition_free_list.go
- partition_fsm.go
- partition_fsmop.go
- partition_fsmop_dentry.go
- partition_fsmop_inode.go
- partition_item.go
- partition_op_dentry.go
- partition_op_extent.go
- partition_op_inode.go
- partition_store.go
- partition_store_ticket.go
- raft_server.go
- server.go