@@ -43,6 +43,7 @@ type DirRequest struct {
43
43
connectionID string
44
44
timestamp int64
45
45
alreadyExists map [uint64 ]bool
46
+ customMeta string
46
47
Consensus
47
48
}
48
49
@@ -177,6 +178,13 @@ func (req *DirRequest) createDirInBlobber(blobber *blockchain.StorageNode, pos u
177
178
return err , false
178
179
}
179
180
181
+ if req .customMeta != "" {
182
+ err = formWriter .WriteField ("custom_meta" , req .customMeta )
183
+ if err != nil {
184
+ return err , false
185
+ }
186
+ }
187
+
180
188
formWriter .Close ()
181
189
httpreq , err := zboxutil .NewCreateDirRequest (blobber .Baseurl , req .allocationID , req .allocationTx , body )
182
190
if err != nil {
@@ -238,12 +246,12 @@ func (req *DirRequest) createDirInBlobber(blobber *blockchain.StorageNode, pos u
238
246
latestStatusCode = resp .StatusCode
239
247
240
248
msg = string (respBody )
241
- l .Logger .Error (blobber .Baseurl , " Response: " , msg )
242
249
if strings .Contains (msg , DirectoryExists ) {
243
250
req .Consensus .Done ()
244
251
alreadyExists = true
245
252
return
246
253
}
254
+ l .Logger .Error (blobber .Baseurl , " Response: " , msg )
247
255
248
256
err = errors .New ("response_error" , msg )
249
257
return
@@ -271,6 +279,7 @@ type DirOperation struct {
271
279
ctxCncl context.CancelFunc
272
280
dirMask zboxutil.Uint128
273
281
maskMU * sync.Mutex
282
+ customMeta string
274
283
alreadyExists map [uint64 ]bool
275
284
276
285
Consensus
@@ -290,6 +299,7 @@ func (dirOp *DirOperation) Process(allocObj *Allocation, connectionID string) ([
290
299
mu : dirOp .maskMU ,
291
300
wg : & sync.WaitGroup {},
292
301
alreadyExists : make (map [uint64 ]bool ),
302
+ customMeta : dirOp .customMeta ,
293
303
}
294
304
dR .Consensus = Consensus {
295
305
RWMutex : & sync.RWMutex {},
@@ -347,13 +357,14 @@ func (dirOp *DirOperation) Error(allocObj *Allocation, consensus int, err error)
347
357
348
358
}
349
359
350
- func NewDirOperation (remotePath string , dirMask zboxutil.Uint128 , maskMU * sync.Mutex , consensusTh int , fullConsensus int , ctx context.Context ) * DirOperation {
360
+ func NewDirOperation (remotePath , customMeta string , dirMask zboxutil.Uint128 , maskMU * sync.Mutex , consensusTh int , fullConsensus int , ctx context.Context ) * DirOperation {
351
361
dirOp := & DirOperation {}
352
362
dirOp .remotePath = zboxutil .RemoteClean (remotePath )
353
363
dirOp .dirMask = dirMask
354
364
dirOp .maskMU = maskMU
355
365
dirOp .consensusThresh = consensusTh
356
366
dirOp .fullconsensus = fullConsensus
367
+ dirOp .customMeta = customMeta
357
368
dirOp .ctx , dirOp .ctxCncl = context .WithCancel (ctx )
358
369
dirOp .alreadyExists = make (map [uint64 ]bool )
359
370
return dirOp
0 commit comments