use of org.apache.distributedlog.zk.ZKVersionedSetOp in project bookkeeper by apache.
the class ZKLogSegmentMetadataStore method storeMaxLogSegmentSequenceNumber.
// max sequence number and max transaction id
@Override
public void storeMaxLogSegmentSequenceNumber(Transaction<Object> txn, LogMetadata logMetadata, Versioned<Long> lssn, Transaction.OpListener<Version> listener) {
Version version = lssn.getVersion();
assert (version instanceof LongVersion);
LongVersion zkVersion = (LongVersion) version;
byte[] data = DLUtils.serializeLogSegmentSequenceNumber(lssn.getValue());
Op setDataOp = Op.setData(logMetadata.getLogSegmentsPath(), data, (int) zkVersion.getLongVersion());
ZKOp zkOp = new ZKVersionedSetOp(setDataOp, listener);
txn.addOp(zkOp);
}
use of org.apache.distributedlog.zk.ZKVersionedSetOp in project bookkeeper by apache.
the class ZKLogSegmentMetadataStore method storeMaxTxnId.
@Override
public void storeMaxTxnId(Transaction<Object> txn, LogMetadataForWriter logMetadata, Versioned<Long> transactionId, Transaction.OpListener<Version> listener) {
Version version = transactionId.getVersion();
assert (version instanceof LongVersion);
LongVersion zkVersion = (LongVersion) version;
byte[] data = DLUtils.serializeTransactionId(transactionId.getValue());
Op setDataOp = Op.setData(logMetadata.getMaxTxIdPath(), data, (int) zkVersion.getLongVersion());
ZKOp zkOp = new ZKVersionedSetOp(setDataOp, listener);
txn.addOp(zkOp);
}
use of org.apache.distributedlog.zk.ZKVersionedSetOp in project bookkeeper by apache.
the class SimpleLedgerAllocator method completeAllocation.
private synchronized void completeAllocation(LedgerHandle lh) {
allocatedLh = lh;
if (null == tryObtainTxn) {
return;
}
org.apache.zookeeper.Op zkSetDataOp = org.apache.zookeeper.Op.setData(allocatePath, DistributedLogConstants.EMPTY_BYTES, (int) version.getLongVersion());
ZKVersionedSetOp commitOp = new ZKVersionedSetOp(zkSetDataOp, this);
tryObtainTxn.addOp(commitOp);
setPhase(Phase.HANDING_OVER);
allocatePromise.complete(lh);
}
Aggregations