Class StoragePolicy
java.lang.Object
ecmwf.ecpds.master.storage.StoragePolicy
A Storage Lifecycle Policy. A policy can only shorten the physical retention of a data file, never extend it beyond
the lifetime (expiry) of the related transfers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe result of an evaluation.static enumThe policy modes.static final recordDescribes what is being evaluated. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default delay before dropping replicas (1 hour).static final StringThe name of the built-in policy applied when no other policy matches.static final longThe default requeue window (7 days).static final StringPrefix marking a file pattern as a regular expression. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longaddDuration(long start, long duration) static StoragePolicyGets the built-in default policy (the current behaviour with a 7 days requeue window).static List<StoragePolicy> Parses a list of rows.Gets the comment.longGets the delay before dropping replicas in milliseconds.Gets the file pattern.longintlongintlonggetMode()Gets the mode.getName()Gets the name.intgetOrder()Gets the order.longGets the requeue window in milliseconds.longguaranteedUntil(long windowStart, long expiry) Gets the time until which the original file is guaranteed to be kept for a requeue.booleanisActive()Checks if is active.booleanChecks if this is the built-in default policy.booleanChecks if the replicas are dropped.booleanChecks if the window restarts on requeue.booleanmatches(StoragePolicy.Subject subject) Checks that all the criteria of this policy match the subject (a policy without any criteria matches everything).static StoragePolicy.Matchselect(List<StoragePolicy> policies, StoragePolicy.Subject subject) Selects the policy for the subject.Splits a list separated by commas, semicolons or whitespace.
-
Field Details
-
DEFAULT_NAME
The name of the built-in policy applied when no other policy matches.- See Also:
-
DEFAULT_REQUEUE_WINDOW_MS
public static final long DEFAULT_REQUEUE_WINDOW_MSThe default requeue window (7 days).- See Also:
-
DEFAULT_DROP_REPLICAS_AFTER_MS
public static final long DEFAULT_DROP_REPLICAS_AFTER_MSThe default delay before dropping replicas (1 hour).- See Also:
-
REGEX_PREFIX
Prefix marking a file pattern as a regular expression.- See Also:
-
-
Constructor Details
-
StoragePolicy
Instantiates a new storage policy.- Parameters:
row- the row (keys as returned by the database interface)- Throws:
IllegalArgumentException- if a value is invalid
-
-
Method Details
-
defaultPolicy
Gets the built-in default policy (the current behaviour with a 7 days requeue window).- Returns:
- the default policy
-
isDefault
public boolean isDefault()Checks if this is the built-in default policy.- Returns:
- true, if it is the default policy
-
fromRows
-
select
public static StoragePolicy.Match select(List<StoragePolicy> policies, StoragePolicy.Subject subject) Selects the policy for the subject. A policy explicitly named by the destination option always wins. Otherwise the active, non-disabled policies are examined in order and the first one whose criteria all match is selected. If none matches the built-in default policy is returned.- Parameters:
policies- the policies (any order)subject- the subject- Returns:
- the match
-
matches
Checks that all the criteria of this policy match the subject (a policy without any criteria matches everything).- Parameters:
subject- the subject- Returns:
- true, if all the criteria match
-
guaranteedUntil
public long guaranteedUntil(long windowStart, long expiry) Gets the time until which the original file is guaranteed to be kept for a requeue. A policy can only shorten the retention, never extend it beyond the lifetime.- Parameters:
windowStart- the start of the window (time of the last activity)expiry- the expiry time of the transfer (the lifetime)- Returns:
- the time until which the requeue is guaranteed
-
addDuration
public static long addDuration(long start, long duration) -
getMinRetentionMs
public long getMinRetentionMs() -
getGraceMs
public long getGraceMs() -
getLazyReplicationMs
public long getLazyReplicationMs() -
getHighWatermark
public int getHighWatermark() -
getLowWatermark
public int getLowWatermark() -
splitList
-
getName
-
getComment
-
isActive
public boolean isActive()Checks if is active.- Returns:
- true, if active
-
getMode
-
getOrder
public int getOrder()Gets the order.- Returns:
- the order
-
getRequeueWindowMs
public long getRequeueWindowMs()Gets the requeue window in milliseconds.- Returns:
- the requeue window
-
isRestartOnRequeue
public boolean isRestartOnRequeue()Checks if the window restarts on requeue.- Returns:
- true, if it restarts
-
isDropReplicas
public boolean isDropReplicas()Checks if the replicas are dropped.- Returns:
- true, if they are dropped
-
getDropReplicasAfterMs
public long getDropReplicasAfterMs()Gets the delay before dropping replicas in milliseconds.- Returns:
- the delay
-
getFilePattern
-