MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / ReplayWithContext

Method ReplayWithContext

xenomint/state.go:710–728  ·  view source on GitHub ↗

ReplayWithContext replays a write log from other peer to replicate storage state with context.

(
	ctx context.Context, req *types.Request, resp *types.Response)

Source from the content-addressed store, hash-verified

708
709// ReplayWithContext replays a write log from other peer to replicate storage state with context.
710func (s *State) ReplayWithContext(
711 ctx context.Context, req *types.Request, resp *types.Response) (err error,
712) {
713 // NOTE(leventeliu): in the current implementation, failed requests are not tracked in remote
714 // nodes (while replaying via Replay calls). Because we don't want to actually replay read
715 // queries in all synchronized nodes, meanwhile, whether a request will fail or not
716 // remains unknown until we actually replay it -- a dead end here.
717 // So we just keep failed requests in local pool and report them in the next local block
718 // producing.
719 switch req.Header.QueryType {
720 case types.ReadQuery:
721 return
722 case types.WriteQuery:
723 return s.replay(ctx, req, resp)
724 default:
725 err = ErrInvalidRequest
726 }
727 return
728}
729
730// Stat prints the statistic message of the State object.
731func (s *State) Stat(id proto.DatabaseID) {

Callers 1

ReplayMethod · 0.95

Calls 1

replayMethod · 0.95

Tested by

no test coverage detected