use of org.apache.tephra.snapshot.BinaryDecoder in project cdap by caskdata.
the class AbstractSnapshotCodec method decode.
@Override
public TransactionSnapshot decode(InputStream in) {
BinaryDecoder decoder = new BinaryDecoder(in);
try {
long timestamp = decoder.readLong();
long readPointer = decoder.readLong();
long writePointer = decoder.readLong();
// some attributes where removed during format change, luckily those stored at the end, so we just give a chance
// to skip them
decodeObsoleteAttributes(decoder);
Collection<Long> invalid = decodeInvalid(decoder);
NavigableMap<Long, TransactionManager.InProgressTx> inProgress = decodeInProgress(decoder);
NavigableMap<Long, Set<ChangeId>> committing = decodeChangeSets(decoder);
NavigableMap<Long, Set<ChangeId>> committed = decodeChangeSets(decoder);
return new TransactionSnapshot(timestamp, readPointer, writePointer, invalid, inProgress, committing, committed);
} catch (IOException e) {
LOG.error("Unable to deserialize transaction state: ", e);
throw Throwables.propagate(e);
}
}
use of org.apache.tephra.snapshot.BinaryDecoder in project cdap by caskdata.
the class AbstractSnapshotCodec method decodeTransactionVisibilityState.
@Override
public TransactionVisibilityState decodeTransactionVisibilityState(InputStream in) {
BinaryDecoder decoder = new BinaryDecoder(in);
try {
long timestamp = decoder.readLong();
long readPointer = decoder.readLong();
long writePointer = decoder.readLong();
// some attributes where removed during format change, luckily those stored at the end, so we just give a chance
// to skip them
decodeObsoleteAttributes(decoder);
Collection<Long> invalid = decodeInvalid(decoder);
NavigableMap<Long, TransactionManager.InProgressTx> inProgress = decodeInProgress(decoder);
return new TransactionSnapshot(timestamp, readPointer, writePointer, invalid, inProgress);
} catch (IOException e) {
LOG.error("Unable to deserialize transaction state: ", e);
throw Throwables.propagate(e);
}
}
Aggregations