use of org.neo4j.com.TransactionStreamResponse in project neo4j by neo4j.
the class SlaveLocksClientTest method setUp.
@Before
public void setUp() throws Exception {
master = mock(Master.class);
availabilityGuard = new AvailabilityGuard(Clocks.fakeClock(), getInstance());
lockManager = new CommunityLockManger(Config.defaults(), Clocks.systemClock());
local = spy(lockManager.newClient());
logProvider = new AssertableLogProvider();
LockResult lockResultOk = new LockResult(LockStatus.OK_LOCKED);
TransactionStreamResponse<LockResult> responseOk = new TransactionStreamResponse<>(lockResultOk, null, TransactionStream.EMPTY, ResourceReleaser.NO_OP);
whenMasterAcquireShared().thenReturn(responseOk);
whenMasterAcquireExclusive().thenReturn(responseOk);
client = new SlaveLocksClient(master, local, lockManager, mock(RequestContextFactory.class), availabilityGuard, logProvider);
}
use of org.neo4j.com.TransactionStreamResponse in project neo4j by neo4j.
the class StoreCopyResponsePacker method packTransactionStreamResponse.
@Override
public <T> Response<T> packTransactionStreamResponse(RequestContext context, T response) {
final long toStartFrom = mandatoryStartTransactionId;
final long toEndAt = transactionIdStore.getLastCommittedTransactionId();
TransactionStream transactions = visitor -> {
if (toStartFrom > BASE_TX_ID && toStartFrom <= toEndAt) {
monitor.startStreamingTransactions(toStartFrom);
extractTransactions(toStartFrom, filterVisitor(visitor, toEndAt));
monitor.finishStreamingTransactions(toEndAt);
}
};
return new TransactionStreamResponse<>(response, storeId.get(), transactions, ResourceReleaser.NO_OP);
}
use of org.neo4j.com.TransactionStreamResponse in project neo4j by neo4j.
the class ResponsePacker method packTransactionStreamResponse.
public <T> Response<T> packTransactionStreamResponse(RequestContext context, T response) {
final long toStartFrom = context.lastAppliedTransaction() + 1;
final long toEndAt = transactionIdStore.getLastCommittedTransactionId();
TransactionStream transactions = visitor -> {
if (toStartFrom > BASE_TX_ID && toStartFrom <= toEndAt) {
extractTransactions(toStartFrom, filterVisitor(visitor, toEndAt));
}
};
return new TransactionStreamResponse<>(response, storeId.get(), transactions, ResourceReleaser.NO_OP);
}
Aggregations