publishSnapshot builds and atomically publishes a new snapshot. Must be called with e.mu held.
()
| 350 | // publishSnapshot builds and atomically publishes a new snapshot. |
| 351 | // Must be called with e.mu held. |
| 352 | func (e *Engine) publishSnapshot() { |
| 353 | roots := make([]*rootSnapshot, 0, len(e.roots)) |
| 354 | for _, rs := range e.roots { |
| 355 | roots = append(roots, &rootSnapshot{ |
| 356 | root: rs.root, |
| 357 | snap: rs.index.Snapshot(), |
| 358 | }) |
| 359 | } |
| 360 | slices.SortFunc(roots, func(a, b *rootSnapshot) int { |
| 361 | return strings.Compare(a.root, b.root) |
| 362 | }) |
| 363 | e.snap.Store(&roots) |
| 364 | } |
no test coverage detected