code: func (batch *Batch) Update(cb func(Tx) error) error {
  	if batch.err != nil {
  		return batch.err
  	}
  
  	if err := cb(&batch.tx); err != nil {
  		return err
  	}
  
  	batch.applied++
  
  	for batch.changelistLen < len(batch.tx.changelist) {
  		sa, err := api.NewStoreAction(batch.tx.changelist[batch.changelistLen])
  		if err != nil {
  			return err
  		}
  		batch.transactionSizeEstimate += sa.Size()
  		batch.changelistLen++
  	}
  
  	if batch.changelistLen >= MaxChangesPerTransaction || batch.transactionSizeEstimate >= (MaxTransactionBytes*3)/4 {
  		if err := batch.commit(); err != nil {
  			return err
  		}
  
  		// Yield the update lock
  		batch.store.updateLock.Unlock()
  		runtime.Gosched()
  		batch.store.updateLock.Lock()
  
  		batch.newTx()
  	}
  
  	return nil
  }
docs: // Update adds a single change to a batch. Each call to Update is atomic, but
  // different calls to Update may be spread across multiple transactions to
  // circumvent transaction size limits.