-
Notifications
You must be signed in to change notification settings - Fork 49
/
debug.go
46 lines (39 loc) · 947 Bytes
/
debug.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cluster
import (
"bytes"
"fmt"
"time"
)
/*
msmap is a map of all know memory-only memberStorages.
*/
var msmap = make(map[*DistributedStorage]*memberStorage)
/*
ClearMSMap clears the current map of known memory-only memberStorages.
*/
func ClearMSMap() {
msmap = make(map[*DistributedStorage]*memberStorage)
}
/*
DumpMemoryClusterLayout returns the current storage layout in a memory-only cluster
for a given storage manager (e.g. mainPerson.nodes for Person nodes of partition main).
*/
func DumpMemoryClusterLayout(smname string) string {
buf := new(bytes.Buffer)
for _, ms := range msmap {
buf.WriteString(fmt.Sprintf("MemoryStorage: %s\n", ms.gs.Name()))
buf.WriteString(ms.dump(smname))
}
return buf.String()
}
/*
WaitForTransfer waits for the datatransfer to happen.
*/
func WaitForTransfer() {
for _, ms := range msmap {
ms.transferWorker()
for ms.transferRunning {
time.Sleep(time.Millisecond)
}
}
}