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

Function uploadString

pkg/schema/filewriter.go:140–156  ·  view source on GitHub ↗
(ctx context.Context, bs blobserver.StatReceiver, br blob.Ref, s string)

Source from the content-addressed store, hash-verified

138}
139
140func uploadString(ctx context.Context, bs blobserver.StatReceiver, br blob.Ref, s string) (blob.Ref, error) {
141 if !br.Valid() {
142 panic("invalid blobref")
143 }
144 hasIt, err := serverHasBlob(ctx, bs, br)
145 if err != nil {
146 return blob.Ref{}, err
147 }
148 if hasIt {
149 return br, nil
150 }
151 _, err = blobserver.ReceiveNoHash(ctx, bs, br, strings.NewReader(s))
152 if err != nil {
153 return blob.Ref{}, err
154 }
155 return br, nil
156}
157
158// uploadBytes populates bb (a builder of either type "bytes" or
159// "file", which is a superset of "bytes"), sets it to the provided

Callers 2

uploadBytesFunction · 0.85
writeFileChunksFunction · 0.85

Calls 3

ReceiveNoHashFunction · 0.92
serverHasBlobFunction · 0.85
ValidMethod · 0.45

Tested by

no test coverage detected