/** * 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()); }
.withMaxSegmentSize(options.maxSegmentSize()) .withMaxEntriesPerSegment(options.maxEntriesPerSegment()) .withRetainStaleSnapshots(options.retainStaleSnapshots()) .withCompactionThreads(options.compactionThreads()) .withMinorCompactionInterval(options.minorCompactionInterval())
/** * Enables retaining stale snapshots on disk, returning the builder for method chaining. * <p> * As the system state progresses, periodic snapshots of the state machine's state are taken. * Once a new snapshot of the state machine is taken, all preceding snapshots no longer contribute * to the state of the system and can therefore be removed from disk. By default, snapshots will not * be retained once a new snapshot is stored on disk. Enabling snapshot retention will ensure that * all snapshots will be saved, e.g. for backup purposes. * * @return The storage builder. */ public Builder withRetainStaleSnapshots() { return withRetainStaleSnapshots(true); }
/** * Sets whether to retain stale snapshots on disk, returning the builder for method chaining. * <p> * As the system state progresses, periodic snapshots of the state machine's state are taken. * Once a new snapshot of the state machine is taken, all preceding snapshots no longer contribute * to the state of the system and can therefore be removed from disk. By default, snapshots will not * be retained once a new snapshot is stored on disk. Enabling snapshot retention will ensure that * all snapshots will be saved, e.g. for backup purposes. * * @return The storage builder. */ public Builder withRetainStaleSnapshots() { return withRetainStaleSnapshots(true); }
/** * Enables retaining stale snapshots on disk, returning the builder for method chaining. * <p> * As the system state progresses, periodic snapshots of the state machine's state are taken. * Once a new snapshot of the state machine is taken, all preceding snapshots no longer contribute * to the state of the system and can therefore be removed from disk. By default, snapshots will not * be retained once a new snapshot is stored on disk. Enabling snapshot retention will ensure that * all snapshots will be saved, e.g. for backup purposes. * * @return The storage builder. */ public Builder withRetainStaleSnapshots() { return withRetainStaleSnapshots(true); }