Skip to content

Commit

Permalink
do not initialize fields in ObjectMD that are not used in S3C
Browse files Browse the repository at this point in the history
We set fields that are not used in S3C to undefined to avoid serializing
and unecessarilty store them in the metadata. This could affect sizing and
the load on the platform.

Issue: ARSN-411
  • Loading branch information
Kerkesni committed Nov 5, 2024
1 parent 94c7038 commit 91a0e3a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/models/ObjectMD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export type ReplicationInfo = {
role: string;
storageType: string;
dataStoreVersionId: string;
isNFS: boolean | null;
isNFS?: boolean;
};

export type ObjectMDData = {
'owner-display-name': string;
'owner-id': string;
'cache-control': string;
'content-disposition': string;
'content-language': string;
'content-language'?: string;
'content-encoding': string;
'creation-time'?: string;
'last-modified'?: string;
Expand Down Expand Up @@ -84,12 +84,12 @@ export type ObjectMDData = {
// Used for keeping object metadata in the oplog event
// In case of a deletion the flag is first updated before
// deleting the object
deleted: boolean;
deleted?: boolean;
// PHD flag indicates whether the object is a temporary placeholder.
// This is the case when the latest version of an object gets deleted
// the master is set as a placeholder and gets updated with the new latest
// version data after a certain amount of time.
isPHD: boolean;
isPHD?: boolean;
};

/**
Expand Down Expand Up @@ -183,7 +183,7 @@ export default class ObjectMD {
'content-length': 0,
'content-type': '',
'content-md5': '',
'content-language': '',
'content-language': undefined,
'creation-time': undefined,
// simple/no version. will expand once object versioning is
// introduced
Expand All @@ -197,7 +197,7 @@ export default class ObjectMD {
'x-amz-server-side-encryption-aws-kms-key-id': '',
'x-amz-server-side-encryption-customer-algorithm': '',
'x-amz-website-redirect-location': '',
'x-amz-scal-transition-in-progress': false,
'x-amz-scal-transition-in-progress': undefined,
acl: {
Canned: 'private',
FULL_CONTROL: [],
Expand Down Expand Up @@ -227,12 +227,12 @@ export default class ObjectMD {
role: '',
storageType: '',
dataStoreVersionId: '',
isNFS: null,
isNFS: undefined,
},
dataStoreName: '',
originOp: '',
deleted: false,
isPHD: false,
deleted: undefined,
isPHD: undefined,
};
}

Expand Down Expand Up @@ -479,7 +479,7 @@ export default class ObjectMD {
* @return content-language
*/
getContentLanguage() {
return this._data['content-language'];
return this._data['content-language'] || '';
}

/**
Expand Down Expand Up @@ -677,7 +677,7 @@ export default class ObjectMD {
* @return True if transition is in progress, false otherwise
*/
getTransitionInProgress() {
return this._data['x-amz-scal-transition-in-progress'];
return !!this._data['x-amz-scal-transition-in-progress'];
}

/**
Expand Down Expand Up @@ -1065,7 +1065,7 @@ export default class ObjectMD {
role,
storageType: storageType || '',
dataStoreVersionId: dataStoreVersionId || '',
isNFS: isNFS || null,
isNFS,
};
return this;
}
Expand Down Expand Up @@ -1461,7 +1461,7 @@ export default class ObjectMD {
* @return {Boolean}
*/
getDeleted() {
return this._data.deleted;
return !!this._data.deleted;
}

/**
Expand All @@ -1479,6 +1479,6 @@ export default class ObjectMD {
* @return {Boolean}
*/
getIsPHD() {
return this._data.isPHD;
return !!this._data.isPHD;
}
}

0 comments on commit 91a0e3a

Please sign in to comment.