MCPcopy
hub / github.com/perkeep/perkeep / GetHub

Function GetHub

pkg/blobserver/blobhub.go:59–72  ·  view source on GitHub ↗

GetHub return a BlobHub for the given storage implementation.

(storage interface{})

Source from the content-addressed store, hash-verified

57
58// GetHub return a BlobHub for the given storage implementation.
59func GetHub(storage interface{}) BlobHub {
60 if h, ok := getHub(storage); ok {
61 return h
62 }
63 hubmu.Lock()
64 defer hubmu.Unlock()
65 h, ok := stohub[storage]
66 if ok {
67 return h
68 }
69 h = new(memHub)
70 stohub[storage] = h
71 return h
72}
73
74func getHub(storage interface{}) (BlobHub, bool) {
75 hubmu.RLock()

Callers 6

subscribeToNewBlobsMethod · 0.92
TestReceiveFunction · 0.92
newSyncFromConfigFunction · 0.92
NewSyncHandlerFunction · 0.92
WaitForBlobFunction · 0.85
receiveFunction · 0.85

Calls 3

getHubFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by 1

TestReceiveFunction · 0.74