code: func (c *dbCache) commitTreaps(pendingKeys, pendingRemove TreapForEacher) error {
  	// Perform all leveldb updates using an atomic transaction.
  	return c.updateDB(func(ldbTx *leveldb.Transaction) error {
  		var innerErr error
  		pendingKeys.ForEach(func(k, v []byte) bool {
  			if dbErr := ldbTx.Put(k, v, nil); dbErr != nil {
  				str := fmt.Sprintf("failed to put key %q to "+
  					"ldb transaction", k)
  				innerErr = convertErr(str, dbErr)
  				return false
  			}
  			return true
  		})
  		if innerErr != nil {
  			return innerErr
  		}
  
  		pendingRemove.ForEach(func(k, v []byte) bool {
  			if dbErr := ldbTx.Delete(k, nil); dbErr != nil {
  				str := fmt.Sprintf("failed to delete "+
  					"key %q from ldb transaction",
  					k)
  				innerErr = convertErr(str, dbErr)
  				return false
  			}
  			return true
  		})
  		return innerErr
  	})
  }
docs: // commitTreaps atomically commits all of the passed pending add/update/remove
  // updates to the underlying database.