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

Method send

tests/unit/DummyService.js:8–61  ·  view source on GitHub ↗
(command)

Source from the content-addressed store, hash-verified

6 }
7
8 async send(command) {
9 const commandName = command.constructor.name;
10 const input = command.input;
11
12 switch (commandName) {
13 case 'HeadBucketCommand':
14 return {};
15 case 'GetBucketVersioningCommand':
16 if (this.versioning) {
17 return { Status: 'Enabled' };
18 }
19 return {};
20 case 'HeadObjectCommand':
21 return {
22 ContentLength: 1024 * 1024 * 1024,
23 };
24 case 'CompleteMultipartUploadCommand': {
25 const retObj = {
26 Bucket: input.Bucket,
27 Key: input.Key,
28 ETag: `"${uuidv4().replace(/-/g, '')}"`,
29 ContentLength: 1024 * 1024 * 1024,
30 };
31 if (this.versioning) {
32 retObj.VersionId = uuidv4().replace(/-/g, '');
33 }
34 return retObj;
35 }
36 case 'PutObjectCommand': {
37 const retObj = {
38 ETag: `"${uuidv4().replace(/-/g, '')}"`,
39 };
40 if (this.versioning) {
41 retObj.VersionId = uuidv4().replace(/-/g, '');
42 }
43 return retObj;
44 }
45 case 'CopyObjectCommand': {
46 const retObj = {
47 CopyObjectResult: {
48 ETag: `"${uuidv4().replace(/-/g, '')}"`,
49 LastModified: new Date().toISOString(),
50 },
51 VersionId: null,
52 };
53 if (this.versioning) {
54 retObj.VersionId = uuidv4().replace(/-/g, '');
55 }
56 return retObj;
57 }
58 default:
59 throw new Error(`Unsupported command: ${commandName}`);
60 }
61 }
62
63 // Legacy SDK v2 callback-based interface (for backwards compatibility)
64 headBucket(params, callback) {

Callers 15

onConnectionMethod · 0.80
pushStatsFunction · 0.80
receiveChannelDataFunction · 0.80
routeVeeam.jsFile · 0.80
createBucketFunction · 0.80
deleteBucketFunction · 0.80
putObjectFunction · 0.80
copyObjectFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected