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

Method QueryTombstones

db/query.go:741–768  ·  view source on GitHub ↗
(ctx context.Context, olderThan time.Time, limit int)

Source from the content-addressed store, hash-verified

739}
740
741func (c *DatabaseCollection) QueryTombstones(ctx context.Context, olderThan time.Time, limit int) (sgbucket.QueryResultIterator, error) {
742
743 // View Query
744 if c.useViews() {
745 opts := Body{
746 "stale": false,
747 QueryParamStartKey: 1,
748 QueryParamEndKey: olderThan.Unix(),
749 }
750 if limit != 0 {
751 opts[QueryParamLimit] = limit
752 }
753 return c.dbCtx.ViewQueryWithStats(ctx, c.dataStore, DesignDocSyncHousekeeping(), ViewTombstones, opts)
754 }
755
756 // N1QL Query
757 tombstoneQueryStatement := replaceSyncTokensQuery(QueryTombstones.statement, c.UseXattrs())
758 tombstoneQueryStatement = replaceIndexTokensQuery(tombstoneQueryStatement, sgIndexes[IndexTombstones], c.UseXattrs(), c.numIndexPartitions())
759 if limit != 0 {
760 tombstoneQueryStatement = fmt.Sprintf("%s LIMIT %d", tombstoneQueryStatement, limit)
761 }
762
763 params := map[string]interface{}{
764 QueryParamOlderThan: olderThan.Unix(),
765 }
766
767 return N1QLQueryWithStats(ctx, c.dataStore, QueryTypeTombstones, tombstoneQueryStatement, params, base.RequestPlus, QueryTombstones.adhoc, c.dbStats(), c.slowQueryWarningThreshold())
768}
769
770func changesViewOptions(channelName string, startSeq, endSeq uint64, limit int) map[string]interface{} {
771 endKey := []interface{}{channelName, endSeq}

Callers 1

CompactMethod · 0.80

Calls 10

useViewsMethod · 0.95
UseXattrsMethod · 0.95
numIndexPartitionsMethod · 0.95
dbStatsMethod · 0.95
replaceSyncTokensQueryFunction · 0.85
replaceIndexTokensQueryFunction · 0.85
N1QLQueryWithStatsFunction · 0.85
ViewQueryWithStatsMethod · 0.80

Tested by

no test coverage detected