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

Method processUnusedSequenceRange

db/change_cache.go:695–715  ·  view source on GitHub ↗

Process unused sequence notification. Extracts sequence from docID and sends to cache for buffering

(ctx context.Context, docID string)

Source from the content-addressed store, hash-verified

693
694// Process unused sequence notification. Extracts sequence from docID and sends to cache for buffering
695func (c *changeCache) processUnusedSequenceRange(ctx context.Context, docID string) {
696 // _sync:unusedSequences:fromSeq:toSeq
697 sequencesStr := strings.TrimPrefix(docID, c.metaKeys.UnusedSeqRangePrefix())
698 sequences := strings.Split(sequencesStr, ":")
699 if len(sequences) != 2 {
700 return
701 }
702
703 fromSequence, err := strconv.ParseUint(sequences[0], 10, 64)
704 if err != nil {
705 base.WarnfCtx(ctx, "Unable to identify from sequence number for unused sequences notification with key: %s, error: %s", base.UD(docID), err)
706 return
707 }
708 toSequence, err := strconv.ParseUint(sequences[1], 10, 64)
709 if err != nil {
710 base.WarnfCtx(ctx, "Unable to identify to sequence number for unused sequence notification with key: %s, error: %s", base.UD(docID), err)
711 return
712 }
713
714 c.releaseUnusedSequenceRange(ctx, fromSequence, toSequence, channels.NewFeedTimestampFromNow())
715}
716
717func (c *changeCache) processPrincipalDoc(ctx context.Context, docID string, docJSON []byte, isUser bool, timeReceived channels.FeedTimestamp) {
718

Callers 1

DocChangedMethod · 0.95

Calls 5

WarnfCtxFunction · 0.92
UDFunction · 0.92
NewFeedTimestampFromNowFunction · 0.92
UnusedSeqRangePrefixMethod · 0.80

Tested by

no test coverage detected