port)) .withSnapshotAllowed(new AtomicBoolean(false)) .withTransport(new NettyTransport()) .withSerializer(RaftJournalSystem.createSerializer()) .withType(Type.PASSIVE)
.withSnapshotAllowed(mSnapshotAllowed) .withSerializer(createSerializer()) .withTransport(new NettyTransport())
@Override public Transport build() { return new NettyTransport(properties); } }
/** * Creates a Copycat client. */ private CopycatClient createClient(RecoveryStrategy strategy) throws Exception { CopycatClient client = CopycatClient.builder() .withTransport(new NettyTransport()) .withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF) .withRecoveryStrategy(strategy) .withServerSelectionStrategy(SERVER_SELECTION_STRATEGY) .build(); client.serializer().disableWhitelist(); CountDownLatch latch = new CountDownLatch(1); client.connect(members.stream().map(Member::clientAddress).collect(Collectors.toList())).thenRun(latch::countDown); latch.await(30, TimeUnit.SECONDS); clients.add(client); return client; }
private CopycatClient createClient() { Address address; if(mode == JOIN_MODE.NODE) { address = new Address(bootstrapNode, bootstrapPort); } else { address = new Address(bindHost, bindPort); } return CopycatClient.builder() .withTransport(new NettyTransport()) .build().connect(address).join(); }
/** * Creates a Copycat client. */ private CopycatClient createClient(RecoveryStrategy strategy) throws Exception { CopycatClient client = CopycatClient.builder() .withTransport(new NettyTransport()) .withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF) .withRecoveryStrategy(strategy) .withServerSelectionStrategy(ServerSelectionStrategies.values()[randomNumber(ServerSelectionStrategies.values().length)]) .build(); client.serializer().disableWhitelist(); CountDownLatch latch = new CountDownLatch(1); client.connect(members.stream().map(Member::clientAddress).collect(Collectors.toList())).thenRun(latch::countDown); latch.await(30, TimeUnit.SECONDS); clients.add(client); return client; }
.withTransport(new NettyTransport()) .withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF) .withRecoveryStrategy(RecoveryStrategies.RECOVER)
.withTransport(new NettyTransport()) .withStorage(Storage.builder() .withDirectory(args[0])
/** * Creates a Copycat server. */ private CopycatServer createServer(Member member) { CopycatServer.Builder builder = CopycatServer.builder(member.clientAddress(), member.serverAddress()) .withType(member.type()) .withTransport(new NettyTransport()) .withStorage(Storage.builder() .withStorageLevel(StorageLevel.DISK) .withDirectory(new File(String.format("target/performance-logs/%d", member.address().hashCode()))) .withCompactionThreads(1) .build()) .withStateMachine(PerformanceStateMachine::new); CopycatServer server = builder.build(); server.serializer().disableWhitelist(); servers.add(server); return server; }
/** * Creates a Copycat server. */ private CopycatServer createServer(Member member) { CopycatServer.Builder builder = CopycatServer.builder(member.clientAddress(), member.serverAddress()) .withType(member.type()) .withTransport(new NettyTransport()) .withStorage(Storage.builder() .withStorageLevel(StorageLevel.DISK) .withDirectory(new File(String.format("target/fuzz-logs/%d", member.address().hashCode()))) .withMaxSegmentSize(randomNumber(1024 * 1024 * 7) + (1024 * 1024)) .withMaxEntriesPerSegment(randomNumber(10000) + 1000) .withCompactionThreads(randomNumber(4) + 1) .withCompactionThreshold(Math.random() / (double) 2) .withEntryBufferSize(randomNumber(10000) + 1) .withFlushOnCommit(randomBoolean()) .withMinorCompactionInterval(Duration.ofSeconds(randomNumber(30) + 15)) .withMajorCompactionInterval(Duration.ofSeconds(randomNumber(60) + 60)) .build()) .withStateMachine(FuzzStateMachine::new); CopycatServer server = builder.build(); server.serializer().disableWhitelist(); servers.add(server); return server; }
NettyOptions nettyProperties = new NettyOptions(properties); Transport transport = new NettyTransport(nettyProperties);
NettyOptions nettyProperties = new NettyOptions(properties); Transport transport = new NettyTransport(nettyProperties);