MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / patchCore

Function patchCore

internal/server/handlers_items_patch.go:388–403  ·  view source on GitHub ↗

patchCore is a patch's answer without its intervening writes: what an idempotency key stores (TASK-3585); intervening is computed live.

(updated *models.Item, p *itemPatch, pendingFlush bool)

Source from the content-addressed store, hash-verified

386// patchCore is a patch's answer without its intervening writes: what an
387// idempotency key stores (TASK-3585); intervening is computed live.
388func patchCore(updated *models.Item, p *itemPatch, pendingFlush bool) patchResponse {
389 resp := patchResponse{
390 Ref: itemRefOrSlug(*updated),
391 Seq: updated.Seq,
392 PatchID: p.id,
393 UndoOf: p.undoOf,
394 VersionID: updated.CreatedVersionID,
395 Rebased: p.rebased(),
396 AppliedOverSeq: p.baseSeq,
397 Diff: diff.Unified(p.before, p.after, 3),
398 }
399 if pendingFlush {
400 resp.ContentState = contentOutcomeAppliedPendingFlush
401 }
402 return resp
403}
404
405func (s *Server) writePatchResponse(w http.ResponseWriter, updated *models.Item, p *itemPatch, pendingFlush bool) {
406 resp := patchCore(updated, p, pendingFlush)

Callers 2

completeIdempotencyTxMethod · 0.85
writePatchResponseMethod · 0.85

Calls 3

UnifiedFunction · 0.92
itemRefOrSlugFunction · 0.85
rebasedMethod · 0.80

Tested by

no test coverage detected