Do(*http.Request) (*http.Response, error)
}
-// Information about Arvados and Keep servers.
+// KeepClient holds information about Arvados and Keep servers.
type KeepClient struct {
Arvados *arvadosclient.ArvadosClient
Want_replicas int
return loc, nil
}
-// Get() retrieves a block, given a locator. Returns a reader, the
+// Get retrieves a block, given a locator. Returns a reader, the
// expected data length, the URL the block is being fetched from, and
// an error.
//
return rdr, size, url, err
}
-// ReadAt() retrieves a portion of block from the cache if it's
+// ReadAt retrieves a portion of block from the cache if it's
// present, otherwise from the network.
func (kc *KeepClient) ReadAt(locator string, p []byte, off int) (int, error) {
return kc.cache().ReadAt(kc, locator, p, off)
}
-// Ask() verifies that a block with the given hash is available and
+// Ask verifies that a block with the given hash is available and
// readable, according to at least one Keep service. Unlike Get, it
// does not retrieve the data or verify that the data content matches
// the hash specified by the locator.
return bytes.NewReader(respBody[0 : len(respBody)-1]), nil
}
-// LocalRoots() returns the map of local (i.e., disk and proxy) Keep
+// LocalRoots returns the map of local (i.e., disk and proxy) Keep
// services: uuid -> baseURI.
func (kc *KeepClient) LocalRoots() map[string]string {
kc.discoverServices()
return kc.localRoots
}
-// GatewayRoots() returns the map of Keep remote gateway services:
+// GatewayRoots returns the map of Keep remote gateway services:
// uuid -> baseURI.
func (kc *KeepClient) GatewayRoots() map[string]string {
kc.discoverServices()
return kc.gatewayRoots
}
-// WritableLocalRoots() returns the map of writable local Keep services:
+// WritableLocalRoots returns the map of writable local Keep services:
// uuid -> baseURI.
func (kc *KeepClient) WritableLocalRoots() map[string]string {
kc.discoverServices()
return fmt.Sprintf("https://%x.svc/", i)
}
-func FakeSvcUuid(i uint64) string {
+func FakeSvcUUID(i uint64) string {
return fmt.Sprintf("zzzzz-bi6l4-%015x", i)
}
func FakeServiceRoots(n uint64) map[string]string {
sr := map[string]string{}
for i := uint64(0); i < n; i++ {
- sr[FakeSvcUuid(i)] = FakeSvcRoot(i)
+ sr[FakeSvcUUID(i)] = FakeSvcRoot(i)
}
return sr
}
fakeroots := FakeServiceRoots(16)
// These reference probe orders are explained further in
// ../../python/tests/test_keep_client.py:
- expected_orders := []string{
+ expectedOrders := []string{
"3eab2d5fc9681074",
"097dba52e648f1c3",
"c5b4e023f8a7d691",
"9d81c02e76a3bf54",
}
- for h, expected_order := range expected_orders {
+ for h, expectedOrder := range expectedOrders {
hash := Md5String(fmt.Sprintf("%064x", h))
roots := NewRootSorter(fakeroots, hash).GetSortedRoots()
- for i, svc_id_s := range strings.Split(expected_order, "") {
- svc_id, err := strconv.ParseUint(svc_id_s, 16, 64)
+ for i, svcIDs := range strings.Split(expectedOrder, "") {
+ svcID, err := strconv.ParseUint(svcIDs, 16, 64)
c.Assert(err, Equals, nil)
- c.Check(roots[i], Equals, FakeSvcRoot(svc_id))
+ c.Check(roots[i], Equals, FakeSvcRoot(svcID))
}
}
}