------------------------------------------------------------ NewCollection returns a new, unstarted Collection instance.
(options CollectionOptions)
| 628 | |
| 629 | // NewCollection returns a new, unstarted Collection instance. |
| 630 | func 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 | } |
searching dependent graphs…