MCPcopy Create free account
hub / github.com/couchbase/moss / NewCollection

Function NewCollection

api.go:630–661  ·  view source on GitHub ↗

------------------------------------------------------------ NewCollection returns a new, unstarted Collection instance.

(options CollectionOptions)

Source from the content-addressed store, hash-verified

628
629// NewCollection returns a new, unstarted Collection instance.
630func NewCollection(options CollectionOptions) (
631 Collection, error) {
632 histograms := make(ghistogram.Histograms)
633 histograms["ExecuteBatchBytes"] =
634 ghistogram.NewNamedHistogram("ExecuteBatchBytes", 10, 4, 4)
635 histograms["ExecuteBatchOpsCount"] =
636 ghistogram.NewNamedHistogram("ExecuteBatchOpsCount", 10, 4, 4)
637 histograms["ExecuteBatchUsecs"] =
638 ghistogram.NewNamedHistogram("ExecuteBatchUsecs", 10, 4, 4)
639 histograms["MergerUsecs"] =
640 ghistogram.NewNamedHistogram("MergerUsecs", 10, 4, 4)
641 histograms["MutationKeyBytes"] =
642 ghistogram.NewNamedHistogram("MutationKeyBytes", 10, 4, 4)
643 histograms["MutationValBytes"] =
644 ghistogram.NewNamedHistogram("MutationValBytes", 10, 4, 4)
645
646 c := &collection{
647 options: &options,
648 stopCh: make(chan struct{}),
649 pingMergerCh: make(chan ping, 10),
650 doneMergerCh: make(chan struct{}),
651 donePersisterCh: make(chan struct{}),
652 lowerLevelSnapshot: NewSnapshotWrapper(options.LowerLevelInit, nil),
653 stats: &CollectionStats{},
654 histograms: histograms,
655 }
656
657 c.stackDirtyTopCond = sync.NewCond(&c.m)
658 c.stackDirtyBaseCond = sync.NewCond(&c.m)
659
660 return c, nil
661}

Callers 15

closeReopenFuncFunction · 0.85
TestIteratorMergeOpsFunction · 0.85
testIteratorSeekToFunction · 0.85
restoreCollectionFunction · 0.85
testSimpleStoreExFunction · 0.85
testStoreOpsFunction · 0.85
testStoreCompactionFunction · 0.85
TestNewCollectionFunction · 0.85
TestEmptyFunction · 0.85

Calls 1

NewSnapshotWrapperFunction · 0.85

Tested by 15

TestIteratorMergeOpsFunction · 0.68
testIteratorSeekToFunction · 0.68
testSimpleStoreExFunction · 0.68
testStoreOpsFunction · 0.68
testStoreCompactionFunction · 0.68
TestNewCollectionFunction · 0.68
TestEmptyFunction · 0.68
TestBatchSortFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…