diff --git a/common/pkgs/servicestats/hub_strorage_transfer.go b/common/pkgs/servicestats/hub_strorage_transfer.go index 4f86b71..9fcbe22 100644 --- a/common/pkgs/servicestats/hub_strorage_transfer.go +++ b/common/pkgs/servicestats/hub_strorage_transfer.go @@ -5,23 +5,23 @@ import ( "sync" "time" - cdssdk "gitlink.org.cn/cloudream/common/sdks/storage" "gitlink.org.cn/cloudream/common/utils/math2" + cortypes "gitlink.org.cn/cloudream/storage2/coordinator/types" ) type HubStorageTransferStats struct { data HubStorageTransferStatsData - fromHubID cdssdk.HubID + fromHubID cortypes.HubID lock *sync.Mutex } type HubStorageTransferStatsData struct { - Entries map[cdssdk.StorageID]*HubStorageTransferStatsEntry + Entries map[cortypes.StorageID]*HubStorageTransferStatsEntry StartTime time.Time } type HubStorageTransferStatsEntry struct { - DestStorageID cdssdk.StorageID + DestStorageID cortypes.StorageID OutputBytes int64 MaxOutputBytes int64 @@ -36,7 +36,7 @@ type HubStorageTransferStatsEntry struct { SuccessInput int64 } -func (s *HubStorageTransferStats) RecordUpload(dstStorageID cdssdk.StorageID, transferBytes int64, isSuccess bool) { +func (s *HubStorageTransferStats) RecordUpload(dstStorageID cortypes.StorageID, transferBytes int64, isSuccess bool) { s.lock.Lock() defer s.lock.Unlock() @@ -58,7 +58,7 @@ func (s *HubStorageTransferStats) RecordUpload(dstStorageID cdssdk.StorageID, tr e.TotalOutput++ } -func (s *HubStorageTransferStats) RecordDownload(dstStorageID cdssdk.StorageID, transferBytes int64, isSuccess bool) { +func (s *HubStorageTransferStats) RecordDownload(dstStorageID cortypes.StorageID, transferBytes int64, isSuccess bool) { s.lock.Lock() defer s.lock.Unlock() @@ -83,7 +83,7 @@ func (s *HubStorageTransferStats) Reset() time.Time { s.lock.Lock() defer s.lock.Unlock() - s.data.Entries = make(map[cdssdk.StorageID]*HubStorageTransferStatsEntry) + s.data.Entries = make(map[cortypes.StorageID]*HubStorageTransferStatsEntry) s.data.StartTime = time.Now() return s.data.StartTime } @@ -93,7 +93,7 @@ func (s *HubStorageTransferStats) DumpData() HubStorageTransferStatsData { defer s.lock.Unlock() data := s.data - data.Entries = make(map[cdssdk.StorageID]*HubStorageTransferStatsEntry) + data.Entries = make(map[cortypes.StorageID]*HubStorageTransferStatsEntry) for k, v := range s.data.Entries { v2 := *v data.Entries[k] = &v2 diff --git a/common/pkgs/servicestats/hub_transfter.go b/common/pkgs/servicestats/hub_transfter.go index 9eeec51..58e6ec3 100644 --- a/common/pkgs/servicestats/hub_transfter.go +++ b/common/pkgs/servicestats/hub_transfter.go @@ -5,23 +5,23 @@ import ( "sync" "time" - cdssdk "gitlink.org.cn/cloudream/common/sdks/storage" "gitlink.org.cn/cloudream/common/utils/math2" + cortypes "gitlink.org.cn/cloudream/storage2/coordinator/types" ) type HubTransferStats struct { data HubTransferStatsData - fromHubID cdssdk.HubID + fromHubID cortypes.HubID lock *sync.Mutex } type HubTransferStatsData struct { - Entries map[cdssdk.HubID]*HubTransferStatsEntry + Entries map[cortypes.HubID]*HubTransferStatsEntry StartTime time.Time } type HubTransferStatsEntry struct { - DestHubID cdssdk.HubID + DestHubID cortypes.HubID OutputBytes int64 MaxOutputBytes int64 @@ -36,7 +36,7 @@ type HubTransferStatsEntry struct { SuccessInput int64 } -func (s *HubTransferStats) RecordOutput(dstHubID cdssdk.HubID, transferBytes int64, isSuccess bool) { +func (s *HubTransferStats) RecordOutput(dstHubID cortypes.HubID, transferBytes int64, isSuccess bool) { s.lock.Lock() defer s.lock.Unlock() @@ -58,7 +58,7 @@ func (s *HubTransferStats) RecordOutput(dstHubID cdssdk.HubID, transferBytes int e.TotalOutput++ } -func (s *HubTransferStats) RecordInput(dstHubID cdssdk.HubID, transferBytes int64, isSuccess bool) { +func (s *HubTransferStats) RecordInput(dstHubID cortypes.HubID, transferBytes int64, isSuccess bool) { s.lock.Lock() defer s.lock.Unlock() @@ -85,7 +85,7 @@ func (s *HubTransferStats) Reset() time.Time { defer s.lock.Unlock() s.data.StartTime = time.Now() - s.data.Entries = make(map[cdssdk.HubID]*HubTransferStatsEntry) + s.data.Entries = make(map[cortypes.HubID]*HubTransferStatsEntry) return s.data.StartTime } @@ -94,7 +94,7 @@ func (s *HubTransferStats) DumpData() HubTransferStatsData { defer s.lock.Unlock() data := s.data - data.Entries = make(map[cdssdk.HubID]*HubTransferStatsEntry) + data.Entries = make(map[cortypes.HubID]*HubTransferStatsEntry) for k, v := range s.data.Entries { v2 := *v data.Entries[k] = &v2 diff --git a/common/pkgs/servicestats/service_stats.go b/common/pkgs/servicestats/service_stats.go index 51c8333..55c7414 100644 --- a/common/pkgs/servicestats/service_stats.go +++ b/common/pkgs/servicestats/service_stats.go @@ -4,7 +4,7 @@ import ( "sync" "time" - cdssdk "gitlink.org.cn/cloudream/common/sdks/storage" + cortypes "gitlink.org.cn/cloudream/storage2/coordinator/types" ) type StatsHost struct { @@ -14,24 +14,24 @@ type StatsHost struct { HubStorageTransfer *HubStorageTransferStats } -func (h *StatsHost) SetupHubTransfer(fromHubID cdssdk.HubID) { +func (h *StatsHost) SetupHubTransfer(fromHubID cortypes.HubID) { h.HubTransfer = &HubTransferStats{ fromHubID: fromHubID, lock: &sync.Mutex{}, data: HubTransferStatsData{ StartTime: time.Now(), - Entries: make(map[cdssdk.HubID]*HubTransferStatsEntry), + Entries: make(map[cortypes.HubID]*HubTransferStatsEntry), }, } } -func (h *StatsHost) SetupHubStorageTransfer(fromHubID cdssdk.HubID) { +func (h *StatsHost) SetupHubStorageTransfer(fromHubID cortypes.HubID) { h.HubStorageTransfer = &HubStorageTransferStats{ fromHubID: fromHubID, lock: &sync.Mutex{}, data: HubStorageTransferStatsData{ StartTime: time.Now(), - Entries: make(map[cdssdk.StorageID]*HubStorageTransferStatsEntry), + Entries: make(map[cortypes.StorageID]*HubStorageTransferStatsEntry), }, } }