Module org.elasticsearch.xcore
Package org.elasticsearch.xpack.core.slm
Class SnapshotLifecyclePolicy
java.lang.Object
org.elasticsearch.xpack.core.slm.SnapshotLifecyclePolicy
- All Implemented Interfaces:
Diffable<SnapshotLifecyclePolicy>,SimpleDiffable<SnapshotLifecyclePolicy>,Writeable,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject
public class SnapshotLifecyclePolicy
extends Object
implements SimpleDiffable<SnapshotLifecyclePolicy>, Writeable, org.elasticsearch.xcontent.ToXContentObject
A
SnapshotLifecyclePolicy is a policy for the cluster including a schedule of when a
snapshot should be triggered, what the snapshot should be named, what repository it should go
to, and the configuration for the snapshot itself.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.SimpleDiffable
SimpleDiffable.CompleteDiff<T extends Diffable<T>>Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.cluster.SimpleDiffable
EMPTYFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionSnapshotLifecyclePolicy(String id, String name, String schedule, String repository, Map<String, Object> configuration, SnapshotRetentionConfiguration retentionPolicy) SnapshotLifecyclePolicy(String id, String name, String schedule, String repository, Map<String, Object> configuration, SnapshotRetentionConfiguration retentionPolicy, org.elasticsearch.core.TimeValue unhealthyIfNoSnapshotWithin) -
Method Summary
Modifier and TypeMethodDescriptionbuildSchedulerJob(String jobId, long modifiedDate) longcalculateNextExecution(long modifiedDate, Clock clock) org.elasticsearch.core.TimeValuecalculateNextInterval(Clock clock) Calculate the difference between the next two valid times after now for the schedule.booleangetId()getName()org.elasticsearch.core.TimeValueinthashCode()static booleanisIntervalSchedule(String schedule) static SnapshotLifecyclePolicytoRequest(org.elasticsearch.core.TimeValue masterNodeTimeout) Generate a new create snapshot request from this policy.toString()org.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) validate()voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.SimpleDiffable
diffMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
SnapshotLifecyclePolicy
-
SnapshotLifecyclePolicy
-
SnapshotLifecyclePolicy
- Throws:
IOException
-
-
Method Details
-
getId
-
getName
-
getSchedule
-
getRepository
-
getConfig
-
getRetentionPolicy
-
getUnhealthyIfNoSnapshotWithin
@Nullable public org.elasticsearch.core.TimeValue getUnhealthyIfNoSnapshotWithin() -
isIntervalSchedule
- Returns:
- whether `schedule` is an interval time unit expression
-
calculateNextExecution
-
calculateNextInterval
Calculate the difference between the next two valid times after now for the schedule.In ordinary cases, this can be treated as the interval between executions of the schedule (for schedules like 'twice an hour' or 'every five minutes').
- Parameters:
clock- a clock to provide current time- Returns:
- a
TimeValuerepresenting the difference between the next two valid times after now, orTimeValue.MINUS_ONEif either of the next two times after now is unsupported according to @Cron.getNextValidTimeAfter(long)
-
buildSchedulerJob
-
validate
-
toRequest
Generate a new create snapshot request from this policy. The name of the snapshot is generated at this time based on any date math expressions in the "name" field. -
parse
public static SnapshotLifecyclePolicy parse(org.elasticsearch.xcontent.XContentParser parser, String id) -
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
hashCode
public int hashCode() -
equals
-
toString
-