コード例 #1
0
ファイル: AtomixReplica.java プロジェクト: yuandi0823/atomix
 /**
  * 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
ファイル: AbstractLogTest.java プロジェクト: jiangcc/copycat
 protected Storage.Builder tempStorageBuilder() {
   return Storage.builder().withDirectory(new File(String.format("target/test-logs/%s", logId)));
 }