@@ -294,7 +294,7 @@ func (d *DynamoDBBackend) Put(ctx context.Context, entry *physical.Entry) error
294
294
})
295
295
}
296
296
297
- return d .batchWriteRequests (requests )
297
+ return d .batchWriteRequests (ctx , requests )
298
298
}
299
299
300
300
// Get is used to fetch an entry
@@ -304,7 +304,7 @@ func (d *DynamoDBBackend) Get(ctx context.Context, key string) (*physical.Entry,
304
304
d .permitPool .Acquire ()
305
305
defer d .permitPool .Release ()
306
306
307
- resp , err := d .client .GetItem ( & dynamodb.GetItemInput {
307
+ resp , err := d .client .GetItemWithContext ( ctx , & dynamodb.GetItemInput {
308
308
TableName : aws .String (d .table ),
309
309
ConsistentRead : aws .Bool (true ),
310
310
Key : map [string ]* dynamodb.AttributeValue {
@@ -363,7 +363,7 @@ func (d *DynamoDBBackend) Delete(ctx context.Context, key string) error {
363
363
excluded = append (excluded , recordKeyForVaultKey (prefixes [index - 1 ]))
364
364
}
365
365
366
- hasChildren , err := d .hasChildren (prefix , excluded )
366
+ hasChildren , err := d .hasChildren (ctx , prefix , excluded )
367
367
if err != nil {
368
368
return err
369
369
}
@@ -387,7 +387,7 @@ func (d *DynamoDBBackend) Delete(ctx context.Context, key string) error {
387
387
}
388
388
}
389
389
390
- return d .batchWriteRequests (requests )
390
+ return d .batchWriteRequests (ctx , requests )
391
391
}
392
392
393
393
// List is used to list all the keys under a given
@@ -420,7 +420,7 @@ func (d *DynamoDBBackend) List(ctx context.Context, prefix string) ([]string, er
420
420
d .permitPool .Acquire ()
421
421
defer d .permitPool .Release ()
422
422
423
- err := d .client .QueryPages ( queryInput , func (out * dynamodb.QueryOutput , lastPage bool ) bool {
423
+ err := d .client .QueryPagesWithContext ( ctx , queryInput , func (out * dynamodb.QueryOutput , lastPage bool ) bool {
424
424
var record DynamoDBRecord
425
425
for _ , item := range out .Items {
426
426
dynamodbattribute .UnmarshalMap (item , & record )
@@ -443,7 +443,7 @@ func (d *DynamoDBBackend) List(ctx context.Context, prefix string) ([]string, er
443
443
// before any deletes take place. To account for that hasChildren accepts a slice of
444
444
// strings representing values we expect to find that should NOT be counted as children
445
445
// because they are going to be deleted.
446
- func (d * DynamoDBBackend ) hasChildren (prefix string , exclude []string ) (bool , error ) {
446
+ func (d * DynamoDBBackend ) hasChildren (ctx context. Context , prefix string , exclude []string ) (bool , error ) {
447
447
prefix = strings .TrimSuffix (prefix , "/" )
448
448
prefix = escapeEmptyPath (prefix )
449
449
@@ -473,7 +473,7 @@ func (d *DynamoDBBackend) hasChildren(prefix string, exclude []string) (bool, er
473
473
d .permitPool .Acquire ()
474
474
defer d .permitPool .Release ()
475
475
476
- out , err := d .client .Query ( queryInput )
476
+ out , err := d .client .QueryWithContext ( ctx , queryInput )
477
477
if err != nil {
478
478
return false , err
479
479
}
@@ -519,7 +519,7 @@ func (d *DynamoDBBackend) HAEnabled() bool {
519
519
520
520
// batchWriteRequests takes a list of write requests and executes them in badges
521
521
// with a maximum size of 25 (which is the limit of BatchWriteItem requests).
522
- func (d * DynamoDBBackend ) batchWriteRequests (requests []* dynamodb.WriteRequest ) error {
522
+ func (d * DynamoDBBackend ) batchWriteRequests (ctx context. Context , requests []* dynamodb.WriteRequest ) error {
523
523
for len (requests ) > 0 {
524
524
batchSize := int (math .Min (float64 (len (requests )), 25 ))
525
525
batch := map [string ][]* dynamodb.WriteRequest {d .table : requests [:batchSize ]}
@@ -534,7 +534,7 @@ func (d *DynamoDBBackend) batchWriteRequests(requests []*dynamodb.WriteRequest)
534
534
535
535
for len (batch ) > 0 {
536
536
var output * dynamodb.BatchWriteItemOutput
537
- output , err = d .client .BatchWriteItem ( & dynamodb.BatchWriteItemInput {
537
+ output , err = d .client .BatchWriteItemWithContext ( ctx , & dynamodb.BatchWriteItemInput {
538
538
RequestItems : batch ,
539
539
})
540
540
if err != nil {
0 commit comments