---------------------------------------------------------------
(mgr *cbgt.Manager, indexName string)
| 56 | // --------------------------------------------------------------- |
| 57 | |
| 58 | func gatherIndexProgressStats(mgr *cbgt.Manager, indexName string) ( |
| 59 | map[string]interface{}, error) { |
| 60 | if mgr == nil { |
| 61 | return nil, fmt.Errorf("manager not available") |
| 62 | } |
| 63 | |
| 64 | indexDef, pindexImplType, err := mgr.GetIndexDef(indexName, false) |
| 65 | if err != nil || indexDef == nil { |
| 66 | return nil, |
| 67 | fmt.Errorf("unable to obtain index def for `%v`, err: %v", indexName, err) |
| 68 | } |
| 69 | |
| 70 | count, err := pindexImplType.Count(mgr, indexName, "") |
| 71 | if err != nil { |
| 72 | return nil, err |
| 73 | } |
| 74 | |
| 75 | rv := map[string]interface{}{} |
| 76 | rv["doc_count"] = count |
| 77 | |
| 78 | sourcePartitionSeqs := GetSourcePartitionSeqs(SourceSpec{ |
| 79 | SourceType: indexDef.SourceType, |
| 80 | SourceName: indexDef.SourceName, |
| 81 | SourceUUID: indexDef.SourceUUID, |
| 82 | SourceParams: indexDef.SourceParams, |
| 83 | Server: mgr.Server(), |
| 84 | }) |
| 85 | |
| 86 | destPartitionSeqs := map[string]cbgt.UUIDSeq{} |
| 87 | _, pindexes := mgr.CurrentMaps() |
| 88 | for _, pindex := range pindexes { |
| 89 | if pindex.IndexName != indexDef.Name { |
| 90 | continue |
| 91 | } |
| 92 | |
| 93 | if pindex.Dest != nil { |
| 94 | destForwarder, ok := pindex.Dest.(*cbgt.DestForwarder) |
| 95 | if !ok { |
| 96 | continue |
| 97 | } |
| 98 | |
| 99 | partitionSeqsProvider, ok := |
| 100 | destForwarder.DestProvider.(PartitionSeqsProvider) |
| 101 | if !ok { |
| 102 | continue |
| 103 | } |
| 104 | |
| 105 | if partitionSeqs, err := partitionSeqsProvider.PartitionSeqs(); err == nil { |
| 106 | for partitionId, uuidSeq := range partitionSeqs { |
| 107 | destPartitionSeqs[partitionId] = uuidSeq |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | totSeqReceived, numMutationsToIndex, err := obtainDestSeqsForIndex( |
| 114 | indexDef, sourcePartitionSeqs, destPartitionSeqs) |
| 115 | if err != nil { |
no test coverage detected