@Value.Check protected final void check() { Preconditions.checkState(quorumSize() > leaders().size() / 2, "The quorumSize '%s' must be over half the amount of leader entries %s.", quorumSize(), leaders()); Preconditions.checkState(leaders().size() >= quorumSize(), "The quorumSize '%s' must be less than or equal to the amount of leader entries %s.", quorumSize(), leaders()); Preconditions.checkArgument(leaders().contains(localServer()), "The localServer '%s' must included in the leader entries %s.", localServer(), leaders()); Preconditions.checkArgument(ensureDirectoryExists(learnerLogDir()), "Learner log directory '%s' does not exist and cannot be created.", learnerLogDir()); Preconditions.checkArgument(ensureDirectoryExists(acceptorLogDir()), "Acceptor log directory '%s' does not exist and cannot be created.", acceptorLogDir()); }
public static LocalPaxosServices createInstrumentedLocalServices(MetricsManager metricsManager, LeaderConfig config, Supplier<LeaderRuntimeConfig> runtime, String userAgent) { Set<String> remoteLeaderUris = Sets.newHashSet(config.leaders()); remoteLeaderUris.remove(config.localServer()); RemotePaxosServerSpec remotePaxosServerSpec = ImmutableRemotePaxosServerSpec.builder() .remoteLeaderUris(remoteLeaderUris) .remoteAcceptorUris(remoteLeaderUris) .remoteLearnerUris(remoteLeaderUris) .build(); return createInstrumentedLocalServices(metricsManager, config, runtime, remotePaxosServerSpec, userAgent); }
@Value.Check protected final void check() { Preconditions.checkState(quorumSize() > leaders().size() / 2, "The quorumSize '%s' must be over half the amount of leader entries %s.", quorumSize(), leaders()); Preconditions.checkState(leaders().size() >= quorumSize(), "The quorumSize '%s' must be less than or equal to the amount of leader entries %s.", quorumSize(), leaders()); Preconditions.checkArgument(leaders().contains(localServer()), "The localServer '%s' must included in the leader entries %s.", localServer(), leaders()); Preconditions.checkArgument(ensureDirectoryExists(learnerLogDir()), "Learner log directory '%s' does not exist and cannot be created.", learnerLogDir()); Preconditions.checkArgument(ensureDirectoryExists(acceptorLogDir()), "Acceptor log directory '%s' does not exist and cannot be created.", acceptorLogDir()); }
public static LocalPaxosServices createInstrumentedLocalServices(MetricsManager metricsManager, LeaderConfig config, Supplier<LeaderRuntimeConfig> runtime, String userAgent) { Set<String> remoteLeaderUris = Sets.newHashSet(config.leaders()); remoteLeaderUris.remove(config.localServer()); RemotePaxosServerSpec remotePaxosServerSpec = ImmutableRemotePaxosServerSpec.builder() .remoteLeaderUris(remoteLeaderUris) .remoteAcceptorUris(remoteLeaderUris) .remoteLearnerUris(remoteLeaderUris) .build(); return createInstrumentedLocalServices(metricsManager, config, runtime, remotePaxosServerSpec, userAgent); }