Esempio n. 1
0
 internal ValueTask <Result <bool> > Start(IAuditTrail <IRaftLogEntry> auditTrail)
 {
     logger.ReplicationStarted(member.EndPoint, currentIndex);
     return(currentIndex >= member.NextIndex ?
            auditTrail.ReadAsync(this, member.NextIndex, token) :
            ReadAsync <EmptyLogEntry, EmptyLogEntry[]>(Array.Empty <EmptyLogEntry>(), null, token));
 }
 private Task <Result <bool> > StartCoreAsync()
 {
     logger.ReplicationStarted(member.EndPoint, currentIndex);
     return((currentIndex >= member.NextIndex ?
             auditTrail.ReadAsync(this, member.NextIndex, token) :
             ReadAsync <EmptyLogEntry, EmptyLogEntry[]>(Array.Empty <EmptyLogEntry>(), null, token)).AsTask());
 }
Esempio n. 3
0
            internal ValueTask <Result <bool> > Start(IAuditTrail <IRaftLogEntry> auditTrail)
            {
                var currentIndex = this.currentIndex = auditTrail.GetLastIndex(false);

                logger.ReplicationStarted(member.Endpoint, currentIndex);
                return(currentIndex >= member.NextIndex ?
                       auditTrail.ReadAsync <Replicator, Result <bool> >(this, member.NextIndex, token) :
                       ReadAsync <IRaftLogEntry, IRaftLogEntry[]>(Array.Empty <IRaftLogEntry>(), null, token));
            }
Esempio n. 4
0
 internal static ValueTask <long> GetTermAsync(this IAuditTrail <IRaftLogEntry> auditTrail, long index, CancellationToken token)
 => auditTrail.ReadAsync <TermReader, long>(new TermReader(), index, index, token);