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

Method parseAncestorRevisions

db/revision.go:161–179  ·  view source on GitHub ↗

Returns revisions as a slice of ancestor revids, from the parent to the target ancestor.

(toAncestorRevID string)

Source from the content-addressed store, hash-verified

159
160// Returns revisions as a slice of ancestor revids, from the parent to the target ancestor.
161func (revisions Revisions) parseAncestorRevisions(toAncestorRevID string) []string {
162 start, ids := splitRevisionList(revisions)
163 if ids == nil || len(ids) < 2 {
164 return nil
165 }
166 result := make([]string, 0)
167
168 // Start at the parent, end at toAncestorRevID
169 start = start - 1
170 for i := 1; i < len(ids); i++ {
171 revID := fmt.Sprintf("%d-%s", start, ids[i])
172 result = append(result, revID)
173 if revID == toAncestorRevID {
174 break
175 }
176 start--
177 }
178 return result
179}
180
181func (attachments AttachmentsMeta) ShallowCopy() AttachmentsMeta {
182 if attachments == nil {

Callers 2

newRevCacheDeltaFunction · 0.80

Calls 1

splitRevisionListFunction · 0.85

Tested by 1