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.
  • Constructor Details

  • Method Details

    • getId

      public String getId()
    • getName

      public String getName()
    • getSchedule

      public String getSchedule()
    • getRepository

      public String getRepository()
    • getConfig

      @Nullable public Map<String,Object> getConfig()
    • getRetentionPolicy

      @Nullable public SnapshotRetentionConfiguration getRetentionPolicy()
    • getUnhealthyIfNoSnapshotWithin

      @Nullable public org.elasticsearch.core.TimeValue getUnhealthyIfNoSnapshotWithin()
    • isIntervalSchedule

      public static boolean isIntervalSchedule(String schedule)
      Returns:
      whether `schedule` is an interval time unit expression
    • calculateNextExecution

      public long calculateNextExecution(long modifiedDate, Clock clock)
    • calculateNextInterval

      public org.elasticsearch.core.TimeValue calculateNextInterval(Clock clock)
      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 TimeValue representing the difference between the next two valid times after now, or TimeValue.MINUS_ONE if either of the next two times after now is unsupported according to @Cron.getNextValidTimeAfter(long)
    • buildSchedulerJob

      public SchedulerEngine.Job buildSchedulerJob(String jobId, long modifiedDate)
    • validate

    • toRequest

      public CreateSnapshotRequest toRequest(org.elasticsearch.core.TimeValue masterNodeTimeout)
      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

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object