raft.go
func (r *Raft) processLog(l *Log, future *logFuture) {
	switch l.Type {
	case LogBarrier:
		// Barrier is handled by the FSM
		fallthrough

	case LogCommand:
		// Forward to the fsm handler
		select {
		case r.fsmMutateCh <- &commitTuple{l, future}:
		case <-r.shutdownCh:
			if future != nil {
				future.respond(ErrRaftShutdown)
			}
		}

		// Return so that the future is only responded to
		// by the FSM handler when the application is done
		return

	case LogConfiguration:
	case LogAddPeerDeprecated:
	case LogRemovePeerDeprecated:
	case LogNoop:
		// Ignore the no-op

	default:
		panic(fmt.Errorf("unrecognized log type: %#v", l))
	}

	// Invoke the future if given
	if future != nil {
		future.respond(nil)
	}
}
func (r *Raft) processLog(l *Log, future *logFuture) {
	switch l.Type {
	case LogBarrier:
		// Barrier is handled by the FSM
		fallthrough

	case LogCommand:
		// Forward to the fsm handler
		select {
		case r.fsmMutateCh <- &commitTuple{l, future}:
		case <-r.shutdownCh:
			if future != nil {
				future.respond(ErrRaftShutdown)
			}
		}

		// Return so that the future is only responded to
		// by the FSM handler when the application is done
		return

	case LogConfiguration:
	case LogAddPeerDeprecated:
	case LogRemovePeerDeprecated:
	case LogNoop:
		// Ignore the no-op

	default:
		panic(fmt.Errorf("unrecognized log type: %#v", l))
	}

	// Invoke the future if given
	if future != nil {
		future.respond(nil)
	}
}
func ( r * Raft ) processLog ( l * Log , future * logFuture ) { switch l . Type { case LogBarrier : // Barrier is handled by the FSM fallthrough case LogCommand : // Forward to the fsm handler select { case r . fsmMutateCh <- & commitTuple { l , future } : case <- r . shutdownCh : if future != nil { future . respond ( ErrRaftShutdown ) } } // Return so that the future is only responded to // by the FSM handler when the application is done return case LogConfiguration : case LogAddPeerDeprecated : case LogRemovePeerDeprecated : case LogNoop : // Ignore the no-op default : panic ( fmt . Errorf ( " " , l ) ) } // Invoke the future if given if future != nil { future . respond ( nil ) } }
// processLog is invoked to process the application of a single committed log entry.
processLog is invoked to process the application of a single committed log entry .