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
Issue: ARSN-411
  • Loading branch information
Kerkesni committed Nov 5, 2024
1 parent 94c7038 commit 47eea32
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/models/ObjectMD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type ObjectMDData = {
'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 @@ -231,8 +231,8 @@ export default class ObjectMD {
},
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 @@ -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 47eea32

Please sign in to comment.