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 @@ -2634,6 +2634,8 @@ class NamespaceFS {
2634
2634
const storage_class = Glacier . storage_class_from_xattr ( stat . xattr ) ;
2635
2635
const size = Number ( stat . xattr ?. [ XATTR_DIR_CONTENT ] || stat . size ) ;
2636
2636
const tag_count = stat . xattr ? this . _number_of_tags_fs_xttr ( stat . xattr ) : 0 ;
2637
+ const nc_noncurrent_time = ( stat . xattr ?. [ XATTR_NON_CURRENT_TIMESTASMP ] && Number ( stat . xattr [ XATTR_NON_CURRENT_TIMESTASMP ] ) ) ||
2638
+ stat . ctime . getTime ( ) ;
2637
2639
2638
2640
return {
2639
2641
obj_id : etag ,
@@ -2652,6 +2654,7 @@ class NamespaceFS {
2652
2654
xattr : to_xattr ( stat . xattr ) ,
2653
2655
tag_count,
2654
2656
tagging : get_tags_from_xattr ( stat . xattr ) ,
2657
+ nc_noncurrent_time,
2655
2658
2656
2659
// temp:
2657
2660
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