Skip to content

Commit

Permalink
Use uuid v4 with named import
Browse files Browse the repository at this point in the history
issue: BB-585
  • Loading branch information
KillianG committed Nov 5, 2024
1 parent 58710fc commit 4a218a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions extensions/lifecycle/LifecycleQueuePopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { mpuBucketPrefix } = constants;
const QueuePopulatorExtension =
require('../../lib/queuePopulator/QueuePopulatorExtension');
const { authTypeAssumeRole } = require('../../lib/constants');
const uuid = require('uuid/v4');
const { v4 } = require('uuid');
const safeJsonParse = require('./util/safeJsonParse');
const { LifecycleMetrics } = require('./LifecycleMetrics');
const LIFECYCLE_BUCKETS_ZK_PATH = '/data/buckets';
Expand Down Expand Up @@ -322,7 +322,7 @@ class LifecycleQueuePopulator extends QueuePopulatorExtension {
objectKey: value.key,
objectVersion: version,
archiveInfo: value.archive.archiveInfo,
requestId: uuid(),
requestId: v4(),
eTag: value['content-md5'],
transitionTime: transitionTime.toISOString(),
accountId,
Expand Down Expand Up @@ -366,7 +366,7 @@ class LifecycleQueuePopulator extends QueuePopulatorExtension {
restoreWillExpireAt: expiryDate.toISOString(),
},
updatedAt: md['last-modified'],
requestId: uuid(),
requestId: v4(),
});

const coldLocation = md['x-amz-storage-class'];
Expand Down
4 changes: 2 additions & 2 deletions extensions/replication/tasks/CopyLocationTask.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const async = require('async');
const uuid = require('uuid/v4');
const { v4 } = require('uuid');

const { errors, jsutil, models } = require('arsenal');
const { ObjectMD } = models;
Expand Down Expand Up @@ -614,7 +614,7 @@ class CopyLocationTask extends BackbeatTask {
_initiateMPU(actionEntry, objMD, log, cb) {
// If using Azure backend, create a unique ID to use as the block ID.
if (this._getReplicationEndpointType() === 'azure') {
const uploadId = uuid().replace(/-/g, '');
const uploadId = v4().replace(/-/g, '');
return setImmediate(() => cb(null, uploadId));
}
const { bucket, key, version } = actionEntry.getAttribute('target');
Expand Down
4 changes: 2 additions & 2 deletions extensions/replication/tasks/MultipleBackendTask.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const async = require('async');
const uuid = require('uuid/v4');
const { v4 } = require('uuid');

const errors = require('arsenal').errors;
const jsutil = require('arsenal').jsutil;
Expand Down Expand Up @@ -471,7 +471,7 @@ class MultipleBackendTask extends ReplicateObject {
_initiateMPU(sourceEntry, log, cb) {
// If using Azure backend, create a unique ID to use as the block ID.
if (this._getReplicationEndpointType() === 'azure') {
const uploadId = uuid().replace(/-/g, '');
const uploadId = v4().replace(/-/g, '');
return setImmediate(() => cb(null, uploadId));
}
const destReq = this.backbeatSource.multipleBackendInitiateMPU({
Expand Down
4 changes: 2 additions & 2 deletions lib/models/ActionQueueEntry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const uuid = require('uuid/v4');
const { v4 } = require('uuid');

const errors = require('arsenal').errors;

Expand Down Expand Up @@ -52,7 +52,7 @@ class ActionQueueEntry {
*/
static create(actionType) {
return new ActionQueueEntry({
actionId: uuid(),
actionId: v4(),
action: actionType,
});
}
Expand Down

0 comments on commit 4a218a2

Please sign in to comment.