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

Method getHistory

db/revtree.go:766–782  ·  view source on GitHub ↗

Returns the history of a revid as an array of revids in reverse chronological order. Returns error if detects cycle(s) in rev tree

(revid string)

Source from the content-addressed store, hash-verified

764// Returns the history of a revid as an array of revids in reverse chronological order.
765// Returns error if detects cycle(s) in rev tree
766func (tree RevTree) getHistory(revid string) ([]string, error) {
767 maxHistory := len(tree)
768
769 history := make([]string, 0, 5)
770 for revid != "" {
771 info, err := tree.getInfo(revid)
772 if err != nil {
773 break
774 }
775 history = append(history, revid)
776 if len(history) > maxHistory {
777 return history, fmt.Errorf("getHistory found cycle in revision tree, history calculated as: %v", history)
778 }
779 revid = info.Parent
780 }
781 return history, nil
782}
783
784// ////// ENCODED REVISION LISTS (_revisions):
785

Callers 13

ContainsCyclesMethod · 0.95
IsChannelRemovalMethod · 0.80
TestRevTreeGetHistoryFunction · 0.80
addAndGetFunction · 0.80
addPruneAndGetFunction · 0.80
getHistoryWithTimeoutFunction · 0.80
get1xRevFromDocMethod · 0.80

Calls 2

getInfoMethod · 0.95
ErrorfMethod · 0.80

Tested by 7

TestRevTreeGetHistoryFunction · 0.64
addAndGetFunction · 0.64
addPruneAndGetFunction · 0.64
getHistoryWithTimeoutFunction · 0.64