aboutsummaryrefslogtreecommitdiff
path: root/go/storage/replica_placement.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2016-06-02 18:09:14 -0700
committerChris Lu <chris.lu@gmail.com>2016-06-02 18:09:14 -0700
commit5ce6bbf07672bf3f3c8d26cd2ce0e3e853a47c44 (patch)
tree2e4dd2ad0a618ab2b7cdebcdb9c503526c31e2e8 /go/storage/replica_placement.go
parentcaeffa3998adc060fa66c4cd77af971ff2d26c57 (diff)
downloadseaweedfs-5ce6bbf07672bf3f3c8d26cd2ce0e3e853a47c44.tar.xz
seaweedfs-5ce6bbf07672bf3f3c8d26cd2ce0e3e853a47c44.zip
directory structure change to work with glide
glide has its own requirements. My previous workaround caused me some code checkin errors. Need to fix this.
Diffstat (limited to 'go/storage/replica_placement.go')
-rw-r--r--go/storage/replica_placement.go53
1 files changed, 0 insertions, 53 deletions
diff --git a/go/storage/replica_placement.go b/go/storage/replica_placement.go
deleted file mode 100644
index c1aca52eb..000000000
--- a/go/storage/replica_placement.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package storage
-
-import (
- "errors"
- "fmt"
-)
-
-type ReplicaPlacement struct {
- SameRackCount int
- DiffRackCount int
- DiffDataCenterCount int
-}
-
-func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error) {
- rp := &ReplicaPlacement{}
- for i, c := range t {
- count := int(c - '0')
- if 0 <= count && count <= 2 {
- switch i {
- case 0:
- rp.DiffDataCenterCount = count
- case 1:
- rp.DiffRackCount = count
- case 2:
- rp.SameRackCount = count
- }
- } else {
- return rp, errors.New("Unknown Replication Type:" + t)
- }
- }
- return rp, nil
-}
-
-func NewReplicaPlacementFromByte(b byte) (*ReplicaPlacement, error) {
- return NewReplicaPlacementFromString(fmt.Sprintf("%03d", b))
-}
-
-func (rp *ReplicaPlacement) Byte() byte {
- ret := rp.DiffDataCenterCount*100 + rp.DiffRackCount*10 + rp.SameRackCount
- return byte(ret)
-}
-
-func (rp *ReplicaPlacement) String() string {
- b := make([]byte, 3)
- b[0] = byte(rp.DiffDataCenterCount + '0')
- b[1] = byte(rp.DiffRackCount + '0')
- b[2] = byte(rp.SameRackCount + '0')
- return string(b)
-}
-
-func (rp *ReplicaPlacement) GetCopyCount() int {
- return rp.DiffDataCenterCount + rp.DiffRackCount + rp.SameRackCount + 1
-}