Search in sources :

Example 1 with TimestampAndPartition

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());
}
Also used : LockImmutableTimestampResponse(com.palantir.lock.v2.LockImmutableTimestampResponse) LockToken(com.palantir.lock.v2.LockToken) PartitionedTimestamps(com.palantir.lock.v2.PartitionedTimestamps) TimestampAndPartition(com.palantir.lock.v2.TimestampAndPartition)

Aggregations

LockImmutableTimestampResponse (com.palantir.lock.v2.LockImmutableTimestampResponse)1 LockToken (com.palantir.lock.v2.LockToken)1 PartitionedTimestamps (com.palantir.lock.v2.PartitionedTimestamps)1 TimestampAndPartition (com.palantir.lock.v2.TimestampAndPartition)1