MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / _incrementSequence

Method _incrementSequence

db/sequence_allocator.go:389–398  ·  view source on GitHub ↗

Increments the _sync:seq document. Retry handling provided by bucket.Incr. Expects sequenceAllocator.mutex to be held to ensure consistent LastSequenceReservedValue updates.

(numToReserve uint64)

Source from the content-addressed store, hash-verified

387// Increments the _sync:seq document. Retry handling provided by bucket.Incr.
388// Expects sequenceAllocator.mutex to be held to ensure consistent LastSequenceReservedValue updates.
389func (s *sequenceAllocator) _incrementSequence(numToReserve uint64) (uint64, error) {
390 value, err := s.datastore.Incr(s.metaKeys.SyncSeqKey(), numToReserve, numToReserve, 0)
391 if err != nil {
392 return value, err
393 }
394 s.dbStats.SequenceIncrCount.Add(1)
395 s.dbStats.SequenceReservedCount.Add(int64(numToReserve))
396 s.dbStats.LastSequenceReservedValue.Set(int64(value))
397 return value, nil
398}
399
400// ReleaseSequence writes an unused sequence document, used to notify sequence buffering that a sequence has been allocated and not used.
401// Sequence is stored as the document body to avoid null doc issues.

Callers 4

_reserveSequenceBatchMethod · 0.95
_fixSyncSeqRollbackMethod · 0.95
AllocateTestSequenceFunction · 0.80

Calls 4

SyncSeqKeyMethod · 0.80
IncrMethod · 0.45
AddMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected