use of com.palantir.paxos.PaxosLearner in project atlasdb by palantir.
the class LeaderRemotingTest method testLearn.
@Test
public void testLearn() throws IOException {
PaxosValue value = new PaxosValue("asdfasdfsa", 0, new byte[] { 0, 1, 2 });
PaxosLearner learn = AtlasDbFeignTargetFactory.createProxy(Optional.empty(), learner.baseUri().toString(), PaxosLearner.class, UserAgents.DEFAULT_USER_AGENT);
learn.getGreatestLearnedValue();
learn.getLearnedValuesSince(0);
learn.learn(0, value);
PaxosValue val = learn.getGreatestLearnedValue();
learn.getLearnedValuesSince(0);
learn.getLearnedValue(0);
}
use of com.palantir.paxos.PaxosLearner in project atlasdb by palantir.
the class PaxosTimestampCreator method createTimestampService.
@Override
public Supplier<ManagedTimestampService> createTimestampService(String client, LeaderConfig unused) {
ExecutorService executor = PTExecutors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("atlas-consensus-" + client + "-%d").setDaemon(true).build());
Set<String> namespacedUris = PaxosTimeLockUriUtils.getClientPaxosUris(remoteServers, client);
List<PaxosAcceptor> acceptors = Leaders.createProxyAndLocalList(paxosResource.getPaxosAcceptor(client), namespacedUris, optionalSecurity, PaxosAcceptor.class, "timestamp-bound-store." + client);
PaxosLearner ourLearner = paxosResource.getPaxosLearner(client);
List<PaxosLearner> learners = Leaders.createProxyAndLocalList(ourLearner, namespacedUris, optionalSecurity, PaxosLearner.class, "timestamp-bound-store." + client);
PaxosProposer proposer = instrument(PaxosProposer.class, PaxosProposerImpl.newProposer(ourLearner, ImmutableList.copyOf(acceptors), ImmutableList.copyOf(learners), PaxosRemotingUtils.getQuorumSize(acceptors), UUID.randomUUID(), executor), client);
PaxosSynchronizer.synchronizeLearner(ourLearner, learners);
return () -> createManagedPaxosTimestampService(proposer, client, acceptors, learners);
}
use of com.palantir.paxos.PaxosLearner in project atlasdb by palantir.
the class IsolatedPaxosTimeLockServerIntegrationTest method canParticipateInPaxosAsLearnerWithoutQuorum.
@Test
public void canParticipateInPaxosAsLearnerWithoutQuorum() {
PaxosLearner learner = createProxyForInternalNamespacedTestService(PaxosLearner.class);
learner.getGreatestLearnedValue();
}
use of com.palantir.paxos.PaxosLearner in project atlasdb by palantir.
the class PaxosSynchronizerTest method setUp.
@Before
public void setUp() throws IOException {
for (int i = 0; i < NUM_NODES; i++) {
AtomicBoolean failureController = new AtomicBoolean(false);
PaxosLearner learner = PaxosLearnerImpl.newLearner(TEMPORARY_FOLDER.newFolder().getPath());
learners.add(ToggleableExceptionProxy.newProxyInstance(PaxosLearner.class, learner, failureController, EXCEPTION));
failureToggles.add(failureController);
}
ourLearner = learners.get(0);
}
use of com.palantir.paxos.PaxosLearner in project atlasdb by palantir.
the class PaxosTimestampBoundStoreTest method setUp.
@Before
public void setUp() {
for (int i = 0; i < NUM_NODES; i++) {
AtomicBoolean failureController = new AtomicBoolean(false);
PaxosAcceptor acceptor = PaxosAcceptorImpl.newAcceptor(ACCEPTOR_DIR_PREFIX + i);
acceptors.add(ToggleableExceptionProxy.newProxyInstance(PaxosAcceptor.class, acceptor, failureController, EXCEPTION));
PaxosLearner learner = PaxosLearnerImpl.newLearner(LEARNER_DIR_PREFIX + i);
learners.add(ToggleableExceptionProxy.newProxyInstance(PaxosLearner.class, learner, failureController, EXCEPTION));
failureToggles.add(failureController);
}
store = createPaxosTimestampBoundStore(0);
}
Aggregations