Makes a backup of revision body for use by in-flight replications requesting an old revision (for clients not supporting replacementRevs)
(ctx context.Context, docId, oldRev string, oldBody []byte, channels base.Set, deleted bool)
| 296 | |
| 297 | // Makes a backup of revision body for use by in-flight replications requesting an old revision (for clients not supporting replacementRevs) |
| 298 | func (db *DatabaseCollectionWithUser) backupRevisionJSON(ctx context.Context, docId, oldRev string, oldBody []byte, channels base.Set, deleted bool) { |
| 299 | if db.deltaSyncEnabled() && db.deltaSyncRevMaxAgeSeconds() > 0 { |
| 300 | // See postWriteUpdateHLV - we're writing a CV and RevTreeID backup there to support delta sync |
| 301 | return |
| 302 | } |
| 303 | |
| 304 | if !db.storeLegacyRevTreeData() { |
| 305 | // Not storing legacy revtree data - nothing to do |
| 306 | return |
| 307 | } |
| 308 | |
| 309 | // skip backup if this was a deletion |
| 310 | if len(oldBody) == 0 { |
| 311 | return |
| 312 | } |
| 313 | |
| 314 | // store or refresh the old document revision by revtree ID for in-flight replications |
| 315 | _ = db.refreshOldRevisionJSON(ctx, docId, oldRev, oldBody, db.oldRevExpirySeconds(), channels, deleted) |
| 316 | } |
| 317 | |
| 318 | // setOldRevisionJSONBody stores the raw JSON body of a revision that has been archived to a separate doc. |
| 319 | func (db *DatabaseCollectionWithUser) setOldRevisionJSONBody(ctx context.Context, docid string, rev string, body []byte, expiry uint32) error { |
no test coverage detected