diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-12-13 00:58:58 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-12-13 00:58:58 -0800 |
| commit | e9cd798bd372741753efcba2af594b00fe7b8437 (patch) | |
| tree | e291019e7394a874a292ee90c832a65745f57fd4 /weed/topology/collection.go | |
| parent | 16cd6fb27838db95054701f5567c93d51bf24d5f (diff) | |
| download | seaweedfs-e9cd798bd372741753efcba2af594b00fe7b8437.tar.xz seaweedfs-e9cd798bd372741753efcba2af594b00fe7b8437.zip | |
adding volume type
Diffstat (limited to 'weed/topology/collection.go')
| -rw-r--r-- | weed/topology/collection.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/topology/collection.go b/weed/topology/collection.go index 5b410d1eb..e3aab2f76 100644 --- a/weed/topology/collection.go +++ b/weed/topology/collection.go @@ -2,6 +2,7 @@ package topology import ( "fmt" + "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/storage/super_block" @@ -29,13 +30,16 @@ func (c *Collection) String() string { return fmt.Sprintf("Name:%s, volumeSizeLimit:%d, storageType2VolumeLayout:%v", c.Name, c.volumeSizeLimit, c.storageType2VolumeLayout) } -func (c *Collection) GetOrCreateVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL) *VolumeLayout { +func (c *Collection) GetOrCreateVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL, volumeType storage.VolumeType) *VolumeLayout { keyString := rp.String() if ttl != nil { keyString += ttl.String() } + if volumeType != storage.HardDriveType { + keyString += string(volumeType) + } vl := c.storageType2VolumeLayout.Get(keyString, func() interface{} { - return NewVolumeLayout(rp, ttl, c.volumeSizeLimit, c.replicationAsMin) + return NewVolumeLayout(rp, ttl, volumeType, c.volumeSizeLimit, c.replicationAsMin) }) return vl.(*VolumeLayout) } |
