func makePrepareTimerStopper(provideClientState clientstate.Provider) prepareTimerStopper {
	return func(request messages.Request) {
		provideClientState(request.ClientID()).StopPrepareTimer(request.Sequence())
	}
}
makePrepareTimerStopper constructs an instance of
prepareTimerStopper.
package minbft
import (
	"fmt"
	"time"
	"github.com/hyperledger-labs/minbft/api"
	"github.com/hyperledger-labs/minbft/common/logger"
	"github.com/hyperledger-labs/minbft/core/internal/clientstate"
	"github.com/hyperledger-labs/minbft/core/internal/messagelog"
	"github.com/hyperledger-labs/minbft/core/internal/requestlist"
	"github.com/hyperledger-labs/minbft/core/internal/viewstate"
	"github.com/hyperledger-labs/minbft/messages"
)
type requestReplier func(request messages.Request) <-chan messages.Reply
type requestValidator func(request messages.Request) error
type requestProcessor func(request messages.Request) (new bool, err error)
type requestApplier func(request messages.Request, view uint64) error
type requestExecutor func(request messages.Request)
type requestSeqCapturer func(request messages.Request) (new bool, release func())
type requestSeqPreparer func(request messages.Request) (new bool)
type requestSeqRetirer func(request messages.Request) (new bool)
type requestTimerStarter func(request messages.Request, view uint64)
type requestTimerStopper func(request messages.Request)
type requestTimeoutHandler func(view uint64)
type requestTimeoutProvider func() time.Duration
type prepareTimerStarter func(request messages.Request, view uint64)
type prepareTimerStopper func(request messages.Request)
type prepareTimeoutProvider func() time.Duration
func makeRequestValidator(verify messageSignatureVerifier) requestValidator {
	return func(request messages.Request) error {
		return verify(request)
	}
}
func makeRequestProcessor(captureSeq requestSeqCapturer, pendingReq requestlist.List, viewState viewstate.State, applyRequest requestApplier) requestProcessor {
	return func(request messages.Request) (new bool, err error) {
		new, releaseSeq := captureSeq(request)
		if !new {
			return false, nil
		}
		defer releaseSeq()
		pendingReq.Add(request)
		currentView, expectedView, releaseView := viewState.HoldView()
		defer releaseView()
		if currentView != expectedView {
			return true, nil
		}
		if err := applyRequest(request, currentView); err != nil {
			return false, fmt.Errorf("failed to apply Request: %s", err)
		}
		return true, nil
	}
}
func makeRequestApplier(id, n uint32, handleGeneratedMessage generatedMessageHandler, startReqTimer requestTimerStarter, startPrepTimer prepareTimerStarter) requestApplier {
	return func(request messages.Request, view uint64) error {
		startReqTimer(request, view)
		if isPrimary(view, id, n) {
			handleGeneratedMessage(messageImpl.NewPrepare(id, view, request))
		} else {
			startPrepTimer(request, view)
		}
		return nil
	}
}
func makeRequestReplier(provider clientstate.Provider) requestReplier {
	return func(request messages.Request) <-chan messages.Reply {
		state := provider(request.ClientID())
		return state.ReplyChannel(request.Sequence())
	}
}
func makeRequestExecutor(id uint32, retireSeq requestSeqRetirer, pendingReq requestlist.List, stopReqTimer requestTimerStopper, consumer api.RequestConsumer, handleGeneratedMessage generatedMessageHandler) requestExecutor {
	return func(request messages.Request) {
		clientID := request.ClientID()
		seq := request.Sequence()
		if new := retireSeq(request); !new {
			return  
		}
		pendingReq.Remove(clientID)
		stopReqTimer(request)
		resultChan := consumer.Deliver(request.Operation())
		go func() {
			result := <-resultChan
			reply := messageImpl.NewReply(id, clientID, seq, result)
			handleGeneratedMessage(reply)
		}()
	}
}
func makeRequestSeqCapturer(provideClientState clientstate.Provider) requestSeqCapturer {
	return func(request messages.Request) (new bool, release func()) {
		clientID := request.ClientID()
		seq := request.Sequence()
		return provideClientState(clientID).CaptureRequestSeq(seq)
	}
}
func makeRequestSeqPreparer(provideClientState clientstate.Provider) requestSeqPreparer {
	return func(request messages.Request) (new bool) {
		clientID := request.ClientID()
		seq := request.Sequence()
		if new, err := provideClientState(clientID).PrepareRequestSeq(seq); err != nil {
			panic(err)
		} else if !new {
			return false
		}
		return true
	}
}
func makeRequestSeqRetirer(provideClientState clientstate.Provider) requestSeqRetirer {
	return func(request messages.Request) (new bool) {
		clientID := request.ClientID()
		seq := request.Sequence()
		if new, err := provideClientState(clientID).RetireRequestSeq(seq); err != nil {
			panic(err)
		} else if !new {
			return false
		}
		return true
	}
}
func makeRequestTimerStarter(provideClientState clientstate.Provider, handleTimeout requestTimeoutHandler, logger logger.Logger) requestTimerStarter {
	return func(request messages.Request, view uint64) {
		clientID := request.ClientID()
		seq := request.Sequence()
		provideClientState(clientID).StartRequestTimer(seq, func() {
			logger.Warningf("Request timer expired: client=%d seq=%d view=%d", clientID, seq, view)
			handleTimeout(view)
		})
	}
}
func makeRequestTimerStopper(provideClientState clientstate.Provider) requestTimerStopper {
	return func(request messages.Request) {
		provideClientState(request.ClientID()).StopRequestTimer(request.Sequence())
	}
}
func makeRequestTimeoutProvider(config api.Configer) requestTimeoutProvider {
	return func() time.Duration {
		return config.TimeoutRequest()
	}
}
func makePrepareTimerStarter(n uint32, provideClientState clientstate.Provider, unicastLogs map[uint32]messagelog.MessageLog, logger logger.Logger) prepareTimerStarter {
	return func(request messages.Request, view uint64) {
		clientID := request.ClientID()
		seq := request.Sequence()
		provideClientState(clientID).StartPrepareTimer(seq, func() {
			logger.Infof("Prepare timer expired: client=%d seq=%d view=%d", clientID, seq, view)
			unicastLogs[uint32(view%uint64(n))].Append(request)
		})
	}
}