File tree Expand file tree Collapse file tree 4 files changed +187
-31
lines changed
test/unit_tests/jest_tests Expand file tree Collapse file tree 4 files changed +187
-31
lines changed Original file line number Diff line number Diff line change @@ -588,7 +588,7 @@ class NCLifecycle {
588
588
589
589
/**
590
590
* check if object is delete candidate based on newer noncurrent versions rule
591
- * @param {Object } object_info
591
+ * @param {nb.ObjectInfo } object_info
592
592
* @param {Object } newer_noncurrent_state
593
593
* @param {Number } num_newer_versions
594
594
* @returns
@@ -608,21 +608,22 @@ class NCLifecycle {
608
608
609
609
/**
610
610
* check if object is delete candidate based on number of noncurrent days rule
611
- * @param {Object } object_info
611
+ * @param {nb.ObjectInfo } object_info
612
612
* @param {Number } num_non_current_days
613
613
* @returns
614
614
*/
615
615
filter_noncurrent_days ( object_info , num_non_current_days ) {
616
- //TODO implement
617
- return true ;
616
+ if ( object_info . is_latest ) return false ;
617
+ const noncurrent_time = object_info . nc_noncurrent_time ;
618
+ return lifecycle_utils . get_file_age_days ( noncurrent_time ) >= num_non_current_days ;
618
619
}
619
620
620
621
/**
621
622
* get_candidates_by_noncurrent_version_expiration_rule processes the noncurrent version expiration rule
622
623
* TODO:
623
624
* POSIX - need to support both noncurrent_days and newer_noncurrent_versions
624
625
* GPFS - implement noncurrent_days using GPFS ILM policy as an optimization
625
- * @param {* } lifecycle_rule
626
+ * @param {Object } lifecycle_rule
626
627
* @param {Object } bucket_json
627
628
* @returns {Promise<Object[]> }
628
629
*/
Original file line number Diff line number Diff line change @@ -2545,6 +2545,8 @@ class NamespaceFS {
2545
2545
const storage_class = Glacier . storage_class_from_xattr ( stat . xattr ) ;
2546
2546
const size = Number ( stat . xattr ?. [ XATTR_DIR_CONTENT ] || stat . size ) ;
2547
2547
const tag_count = stat . xattr ? this . _number_of_tags_fs_xttr ( stat . xattr ) : 0 ;
2548
+ const nc_noncurrent_time = ( stat . xattr ?. [ XATTR_NON_CURRENT_TIMESTASMP ] && Number ( stat . xattr [ XATTR_NON_CURRENT_TIMESTASMP ] ) ) ||
2549
+ stat . ctime . getTime ( ) ;
2548
2550
2549
2551
return {
2550
2552
obj_id : etag ,
@@ -2563,6 +2565,7 @@ class NamespaceFS {
2563
2565
xattr : to_xattr ( stat . xattr ) ,
2564
2566
tag_count,
2565
2567
tagging : get_tags_from_xattr ( stat . xattr ) ,
2568
+ nc_noncurrent_time,
2566
2569
2567
2570
// temp:
2568
2571
lock_settings : undefined ,
Original file line number Diff line number Diff line change @@ -442,6 +442,7 @@ interface ObjectInfo {
442
442
restore_status ?: RestoreStatus ;
443
443
checksum ?: Checksum ;
444
444
object_parts ?: GetObjectAttributesParts ;
445
+ nc_noncurrent_time ?: number ;
445
446
}
446
447
447
448
You can’t perform that action at this time.
0 commit comments