(remote string)
| 534 | } |
| 535 | |
| 536 | func (sc *SubCache[EntityT, ExcerptT, CacheT]) MergeAll(remote string) <-chan entity.MergeResult { |
| 537 | out := make(chan entity.MergeResult) |
| 538 | |
| 539 | // Intercept merge results to update the cache properly |
| 540 | go func() { |
| 541 | defer close(out) |
| 542 | |
| 543 | author, err := sc.getUserIdentity() |
| 544 | if err != nil { |
| 545 | out <- entity.NewMergeError(err, "") |
| 546 | return |
| 547 | } |
| 548 | |
| 549 | results := sc.actions.MergeAll(sc.repo, sc.resolvers(), remote, author) |
| 550 | for result := range results { |
| 551 | out <- result |
| 552 | |
| 553 | if result.Err != nil { |
| 554 | continue |
| 555 | } |
| 556 | |
| 557 | switch result.Status { |
| 558 | case entity.MergeStatusNew, entity.MergeStatusUpdated: |
| 559 | e := result.Entity.(EntityT) |
| 560 | cached := sc.makeCached(e, sc.entityUpdated) |
| 561 | |
| 562 | sc.mu.Lock() |
| 563 | sc.excerpts[result.Id] = sc.makeExcerpt(cached) |
| 564 | // might as well keep them in memory |
| 565 | sc.cached[result.Id] = cached |
| 566 | sc.mu.Unlock() |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | err = sc.write() |
| 571 | if err != nil { |
| 572 | out <- entity.NewMergeError(err, "") |
| 573 | return |
| 574 | } |
| 575 | }() |
| 576 | |
| 577 | return out |
| 578 | |
| 579 | } |
| 580 | |
| 581 | func (sc *SubCache[EntityT, ExcerptT, CacheT]) GetNamespace() string { |
| 582 | return sc.namespace |
nothing calls this directly
no test coverage detected