collection.GetCollectionsParams{
Client: arv, Logger: arvLogger, BatchSize: 50}) }()
- RunKeep(keep.GetKeepServersParams{Client: arv, Limit: 1000})
+ keepServerInfo := keep.GetKeepServersAndSummarize(
+ keep.GetKeepServersParams{Client: arv, Limit: 1000})
readCollections := <-collectionChannel
- _ = readCollections // Make compiler happy.
+
+ // Make compiler happy.
+ _ = readCollections
+ _ = keepServerInfo
// Log that we're finished
if arvLogger != nil {
}
}
-func RunKeep(params keep.GetKeepServersParams) {
- readServers := keep.GetKeepServers(params)
-
- log.Printf("Returned %d keep disks", len(readServers.ServerToContents))
-
- blockReplicationCounts := make(map[int]int)
- for _, infos := range readServers.BlockToServers {
- replication := len(infos)
- blockReplicationCounts[replication] += 1
- }
-
- log.Printf("Replication level distribution: %v", blockReplicationCounts)
-}
-
func LogMemoryAlloc(properties map[string]interface{}, entry map[string]interface{}) {
_ = entry // keep the compiler from complaining
runInfo := properties["run_info"].(map[string]interface{})
}
type ReadServers struct {
- ReadAllServers bool
- KeepServerIndexToAddress []ServerAddress
- KeepServerAddressToIndex map[ServerAddress]int
- ServerToContents map[ServerAddress]ServerContents
- BlockToServers map[blockdigest.BlockDigest][]BlockServerInfo
+ ReadAllServers bool
+ KeepServerIndexToAddress []ServerAddress
+ KeepServerAddressToIndex map[ServerAddress]int
+ ServerToContents map[ServerAddress]ServerContents
+ BlockToServers map[blockdigest.BlockDigest][]BlockServerInfo
+ BlockReplicationCounts map[int]int
}
type GetKeepServersParams struct {
return dataManagerToken
}
+func GetKeepServersAndSummarize(params GetKeepServersParams) (results ReadServers) {
+ results = GetKeepServers(params)
+ log.Printf("Returned %d keep disks", len(results.ServerToContents))
+
+ ComputeBlockReplicationCounts(&results)
+ log.Printf("Replication level distribution: %v",
+ results.BlockReplicationCounts)
+
+ return
+}
+
func GetKeepServers(params GetKeepServersParams) (results ReadServers) {
if ¶ms.Client == nil {
log.Fatalf("params.Client passed to GetKeepServers() should " +
blockInfo.Size = locator.Size
return
}
+
+func ComputeBlockReplicationCounts(readServers *ReadServers) {
+ readServers.BlockReplicationCounts = make(map[int]int)
+ for _, infos := range readServers.BlockToServers {
+ replication := len(infos)
+ readServers.BlockReplicationCounts[replication] += 1
+ }
+}