aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/topology.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-05-06 10:00:25 -0700
committerGitHub <noreply@github.com>2021-05-06 10:00:25 -0700
commitaaad4b578b37accd240686ab08cb9980dfe6a13a (patch)
treefbc8be5bfedebd67938388bcc16ab2268406cf8c /weed/topology/topology.go
parent55a8f57381aaeeb0cfc1326646024a7052928965 (diff)
parentc4d32f6937236a83377e3937e311222fc04bd084 (diff)
downloadseaweedfs-aaad4b578b37accd240686ab08cb9980dfe6a13a.tar.xz
seaweedfs-aaad4b578b37accd240686ab08cb9980dfe6a13a.zip
Merge pull request #2049 from qieqieplus/async-assign
ahead of time volume assignment
Diffstat (limited to 'weed/topology/topology.go')
-rw-r--r--weed/topology/topology.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/weed/topology/topology.go b/weed/topology/topology.go
index 08ebd24fd..3932e3fbb 100644
--- a/weed/topology/topology.go
+++ b/weed/topology/topology.go
@@ -34,9 +34,10 @@ type Topology struct {
Sequence sequence.Sequencer
- chanFullVolumes chan storage.VolumeInfo
+ chanFullVolumes chan *storage.VolumeInfo
+ chanCrowdedVolumes chan *storage.VolumeInfo
- Configuration *Configuration
+ Configuration *Configuration
RaftServer raft.Server
}
@@ -56,7 +57,8 @@ func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, puls
t.Sequence = seq
- t.chanFullVolumes = make(chan storage.VolumeInfo)
+ t.chanFullVolumes = make(chan *storage.VolumeInfo)
+ t.chanCrowdedVolumes = make(chan *storage.VolumeInfo)
t.Configuration = &Configuration{}
@@ -122,9 +124,11 @@ func (t *Topology) NextVolumeId() (needle.VolumeId, error) {
return next, nil
}
+// deprecated
func (t *Topology) HasWritableVolume(option *VolumeGrowOption) bool {
vl := t.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl, option.DiskType)
- return vl.GetActiveVolumeCount(option) > 0
+ active, _ := vl.GetActiveVolumeCount(option)
+ return active > 0
}
func (t *Topology) PickForWrite(count uint64, option *VolumeGrowOption) (string, uint64, *DataNode, error) {