MCPcopy Index your code
hub / github.com/perkeep/perkeep / fetchOrErrorString

Method fetchOrErrorString

pkg/blobserver/encrypt/encrypt_test.go:60–71  ·  view source on GitHub ↗

fetchOrErrorString fetches br from sto and returns its body as a string. If an error occurs the stringified error is returned, prefixed by "Error: ".

(br blob.Ref)

Source from the content-addressed store, hash-verified

58// fetchOrErrorString fetches br from sto and returns its body as a string.
59// If an error occurs the stringified error is returned, prefixed by "Error: ".
60func (ts *testStorage) fetchOrErrorString(br blob.Ref) string {
61 rc, _, err := ts.sto.Fetch(ctxbg, br)
62 var slurp []byte
63 if err == nil {
64 defer rc.Close()
65 slurp, err = io.ReadAll(rc)
66 }
67 if err != nil {
68 return fmt.Sprintf("Error: %v", err)
69 }
70 return string(slurp)
71}
72
73func newTestStorage() *testStorage {
74 sto := &storage{

Callers 3

TestEncryptFunction · 0.80
TestEncryptStressFunction · 0.80
TestLoadMetaFunction · 0.80

Calls 3

ReadAllMethod · 0.80
FetchMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected