/storage/volume_ttl.go
type TTL struct {
count byte
unit byte
}
由数值和单位构成,从说明文档来看,单位支持m, h, d, w, M, y。
/storage/replica_placement.go
type ReplicaPlacement struct {
SameRackCount int
DiffRackCount int
DiffDataCenterCount int
}
这个表示了分片的类型,对外显示为 012 这样的数字,每一个数字的取值范围为0-2.
结构关系
{topology.Collection} -> {topology.VolumesLayout} -> {storage.VolumeId}
/topology/collection.go
type Collection struct {
Name string
volumeSizeLimit uint64
storageType2VolumeLayout *util.ConcurrentReadMap
}
默认在上传的时候如果不制定,会使用一个Name为空的Collection。具体体现是在Volume目录下会产生{CollectionName}_{VolumeId}.{idx|dat}的文件。如果名字为空,则仅仅是{VolumeId}.{idx|dat}.
Name 当前Collection的名字,默认为""volumeSizeLimit 用于限制每个volume的大小storageType2VolumeLayout key的构造规则是 {分片类型}+{TTL}, Value 是一个 VolumeLayout
/topology/volume_layout.go
type VolumeLayout struct {
rp *storage.ReplicaPlacement
ttl *storage.TTL
vid2location map[storage.VolumeId]*VolumeLocationList
writables []storage.VolumeId // transient array of writable volume id
volumeSizeLimit uint64
accessLock sync.Mutex
}
func NewVolumeLayout(
rp *storage.ReplicaPlacement,
ttl *storage.TTL,
volumeSizeLimit uint64) *VolumeLayout
一般VolumeLayout的创建过程是在Collection进行。
待续
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。