Documentation ¶
Index ¶
- func AllocateVolume(dn *DataNode, vid storage.VolumeId, option *VolumeGrowOption) error
- func ReplicatedDelete(masterNode string, store *storage.Store, volumeId storage.VolumeId, ...) (uint32, error)
- func ReplicatedWrite(masterNode string, s *storage.Store, volumeId storage.VolumeId, ...) (size uint32, errorStatus string)
- type AllocateVolumeResult
- type Collection
- type Configuration
- type DataCenter
- type DataNode
- func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo)
- func (dn *DataNode) GetDataCenter() *DataCenter
- func (dn *DataNode) GetRack() *Rack
- func (dn *DataNode) GetTopology() *Topology
- func (dn *DataNode) GetVolumes() (ret []storage.VolumeInfo)
- func (dn *DataNode) GetVolumesById(id storage.VolumeId) (storage.VolumeInfo, error)
- func (dn *DataNode) MatchLocation(ip string, port int) bool
- func (dn *DataNode) String() string
- func (dn *DataNode) ToMap() interface{}
- func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (deletedVolumes []storage.VolumeInfo)
- func (dn *DataNode) Url() string
- type DistributedOperationResult
- type MaxVolumeIdCommand
- type Node
- type NodeId
- type NodeImpl
- func (n *NodeImpl) Children() (ret []Node)
- func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSizeLimit uint64)
- func (n *NodeImpl) FreeSpace() int
- func (n *NodeImpl) GetActiveVolumeCount() int
- func (n *NodeImpl) GetMaxVolumeCount() int
- func (n *NodeImpl) GetMaxVolumeId() storage.VolumeId
- func (n *NodeImpl) GetTopology() *Topology
- func (n *NodeImpl) GetValue() interface{}
- func (n *NodeImpl) GetVolumeCount() int
- func (n *NodeImpl) Id() NodeId
- func (n *NodeImpl) IsDataCenter() bool
- func (n *NodeImpl) IsDataNode() bool
- func (n *NodeImpl) IsRack() bool
- func (n *NodeImpl) LinkChildNode(node Node)
- func (n *NodeImpl) Parent() Node
- func (n *NodeImpl) RandomlyPickNodes(numberOfNodes int, filterFirstNodeFn func(dn Node) error) (firstNode Node, restNodes []Node, err error)
- func (n *NodeImpl) ReserveOneVolume(r int) (assignedNode *DataNode, err error)
- func (n *NodeImpl) SetParent(node Node)
- func (n *NodeImpl) String() string
- func (n *NodeImpl) UnlinkChildNode(nodeId NodeId)
- func (n *NodeImpl) UpAdjustActiveVolumeCountDelta(activeVolumeCountDelta int)
- func (n *NodeImpl) UpAdjustMaxVolumeCountDelta(maxVolumeCountDelta int)
- func (n *NodeImpl) UpAdjustMaxVolumeId(vid storage.VolumeId)
- func (n *NodeImpl) UpAdjustVolumeCountDelta(volumeCountDelta int)
- type Rack
- type RemoteResult
- type Topology
- func (t *Topology) DeleteCollection(collectionName string)
- func (t *Topology) FindCollection(collectionName string) (*Collection, bool)
- func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter
- func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPlacement, ttl *storage.TTL) *VolumeLayout
- func (t *Topology) HasWritableVolume(option *VolumeGrowOption) bool
- func (t *Topology) IsLeader() bool
- func (t *Topology) Leader() (string, error)
- func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode
- func (t *Topology) NextVolumeId() storage.VolumeId
- func (t *Topology) PickForWrite(count uint64, option *VolumeGrowOption) (string, uint64, *DataNode, error)
- func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode)
- func (t *Topology) SetVolumeCapacityFull(volumeInfo storage.VolumeInfo) bool
- func (t *Topology) StartRefreshWritableVolumes(garbageThreshold string, preallocate int64)
- func (t *Topology) ToMap() interface{}
- func (t *Topology) ToVolumeMap() interface{}
- func (t *Topology) UnRegisterDataNode(dn *DataNode)
- func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode)
- func (t *Topology) Vacuum(garbageThreshold string, preallocate int64) int
- type VacuumVolumeResult
- type VolumeGrowOption
- type VolumeGrowth
- type VolumeLayout
- func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) int
- func (vl *VolumeLayout) ListVolumeServers() (nodes []*DataNode)
- func (vl *VolumeLayout) Lookup(vid storage.VolumeId) []*DataNode
- func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (*storage.VolumeId, uint64, *VolumeLocationList, error)
- func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode)
- func (vl *VolumeLayout) SetVolumeAvailable(dn *DataNode, vid storage.VolumeId) bool
- func (vl *VolumeLayout) SetVolumeCapacityFull(vid storage.VolumeId) bool
- func (vl *VolumeLayout) SetVolumeUnavailable(dn *DataNode, vid storage.VolumeId) bool
- func (vl *VolumeLayout) String() string
- func (vl *VolumeLayout) ToMap() map[string]interface{}
- func (vl *VolumeLayout) UnRegisterVolume(v *storage.VolumeInfo, dn *DataNode)
- type VolumeLocationList
- func (dnll *VolumeLocationList) Head() *DataNode
- func (dnll *VolumeLocationList) Length() int
- func (dnll *VolumeLocationList) Refresh(freshThreshHold int64)
- func (dnll *VolumeLocationList) Remove(loc *DataNode) bool
- func (dnll *VolumeLocationList) Set(loc *DataNode)
- func (dnll *VolumeLocationList) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocateVolume ¶
func AllocateVolume(dn *DataNode, vid storage.VolumeId, option *VolumeGrowOption) error
func ReplicatedDelete ¶
Types ¶
type AllocateVolumeResult ¶
type AllocateVolumeResult struct {
Error string
}
type Collection ¶
type Collection struct { Name string // contains filtered or unexported fields }
func NewCollection ¶
func NewCollection(name string, volumeSizeLimit uint64) *Collection
func (*Collection) GetOrCreateVolumeLayout ¶
func (c *Collection) GetOrCreateVolumeLayout(rp *storage.ReplicaPlacement, ttl *storage.TTL) *VolumeLayout
func (*Collection) ListVolumeServers ¶
func (c *Collection) ListVolumeServers() (nodes []*DataNode)
func (*Collection) String ¶
func (c *Collection) String() string
type Configuration ¶
type Configuration struct { XMLName xml.Name `xml:"Configuration"` Topo topology `xml:"Topology"` // contains filtered or unexported fields }
func (*Configuration) String ¶
func (c *Configuration) String() string
type DataCenter ¶
type DataCenter struct {
NodeImpl
}
func NewDataCenter ¶
func NewDataCenter(id string) *DataCenter
func (*DataCenter) GetOrCreateRack ¶
func (dc *DataCenter) GetOrCreateRack(rackName string) *Rack
func (*DataCenter) ToMap ¶
func (dc *DataCenter) ToMap() interface{}
type DataNode ¶
type DataNode struct { NodeImpl Ip string Port int PublicUrl string LastSeen int64 // unix time in seconds // contains filtered or unexported fields }
func NewDataNode ¶
func (*DataNode) AddOrUpdateVolume ¶
func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo)
func (*DataNode) GetDataCenter ¶
func (dn *DataNode) GetDataCenter() *DataCenter
func (*DataNode) GetTopology ¶
func (*DataNode) GetVolumes ¶
func (dn *DataNode) GetVolumes() (ret []storage.VolumeInfo)
func (*DataNode) GetVolumesById ¶
func (*DataNode) UpdateVolumes ¶
func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (deletedVolumes []storage.VolumeInfo)
type DistributedOperationResult ¶
func (DistributedOperationResult) Error ¶
func (dr DistributedOperationResult) Error() error
type MaxVolumeIdCommand ¶
func NewMaxVolumeIdCommand ¶
func NewMaxVolumeIdCommand(value storage.VolumeId) *MaxVolumeIdCommand
func (*MaxVolumeIdCommand) Apply ¶
func (c *MaxVolumeIdCommand) Apply(server raft.Server) (interface{}, error)
func (*MaxVolumeIdCommand) CommandName ¶
func (c *MaxVolumeIdCommand) CommandName() string
type Node ¶
type Node interface { Id() NodeId String() string FreeSpace() int ReserveOneVolume(r int) (*DataNode, error) UpAdjustMaxVolumeCountDelta(maxVolumeCountDelta int) UpAdjustVolumeCountDelta(volumeCountDelta int) UpAdjustActiveVolumeCountDelta(activeVolumeCountDelta int) UpAdjustMaxVolumeId(vid storage.VolumeId) GetVolumeCount() int GetActiveVolumeCount() int GetMaxVolumeCount() int GetMaxVolumeId() storage.VolumeId SetParent(Node) LinkChildNode(node Node) UnlinkChildNode(nodeId NodeId) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSizeLimit uint64) IsDataNode() bool IsRack() bool IsDataCenter() bool Children() []Node Parent() Node GetValue() interface{} //get reference to the topology,dc,rack,datanode }
type NodeImpl ¶
func (*NodeImpl) CollectDeadNodeAndFullVolumes ¶
func (*NodeImpl) GetActiveVolumeCount ¶
func (*NodeImpl) GetMaxVolumeCount ¶
func (*NodeImpl) GetMaxVolumeId ¶
func (*NodeImpl) GetTopology ¶
func (*NodeImpl) GetVolumeCount ¶
func (*NodeImpl) IsDataCenter ¶
func (*NodeImpl) IsDataNode ¶
func (*NodeImpl) LinkChildNode ¶
func (*NodeImpl) RandomlyPickNodes ¶
func (n *NodeImpl) RandomlyPickNodes(numberOfNodes int, filterFirstNodeFn func(dn Node) error) (firstNode Node, restNodes []Node, err error)
the first node must satisfy filterFirstNodeFn(), the rest nodes must have one free slot
func (*NodeImpl) ReserveOneVolume ¶
func (*NodeImpl) UnlinkChildNode ¶
func (*NodeImpl) UpAdjustActiveVolumeCountDelta ¶
func (*NodeImpl) UpAdjustMaxVolumeCountDelta ¶
func (*NodeImpl) UpAdjustMaxVolumeId ¶
func (*NodeImpl) UpAdjustVolumeCountDelta ¶
type RemoteResult ¶
type Topology ¶
type Topology struct { NodeImpl Sequence sequence.Sequencer Configuration *Configuration RaftServer raft.Server // contains filtered or unexported fields }
func NewTopology ¶
func (*Topology) DeleteCollection ¶
func (*Topology) FindCollection ¶
func (t *Topology) FindCollection(collectionName string) (*Collection, bool)
func (*Topology) GetOrCreateDataCenter ¶
func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter
func (*Topology) GetVolumeLayout ¶
func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPlacement, ttl *storage.TTL) *VolumeLayout
func (*Topology) HasWritableVolume ¶
func (t *Topology) HasWritableVolume(option *VolumeGrowOption) bool
func (*Topology) NextVolumeId ¶
func (*Topology) PickForWrite ¶
func (*Topology) RegisterVolumeLayout ¶
func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode)
func (*Topology) SetVolumeCapacityFull ¶
func (t *Topology) SetVolumeCapacityFull(volumeInfo storage.VolumeInfo) bool
func (*Topology) StartRefreshWritableVolumes ¶
func (*Topology) ToVolumeMap ¶
func (t *Topology) ToVolumeMap() interface{}
func (*Topology) UnRegisterDataNode ¶
func (*Topology) UnRegisterVolumeLayout ¶
func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode)
type VacuumVolumeResult ¶
type VolumeGrowOption ¶
type VolumeGrowOption struct { Collection string ReplicaPlacement *storage.ReplicaPlacement Ttl *storage.TTL Prealloacte int64 DataCenter string Rack string DataNode string }
func (*VolumeGrowOption) String ¶
func (o *VolumeGrowOption) String() string
type VolumeGrowth ¶
type VolumeGrowth struct {
// contains filtered or unexported fields
}
func NewDefaultVolumeGrowth ¶
func NewDefaultVolumeGrowth() *VolumeGrowth
func (*VolumeGrowth) AutomaticGrowByType ¶
func (vg *VolumeGrowth) AutomaticGrowByType(option *VolumeGrowOption, topo *Topology) (count int, err error)
func (*VolumeGrowth) GrowByCountAndType ¶
func (vg *VolumeGrowth) GrowByCountAndType(targetCount int, option *VolumeGrowOption, topo *Topology) (counter int, err error)
type VolumeLayout ¶
type VolumeLayout struct {
// contains filtered or unexported fields
}
mapping from volume to its locations, inverted from server to volume
func NewVolumeLayout ¶
func NewVolumeLayout(rp *storage.ReplicaPlacement, ttl *storage.TTL, volumeSizeLimit uint64) *VolumeLayout
func (*VolumeLayout) GetActiveVolumeCount ¶
func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) int
func (*VolumeLayout) ListVolumeServers ¶
func (vl *VolumeLayout) ListVolumeServers() (nodes []*DataNode)
func (*VolumeLayout) PickForWrite ¶
func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (*storage.VolumeId, uint64, *VolumeLocationList, error)
func (*VolumeLayout) RegisterVolume ¶
func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode)
func (*VolumeLayout) SetVolumeAvailable ¶
func (vl *VolumeLayout) SetVolumeAvailable(dn *DataNode, vid storage.VolumeId) bool
func (*VolumeLayout) SetVolumeCapacityFull ¶
func (vl *VolumeLayout) SetVolumeCapacityFull(vid storage.VolumeId) bool
func (*VolumeLayout) SetVolumeUnavailable ¶
func (vl *VolumeLayout) SetVolumeUnavailable(dn *DataNode, vid storage.VolumeId) bool
func (*VolumeLayout) String ¶
func (vl *VolumeLayout) String() string
func (*VolumeLayout) ToMap ¶
func (vl *VolumeLayout) ToMap() map[string]interface{}
func (*VolumeLayout) UnRegisterVolume ¶
func (vl *VolumeLayout) UnRegisterVolume(v *storage.VolumeInfo, dn *DataNode)
type VolumeLocationList ¶
type VolumeLocationList struct {
// contains filtered or unexported fields
}
func NewVolumeLocationList ¶
func NewVolumeLocationList() *VolumeLocationList
func (*VolumeLocationList) Head ¶
func (dnll *VolumeLocationList) Head() *DataNode
func (*VolumeLocationList) Length ¶
func (dnll *VolumeLocationList) Length() int
func (*VolumeLocationList) Refresh ¶
func (dnll *VolumeLocationList) Refresh(freshThreshHold int64)
func (*VolumeLocationList) Remove ¶
func (dnll *VolumeLocationList) Remove(loc *DataNode) bool
func (*VolumeLocationList) Set ¶
func (dnll *VolumeLocationList) Set(loc *DataNode)
func (*VolumeLocationList) String ¶
func (dnll *VolumeLocationList) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.