| 772 | } |
| 773 | |
| 774 | func (e *Manager) committedState(ctx context.Context, ensureMinTime time.Duration) (CurrentSnapshot, error) { |
| 775 | e.mu.Lock() |
| 776 | defer e.mu.Unlock() |
| 777 | |
| 778 | if now := e.timeFunc().Add(ensureMinTime); now.After(e.lastKnownState.ValidUntil) { |
| 779 | contentlog.Log2( |
| 780 | ctx, e.log, |
| 781 | "refreshing committed state because it's no longer valid", |
| 782 | logparam.Time("now", now), |
| 783 | logparam.Time("validUntil", e.lastKnownState.ValidUntil), |
| 784 | ) |
| 785 | |
| 786 | if err := e.refreshLocked(ctx); err != nil { |
| 787 | return CurrentSnapshot{}, err |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | return e.lastKnownState, nil |
| 792 | } |
| 793 | |
| 794 | // GetCompleteIndexSet returns the set of blobs forming a complete index set up to the provided epoch number. |
| 795 | func (e *Manager) GetCompleteIndexSet(ctx context.Context, maxEpoch int) ([]blob.Metadata, time.Time, error) { |