y/watermark.go
func (w *WaterMark) WaitForMark(ctx context.Context, index uint64) error {
	if w.DoneUntil() >= index {
		return nil
	}
	waitCh := make(chan struct{})
	w.markCh <- mark{index: index, waiter: waitCh}

	select {
	case <-ctx.Done():
		return ctx.Err()
	case <-waitCh:
		return nil
	}
}
func (w *WaterMark) WaitForMark(ctx context.Context, index uint64) error {
	if w.DoneUntil() >= index {
		return nil
	}
	waitCh := make(chan struct{})
	w.markCh <- mark{index: index, waiter: waitCh}

	select {
	case <-ctx.Done():
		return ctx.Err()
	case <-waitCh:
		return nil
	}
}
func ( w * WaterMark ) WaitForMark ( ctx context . Context , index uint64 ) error { if w . DoneUntil ( ) >= index { return nil } waitCh := make ( chan struct { } ) w . markCh <- mark { index : index , waiter : waitCh } select { case <- ctx . Done ( ) : return ctx . Err ( ) case <- waitCh : return nil } }
// WaitForMark waits until the given index is marked as done.
WaitForMark waits until the given index is marked as done .