/** * Creates a new instance in the {@link State#INPROGRESS} state. */ public static TransactionEdit createStarted(long writePointer, long visibilityUpperBound, long expirationDate, TransactionType type) { return new TransactionEdit(writePointer, visibilityUpperBound, State.INPROGRESS, expirationDate, null, 0L, false, type, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#COMMITTING} state. */ public static TransactionEdit createCommitting(long writePointer, Set<ChangeId> changes) { return new TransactionEdit(writePointer, 0L, State.COMMITTING, 0L, changes, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#COMMITTED} state. */ public static TransactionEdit createCommitted(long writePointer, Set<ChangeId> changes, long nextWritePointer, boolean canCommit) { return new TransactionEdit(writePointer, 0L, State.COMMITTED, 0L, changes, nextWritePointer, canCommit, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#ABORTED} state. */ public static TransactionEdit createAborted(long writePointer, TransactionType type, long[] checkpointPointers) { return new TransactionEdit(writePointer, 0L, State.ABORTED, 0L, null, 0L, false, type, null, 0L, 0L, checkpointPointers); }
/** * Creates a new instance in the {@link State#INPROGRESS} state. */ public static TransactionEdit createStarted(long writePointer, long visibilityUpperBound, long expirationDate, TransactionType type) { return new TransactionEdit(writePointer, visibilityUpperBound, State.INPROGRESS, expirationDate, null, 0L, false, type, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#MOVE_WATERMARK} state. */ public static TransactionEdit createMoveWatermark(long writePointer) { return new TransactionEdit(writePointer, 0L, State.MOVE_WATERMARK, 0L, null, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#ABORTED} state. */ public static TransactionEdit createAborted(long writePointer, TransactionType type, long[] checkpointPointers) { return new TransactionEdit(writePointer, 0L, State.ABORTED, 0L, null, 0L, false, type, null, 0L, 0L, checkpointPointers); }
/** * Creates a new instance in the {@link State#TRUNCATE_INVALID_TX} state. */ public static TransactionEdit createTruncateInvalidTx(Set<Long> truncateInvalidTx) { return new TransactionEdit(0L, 0L, State.TRUNCATE_INVALID_TX, 0L, null, 0L, false, null, truncateInvalidTx, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#MOVE_WATERMARK} state. */ public static TransactionEdit createMoveWatermark(long writePointer) { return new TransactionEdit(writePointer, 0L, State.MOVE_WATERMARK, 0L, null, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#TRUNCATE_INVALID_TX} state. */ public static TransactionEdit createTruncateInvalidTx(Set<Long> truncateInvalidTx) { return new TransactionEdit(0L, 0L, State.TRUNCATE_INVALID_TX, 0L, null, 0L, false, null, truncateInvalidTx, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#CHECKPOINT} state. */ public static TransactionEdit createCheckpoint(long writePointer, long parentWritePointer) { return new TransactionEdit(writePointer, 0L, State.CHECKPOINT, 0L, null, 0L, false, null, null, 0L, parentWritePointer, null); }
/** * Creates a new instance in the {@link State#COMMITTING} state. */ public static TransactionEdit createCommitting(long writePointer, Set<ChangeId> changes) { return new TransactionEdit(writePointer, 0L, State.COMMITTING, 0L, changes, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#ABORTED} state. */ public static TransactionEdit createAborted(long writePointer, TransactionType type, long[] checkpointPointers) { return new TransactionEdit(writePointer, 0L, State.ABORTED, 0L, null, 0L, false, type, null, 0L, 0L, checkpointPointers); }
/** * Creates a new instance in the {@link State#INVALID} state. */ public static TransactionEdit createInvalid(long writePointer) { return new TransactionEdit(writePointer, 0L, State.INVALID, 0L, null, 0L, false, null, null, 0L, 0L, null); }
/** * Creates a new instance in the {@link State#TRUNCATE_INVALID_TX} state. */ public static TransactionEdit createTruncateInvalidTxBefore(long truncateInvalidTxTime) { return new TransactionEdit(0L, 0L, State.TRUNCATE_INVALID_TX, 0L, null, 0L, false, null, null, truncateInvalidTxTime, 0L, null); }
/** * Creates a new instance in the {@link State#TRUNCATE_INVALID_TX} state. */ public static TransactionEdit createTruncateInvalidTx(Set<Long> truncateInvalidTx) { return new TransactionEdit(0L, 0L, State.TRUNCATE_INVALID_TX, 0L, null, 0L, false, null, truncateInvalidTx, 0L, 0L, null); }
@SuppressWarnings("unused") public CaskEntry() { this.key = new LongWritable(); this.edit = new co.cask.tephra.persist.TransactionEdit(); }
public Entry() { this.key = new LongWritable(); this.edit = new TransactionEdit(); }
@Override public TransactionEdit next() throws IOException { return next(new TransactionEdit()); }
private void assertSerializedEdit(TransactionEdit originalEdit) throws IOException { ByteArrayDataOutput out = ByteStreams.newDataOutput(); originalEdit.write(out); TransactionEdit decodedEdit = new TransactionEdit(); DataInput in = ByteStreams.newDataInput(out.toByteArray()); decodedEdit.readFields(in); Assert.assertEquals(originalEdit, decodedEdit); } }