Class Translog.Operation

java.lang.Object
org.elasticsearch.index.translog.Translog.Operation
All Implemented Interfaces:
Writeable
Direct Known Subclasses:
Translog.Delete, Translog.Index, Translog.NoOp
Enclosing class:
Translog

public abstract static sealed class Translog.Operation extends Object implements Writeable permits Translog.Delete, Translog.Index, Translog.NoOp
A generic interface representing an operation performed on the transaction log. Each is associated with a type.
  • Field Details

    • seqNo

      protected final long seqNo
    • primaryTerm

      protected final long primaryTerm
  • Constructor Details

    • Operation

      protected Operation(long seqNo, long primaryTerm)
  • Method Details

    • opType

      public abstract Translog.Operation.Type opType()
    • estimateSize

      public abstract long estimateSize()
    • seqNo

      public final long seqNo()
    • primaryTerm

      public final long primaryTerm()
    • readOperation

      public static Translog.Operation readOperation(StreamInput input) throws IOException
      Reads the type and the operation from the given stream.
      Throws:
      IOException
    • writeTo

      public final void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • writeHeader

      protected abstract void writeHeader(int format, StreamOutput out) throws IOException
      Writes the operation header. This is the body excluding the index source. This method only differs from writeBody for the Index operation. This is because deletes and no-ops do not have a source.
      Throws:
      IOException
    • writeBody

      protected abstract void writeBody(StreamOutput out) throws IOException
      Writes the entire operation body which comes after the byte indicating the operation type.
      Throws:
      IOException