aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/topology.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-04-18 21:43:36 -0700
committerChris Lu <chris.lu@gmail.com>2019-04-18 21:43:36 -0700
commite5506152c0a27d38fa334b2e338d82ee02669ab9 (patch)
tree1f589cbbf7244cbe5dbfe84ca89f5996e4ca9ff3 /weed/topology/topology.go
parent33c92b819a334b5709e6f1cbe304e4b8855c1238 (diff)
downloadseaweedfs-e5506152c0a27d38fa334b2e338d82ee02669ab9.tar.xz
seaweedfs-e5506152c0a27d38fa334b2e338d82ee02669ab9.zip
refactoring
Diffstat (limited to 'weed/topology/topology.go')
-rw-r--r--weed/topology/topology.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/weed/topology/topology.go b/weed/topology/topology.go
index 208c9b5b7..5426ec7e3 100644
--- a/weed/topology/topology.go
+++ b/weed/topology/topology.go
@@ -9,6 +9,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/sequence"
"github.com/chrislusf/seaweedfs/weed/storage"
+ "github.com/chrislusf/seaweedfs/weed/storage/needle"
"github.com/chrislusf/seaweedfs/weed/util"
)
@@ -72,7 +73,7 @@ func (t *Topology) Leader() (string, error) {
return l, nil
}
-func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode {
+func (t *Topology) Lookup(collection string, vid needle.VolumeId) []*DataNode {
//maybe an issue if lots of collections?
if collection == "" {
for _, c := range t.collectionMap.Items() {
@@ -88,7 +89,7 @@ func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode {
return nil
}
-func (t *Topology) NextVolumeId() (storage.VolumeId, error) {
+func (t *Topology) NextVolumeId() (needle.VolumeId, error) {
vid := t.GetMaxVolumeId()
next := vid.Next()
if _, err := t.RaftServer.Do(NewMaxVolumeIdCommand(next)); err != nil {
@@ -108,10 +109,10 @@ func (t *Topology) PickForWrite(count uint64, option *VolumeGrowOption) (string,
return "", 0, nil, errors.New("No writable volumes available!")
}
fileId, count := t.Sequence.NextFileId(count)
- return storage.NewFileId(*vid, fileId, rand.Uint32()).String(), count, datanodes.Head(), nil
+ return needle.NewFileId(*vid, fileId, rand.Uint32()).String(), count, datanodes.Head(), nil
}
-func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPlacement, ttl *storage.TTL) *VolumeLayout {
+func (t *Topology) GetVolumeLayout(collectionName string, rp *storage.ReplicaPlacement, ttl *needle.TTL) *VolumeLayout {
return t.collectionMap.Get(collectionName, func() interface{} {
return NewCollection(collectionName, t.volumeSizeLimit)
}).(*Collection).GetOrCreateVolumeLayout(rp, ttl)