/** * 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; }
/** * Creates a Copycat server. */ private CopycatServer createServer(Member member) { CopycatServer.Builder builder = CopycatServer.builder(member.clientAddress(), member.serverAddress()) .withType(member.type()) .withTransport(new LocalTransport(registry)) .withStorage(Storage.builder() .withStorageLevel(StorageLevel.MEMORY) .withMaxSegmentSize(1024 * 1024) .withCompactionThreads(1) .build()) .withStateMachine(TestStateMachine::new); CopycatServer server = builder.build(); server.serializer().disableWhitelist(); servers.add(server); return server; }
.withMaxEntriesPerSegment(options.maxEntriesPerSegment()) .withRetainStaleSnapshots(options.retainStaleSnapshots()) .withCompactionThreads(options.compactionThreads()) .withMinorCompactionInterval(options.minorCompactionInterval()) .withMajorCompactionInterval(options.majorCompactionInterval())
/** * Returns a new Atomix replica builder from the given properties. * * @param properties The properties from which to load the replica builder. * @return The replica builder. */ public static Builder builder(Properties properties) { ReplicaProperties replicaProperties = new ReplicaProperties(properties); Collection<Address> replicas = replicaProperties.replicas(); return builder(replicaProperties.clientAddress(), replicaProperties.serverAddress(), replicas) .withTransport(replicaProperties.transport()) .withStorage(Storage.builder() .withStorageLevel(replicaProperties.storageLevel()) .withDirectory(replicaProperties.storageDirectory()) .withMaxSegmentSize(replicaProperties.maxSegmentSize()) .withMaxEntriesPerSegment(replicaProperties.maxEntriesPerSegment()) .withMaxSnapshotSize(replicaProperties.maxSnapshotSize()) .withRetainStaleSnapshots(replicaProperties.retainStaleSnapshots()) .withCompactionThreads(replicaProperties.compactionThreads()) .withMinorCompactionInterval(replicaProperties.minorCompactionInterval()) .withMajorCompactionInterval(replicaProperties.majorCompactionInterval()) .withCompactionThreshold(replicaProperties.compactionThreshold()) .build()) .withSerializer(replicaProperties.serializer()) .withQuorumHint(replicaProperties.quorumHint() != -1 ? replicaProperties.quorumHint() : replicas.size()) .withBackupCount(replicaProperties.backupCount()) .withElectionTimeout(replicaProperties.electionTimeout()) .withHeartbeatInterval(replicaProperties.heartbeatInterval()) .withSessionTimeout(replicaProperties.sessionTimeout()); }