peerdb
peerdb copied to clipboard
Flow API: Custom resume endpoint
API Endpoint to Resume Mirror With Specified Syncs
This PR introduces an endpoint in our Flow API to resume mirrors with a request of custom number of syncs.
The number of syncs the client can request is, for now, a number between 1 and the MaxSyncsPerCDCFlow
which is currently 32.
Syncs in this case refers to one sync flow - normalise flow pair.
This endpoint requires the mirror to be paused before hand.
Request validation checks the above along with whether the mirror name exists, etc.
Implementation:
- Changes the type of
CDCFlowSignal
to now beCDCFlowSignalProperties
, which has two fields -
type CDCFlowSignalProperties struct {
Signal CDCFlowSignal
CustomNumberOfSyncs int
}
- The branch of the
FlowStateChange
endpoint which handles mirror resume now sends the above signal with the custom sync number information. - This information is picked up in
cdc_flow.go
. - I've included the limit check here in the selector for normalise-result channel which sends normalise-done signal
Functional testing:
- Tested with a paused mirror with low sync interval via HTTP requests to this endpoint
- Resume mirror via the normal UI button route will stick to existing behaviour of MaxSyncsPerCDCFlow=32 sync flows.