(ctx context.Context, br blob.Ref, src io.Reader)
| 219 | } |
| 220 | |
| 221 | func (sto *Storage) ReceiveBlob(ctx context.Context, br blob.Ref, src io.Reader) (blob.SizedRef, error) { |
| 222 | // Slurp the whole blob before replicating. Bounded by 16 MB anyway. |
| 223 | var buf bytes.Buffer |
| 224 | if _, err := io.Copy(&buf, src); err != nil { |
| 225 | return blob.SizedRef{}, err |
| 226 | } |
| 227 | |
| 228 | sb, err := sto.origin.ReceiveBlob(ctx, br, bytes.NewReader(buf.Bytes())) |
| 229 | if err != nil { |
| 230 | return sb, err |
| 231 | } |
| 232 | |
| 233 | if _, err := sto.cache.ReceiveBlob(ctx, br, bytes.NewReader(buf.Bytes())); err != nil { |
| 234 | log.Printf("proxycache: ignoring error populating blob %v in cache: %v", br, err) |
| 235 | } else { |
| 236 | sto.touch(sb) |
| 237 | } |
| 238 | return sb, err |
| 239 | } |
| 240 | |
| 241 | func (sto *Storage) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error { |
| 242 | var gr syncutil.Group |
nothing calls this directly
no test coverage detected