// Done returns the constructed Table and resets b.
350551
func (b *Builder) Done() *Table {
	if len(b.t.colNames) == 0 {
		return new(Table)
	}
	t := b.t
	b.t = Table{}
	return &t
}
439978
func (b *rescanBatch) done(err error) {
	for _, c := range b.errChans {
		c <- err
	}
}
623326
func (op *DestroyUnitOperation) Done(err error) error {
	if err != nil {
		if !op.Force {
			return errors.Annotatef(err, "cannot destroy unit %q", op.unit)
		}
		op.AddError(errors.Errorf("force destroy unit %q proceeded despite encountering ERROR %v", op.unit, err))
	}
	if err := op.eraseHistory(); err != nil {
		if !op.Force {
			logger.Errorf("cannot delete history for unit %q: %v", op.unit.globalKey(), err)
		}
		op.AddError(errors.Errorf("force erase unit's %q history proceeded despite encountering ERROR %v", op.unit.globalKey(), err))
	}
	return nil
}
420365
func (db *PGStore) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{}) {
	if interval <= 0 {
		interval = defaultInterval
	}

	quit, done := make(chan struct{}), make(chan struct{})
	go db.cleanup(interval, quit, done)
	return quit, done
}
1243794
func (p *Pool) Done() {
	p.mutex.Lock()
	defer p.mutex.Unlock()
	p.wg.Done()
	p.counter--
}
176866
func (rl *ReqLog) Finish(rle *ReqLogEntry) {
	rl.lock.Lock()
	defer rl.lock.Unlock()

	rle.Active = false
	rle.EndTime = time.Now()

	rl.maybeCleanup()
}
823523
func (t *servingTask) done() uint64 {
	t.servingTime += uint64(mclock.Now())
	close(t.token)
	return t.servingTime
}
473050
func (m *Monitor) Done() int64 {
	m.mu.Lock()
	if now := m.update(0); m.sBytes > 0 {
		m.reset(now)
	}
	m.active = false
	m.tLast = 0
	n := m.bytes
	m.mu.Unlock()
	return n
}
124079
func (ev *ChangeEvent) Done(err error) {
	//TODO publish response to the topic
	if err != nil {
		logrus.DefaultLogger().Error(err)
	}
}
951292
func (s *CrawlerMetrics) SetTablesDeleted(v int64) *CrawlerMetrics {
	s.TablesDeleted = &v
	return s
}
1062613
func (m *googlePubSubMessage) Done(ack bool) {
	if ack == true {
		m.OriginalMessage.Ack()
	} else {
		m.OriginalMessage.Nack()
	}
}
598039
func Do(ctx context.Context, tasks ...Task) error {
	n := len(tasks)

	done := make(chan error, n)
	for i, task := range tasks {
		go func(task Task) {
			err := task()
			if err != nil {
				done <- errors.WithMessage(err, fmt.Sprintf("task %d", i+1))
				return
			}
			done <- nil
		}(task)
	}

	for i := 0; i < n; i++ {
		select {
		case err := <-done:
			if err != nil {
				return errors.WithStack(err)
			}
		case <-ctx.Done():
			return werrors.ErrCancelled
		}
	}
	return nil
}
296557
func (s *CrawlerMetrics) SetTablesCreated(v int64) *CrawlerMetrics {
	s.TablesCreated = &v
	return s
}
47004
func (w *Wrapped) done(err error) {
	w.once.Do(w.init)
	w.cancelLock.Lock()

	// Set the result
	w.resultErr = err
	w.resultSet = true

	// Notify any waiters
	w.cancelCond.Broadcast()

	// Unlock since the next call can be blocking
	w.cancelLock.Unlock()

	// Notify any channel listeners
	w.errCh <- err
}
1117353
func (op *UpdateUnitsOperation) Done(err error) error {
	if err != nil {
		return errors.Annotate(err, "updating units")
	}
	all := op.allOps()
	for _, op := range all {
		if err := op.Done(nil); err != nil {
			return errors.Trace(err)
		}
	}
	return nil
}
651544
func (a *UnitAgent) Done(err error) {
	a.errReason = err
	close(a.dead)
}
1220867
func (t *Trace) finish() {
	if t.End.IsZero() {
		t.End = time.Now()
	}
}