use of com.palantir.lock.v2.TimestampAndPartition in project atlasdb by palantir.
the class TransactionStarterHelper method split.
static List<StartIdentifiedAtlasDbTransactionResponse> split(ConjureStartTransactionsResponse response) {
PartitionedTimestamps partitionedTimestamps = response.getTimestamps();
int partition = partitionedTimestamps.partition();
LockToken immutableTsLock = response.getImmutableTimestamp().getLock();
long immutableTs = response.getImmutableTimestamp().getImmutableTimestamp();
Stream<LockImmutableTimestampResponse> immutableTsAndLocks = LockTokenShare.share(immutableTsLock, partitionedTimestamps.count()).map(tokenShare -> LockImmutableTimestampResponse.of(immutableTs, tokenShare));
Stream<TimestampAndPartition> timestampAndPartitions = partitionedTimestamps.stream().mapToObj(timestamp -> TimestampAndPartition.of(timestamp, partition));
return Streams.zip(immutableTsAndLocks, timestampAndPartitions, StartIdentifiedAtlasDbTransactionResponse::of).collect(Collectors.toList());
}
Aggregations