use of org.apache.bookkeeper.versioning.Version in project distributedlog by twitter.
the class BKLogWriteHandler method storeMaxTxId.
// Transactional operations for MaxTxId
void storeMaxTxId(final ZKTransaction txn, final MaxTxId maxTxId, final long txId) {
byte[] data = maxTxId.couldStore(txId);
if (null != data) {
Op zkOp = Op.setData(maxTxId.getZkPath(), data, -1);
txn.addOp(new ZKVersionedSetOp(zkOp, new Transaction.OpListener<Version>() {
@Override
public void onCommit(Version version) {
maxTxId.setMaxTxId(txId);
}
@Override
public void onAbort(Throwable t) {
}
}));
}
}
use of org.apache.bookkeeper.versioning.Version in project distributedlog by twitter.
the class BKLogWriteHandler method storeMaxSequenceNumber.
// Transactional operations for MaxLogSegmentSequenceNo
void storeMaxSequenceNumber(final Transaction txn, final MaxLogSegmentSequenceNo maxSeqNo, final long seqNo, final boolean isInprogress) {
byte[] data = DLUtils.serializeLogSegmentSequenceNumber(seqNo);
Op zkOp = Op.setData(logMetadata.getLogSegmentsPath(), data, maxSeqNo.getZkVersion());
txn.addOp(new ZKVersionedSetOp(zkOp, new Transaction.OpListener<Version>() {
@Override
public void onCommit(Version version) {
if (validateLogSegmentSequenceNumber) {
synchronized (inprogressLSSNs) {
if (isInprogress) {
inprogressLSSNs.add(seqNo);
} else {
inprogressLSSNs.removeFirst();
}
}
}
maxSeqNo.update((ZkVersion) version, seqNo);
}
@Override
public void onAbort(Throwable t) {
// no-op
}
}));
}
Aggregations