示例#1
0
 public HartbeatTimer(RaftOptions options,
     ILoggerFactory loggerFactory, 
     ServerIdentifier serverIdentifier)
 {
     _options = options;
     _logger = loggerFactory.CreateLogger(nameof(HartbeatTimer) + " " + serverIdentifier);
     _serverIdentifier = serverIdentifier;
     _random = new Random();
 }
示例#2
0
        public RaftClient(ServerIdentifier serverIdentifier,
            IObserver<ClientMessage> changeMessage,
            IObservable<ClientResultMessage> clientResult,
            RaftOptions options,
            ILoggerFactory loggerFactory)
        {
            _serverIdentifier = serverIdentifier;
            _changeMessage = changeMessage;
            _clientResult = clientResult;
            _options = options;
            _logger = loggerFactory.CreateLogger<RaftClient>();

        }
示例#3
0
 public VoteReceived(IObserver<RequestVoteResultMessage> voteReply,
     ServerIdentifier serverIdentifier,
     IObservable<RequestVoteMessage> requestVote, 
     Election election,
     ILoggerFactory loggerFactory,
     Nodes nodes,
     RaftOptions options, 
     ILogReplication logReplication)
 {
     _voteReply = voteReply;
     _election = election;
     _nodes = nodes;
     _options = options;
     _logReplication = logReplication;
     _serverIdentifier = serverIdentifier;
     _voteReceivedDisposable = requestVote.Subscribe(VoteRequestReceived);
     _logger = loggerFactory.CreateLogger(nameof(VoteReceived) + " " + serverIdentifier);
 }
示例#4
0
 public AppendEntry(IObserver<AppendEntryResultMessage> entryReply,
    IObservable<AppendEntryMessage> receivedAppendEntryMessage,
    IHartbeatTimer hartbeat,
    ILogReplication logReplication, 
    Election election,
    ILoggerFactory loggerFactory,
    RaftOptions options, 
    ServerIdentifier serverIdentifier,
    IEnumerable<IRaftService> services)
 {
     _entryReply = entryReply;
     _hartbeat = hartbeat;
     _receivedDisposable =  receivedAppendEntryMessage.Subscribe(RaciveHartbeat);
     _logReplication = logReplication;
     _election = election;
     _options = options;
     _serverIdentifier = serverIdentifier;
     _services = services;
     _logger = loggerFactory.CreateLogger(nameof(AppendEntry) + " " + serverIdentifier);
 }