Skip to content

NC | lifecycle | add noncurrent days rule #8992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/manage_nsfs/nc_lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ class NCLifecycle {

/**
* check if object is delete candidate based on newer noncurrent versions rule
* @param {Object} object_info
* @param {nb.ObjectInfo} object_info
* @param {Object} newer_noncurrent_state
* @param {Number} num_newer_versions
* @returns
Expand All @@ -600,21 +600,22 @@ class NCLifecycle {

/**
* check if object is delete candidate based on number of noncurrent days rule
* @param {Object} object_info
* @param {nb.ObjectInfo} object_info
* @param {Number} num_non_current_days
* @returns
*/
filter_noncurrent_days(object_info, num_non_current_days) {
//TODO implement
return true;
if (object_info.is_latest) return false;
const noncurrent_time = object_info.nc_noncurrent_time;
return lifecycle_utils.get_file_age_days(noncurrent_time) >= num_non_current_days;
}

/**
* get_candidates_by_noncurrent_version_expiration_rule processes the noncurrent version expiration rule
* TODO:
* POSIX - need to support both noncurrent_days and newer_noncurrent_versions
* GPFS - implement noncurrent_days using GPFS ILM policy as an optimization
* @param {*} lifecycle_rule
* @param {Object} lifecycle_rule
* @param {Object} bucket_json
* @returns {Promise<Object[]>}
*/
Expand Down
3 changes: 3 additions & 0 deletions src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,8 @@ class NamespaceFS {
const storage_class = Glacier.storage_class_from_xattr(stat.xattr);
const size = Number(stat.xattr?.[XATTR_DIR_CONTENT] || stat.size);
const tag_count = stat.xattr ? this._number_of_tags_fs_xttr(stat.xattr) : 0;
const nc_noncurrent_time = (stat.xattr?.[XATTR_NON_CURRENT_TIMESTASMP] && Number(stat.xattr[XATTR_NON_CURRENT_TIMESTASMP])) ||
stat.ctime.getTime();

return {
obj_id: etag,
Expand All @@ -2652,6 +2654,7 @@ class NamespaceFS {
xattr: to_xattr(stat.xattr),
tag_count,
tagging: get_tags_from_xattr(stat.xattr),
nc_noncurrent_time,

// temp:
lock_settings: undefined,
Expand Down
1 change: 1 addition & 0 deletions src/sdk/nb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ interface ObjectInfo {
restore_status?: RestoreStatus;
checksum?: Checksum;
object_parts?: GetObjectAttributesParts;
nc_noncurrent_time ?: number;
}


Expand Down
Loading