MCPcopy
hub / github.com/scality/cloudserver / putObjectWithCustomHeader

Function putObjectWithCustomHeader

tests/sur/quota.js:100–125  ·  view source on GitHub ↗
(bucket, key, size, vID, cb)

Source from the content-addressed store, hash-verified

98}
99
100function putObjectWithCustomHeader(bucket, key, size, vID, cb) {
101 const params = {
102 Bucket: bucket,
103 Key: key,
104 Body: Buffer.alloc(size),
105 };
106
107 const command = new PutObjectCommand(params);
108 command.middlewareStack.add(
109 next => async args => {
110 // eslint-disable-next-line no-param-reassign
111 args.request.headers['x-scal-s3-version-id'] = vID;
112 return next(args);
113 },
114 { step: 'build' }
115 );
116
117 return s3Client.send(command)
118 .then(data => {
119 if (!s3Config.isQuotaInflightEnabled()) {
120 mockScuba.incrementBytesForBucket(bucket, 0);
121 }
122 cb(null, data);
123 })
124 .catch(cb);
125}
126
127function copyObject(bucket, key, sourceSize, cb) {
128 return s3Client.send(new CopyObjectCommand({

Callers 1

quota.jsFile · 0.85

Calls 3

sendMethod · 0.80

Tested by

no test coverage detected