GetHub return a BlobHub for the given storage implementation.
(storage interface{})
| 57 | |
| 58 | // GetHub return a BlobHub for the given storage implementation. |
| 59 | func 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 | |
| 74 | func getHub(storage interface{}) (BlobHub, bool) { |
| 75 | hubmu.RLock() |