java.lang.Object
org.elasticsearch.xpack.core.transform.transforms.TransformCheckpoint
All Implemented Interfaces:
Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class TransformCheckpoint extends Object implements Writeable, org.elasticsearch.xcontent.ToXContentObject
Checkpoint document to store the checkpoint of a transform The fields: timestamp the timestamp when this document has been created checkpoint the checkpoint number, incremented for every checkpoint, if -1 this is a non persisted checkpoint indices a map of the indices from the source including all checkpoints of all indices matching the source pattern, shard level time_upper_bound for time-based indices this holds the upper time boundary of this checkpoint
  • Field Details

    • EMPTY_NAME

      public static final String EMPTY_NAME
      See Also:
    • EMPTY

      public static final TransformCheckpoint EMPTY
    • CHECKPOINT

      public static final org.elasticsearch.xcontent.ParseField CHECKPOINT
    • INDICES

      public static final org.elasticsearch.xcontent.ParseField INDICES
    • NAME

      public static final String NAME
      See Also:
  • Constructor Details

    • TransformCheckpoint

      public TransformCheckpoint(String transformId, long timestamp, long checkpoint, Map<String,long[]> checkpoints, Long timeUpperBound)
    • TransformCheckpoint

      public TransformCheckpoint(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • createEmpty

      public static TransformCheckpoint createEmpty(long timestampMillis)
    • isEmpty

      public boolean isEmpty()
    • isTransient

      public boolean isTransient()
      Whether this checkpoint is a transient (non persisted) checkpoint
      Returns:
      true if this is a transient checkpoint, false otherwise
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Create XContent for the purpose of storing it in the internal index Note:
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Parameters:
      builder - the XContentBuilder
      params - builder specific parameters
      Returns:
      builder instance
      Throws:
      IOException
    • getTransformId

      public String getTransformId()
    • getTimestamp

      public long getTimestamp()
    • getCheckpoint

      public long getCheckpoint()
    • getIndicesCheckpoints

      public Map<String,long[]> getIndicesCheckpoints()
    • getTimeUpperBound

      public long getTimeUpperBound()
    • writeTo

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • matches

      public boolean matches(TransformCheckpoint that)
      Compares 2 checkpoints ignoring some inner fields. This is for comparing 2 checkpoints to check whether the transform requires an update
      Parameters:
      that - other checkpoint
      Returns:
      true if checkpoints match
    • hashCode

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

      public static TransformCheckpoint fromXContent(org.elasticsearch.xcontent.XContentParser parser, boolean lenient) throws IOException
      Throws:
      IOException
    • documentId

      public static String documentId(String transformId, long checkpoint)
    • isNullOrEmpty

      public static boolean isNullOrEmpty(TransformCheckpoint checkpoint)
    • getBehind

      public static long getBehind(TransformCheckpoint oldCheckpoint, TransformCheckpoint newCheckpoint)
      Calculate the diff of 2 checkpoints This is to get an indicator for the difference between checkpoints. Note: order is important
      Parameters:
      oldCheckpoint - the older checkpoint, if transient, newer must be transient, too
      newCheckpoint - the newer checkpoint, can be a transient checkpoint
      Returns:
      count number of operations the checkpoint is behind or -1L if it could not calculate the difference
    • getChangedIndices

      public static Collection<String> getChangedIndices(TransformCheckpoint oldCheckpoint, TransformCheckpoint newCheckpoint)