@@ -239,7 +239,7 @@ func (a *API) Retrieve(ctx context.Context, addr storage.Address) (reader storag
239239}
240240
241241// Store wraps the Store API call of the embedded FileStore
242- func (a * API ) Store (ctx context.Context , data io.Reader , size int64 , toEncrypt bool ) (addr storage.Address , wait func () , err error ) {
242+ func (a * API ) Store (ctx context.Context , data io.Reader , size int64 , toEncrypt bool ) (addr storage.Address , wait func (ctx context. Context ) error , err error ) {
243243 log .Debug ("api.store" , "size" , size )
244244 return a .fileStore .Store (ctx , data , size , toEncrypt )
245245}
@@ -286,7 +286,7 @@ func (a *API) Resolve(ctx context.Context, uri *URI) (storage.Address, error) {
286286}
287287
288288// Put provides singleton manifest creation on top of FileStore store
289- func (a * API ) Put (ctx context.Context , content string , contentType string , toEncrypt bool ) (k storage.Address , wait func () , err error ) {
289+ func (a * API ) Put (ctx context.Context , content string , contentType string , toEncrypt bool ) (k storage.Address , wait func (context. Context ) error , err error ) {
290290 apiPutCount .Inc (1 )
291291 r := strings .NewReader (content )
292292 key , waitContent , err := a .fileStore .Store (ctx , r , int64 (len (content )), toEncrypt )
@@ -301,9 +301,12 @@ func (a *API) Put(ctx context.Context, content string, contentType string, toEnc
301301 apiPutFail .Inc (1 )
302302 return nil , nil , err
303303 }
304- return key , func () {
305- waitContent ()
306- waitManifest ()
304+ return key , func (ctx context.Context ) error {
305+ err := waitContent (ctx )
306+ if err != nil {
307+ return err
308+ }
309+ return waitManifest (ctx )
307310 }, nil
308311}
309312
0 commit comments