Пример #1
0
 /**
  * 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());
 }
Пример #2
0
 protected Storage.Builder tempStorageBuilder() {
   return Storage.builder().withDirectory(new File(String.format("target/test-logs/%s", logId)));
 }