// CommitUpdate persists the CommittedUpdate provided in the slot for (session,
// seqNum). This allows the client to retransmit this update on startup.
359081
func (m *ClientDB) CommitUpdate(id *wtdb.SessionID, seqNum uint16,
	update *wtdb.CommittedUpdate) (uint16, error) {

	m.mu.Lock()
	defer m.mu.Unlock()

	// Fail if session doesn't exist.
	session, ok := m.activeSessions[*id]
	if !ok {
		return 0, wtdb.ErrClientSessionNotFound
	}

	// Check if an update has already been committed for this state.
	dbUpdate, ok := session.CommittedUpdates[seqNum]
	if ok {
		// If the breach hint matches, we'll just return the last
		// applied value so the client can retransmit.
		if dbUpdate.Hint == update.Hint {
			return session.TowerLastApplied, nil
		}

		// Otherwise, fail since the breach hint doesn't match.
		return 0, wtdb.ErrUpdateAlreadyCommitted
	}

	// Sequence number must increment.
	if seqNum != session.SeqNum+1 {
		return 0, wtdb.ErrCommitUnorderedUpdate
	}

	// Save the update and increment the sequence number.
	session.CommittedUpdates[seqNum] = update
	session.SeqNum++

	return session.TowerLastApplied, nil
}
74531
func (itc *internalTabletConn) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error {
	err := itc.tablet.qsc.QueryService().Commit(ctx, target, transactionID)
	return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err))
}
312499
func (tc *TiDBContext) CommitTxn(ctx context.Context) error {
	return tc.session.CommitTxn(ctx)
}
348062
func (t *InjectedTransaction) Commit(ctx context.Context) error {
	t.cfg.RLock()
	defer t.cfg.RUnlock()
	if t.cfg.commitError != nil {
		return t.cfg.commitError
	}
	return t.Transaction.Commit(ctx)
}
266957
func commitIndex(commits []*gitpb.Commit, revision string) int {
	for i, commit := range commits {
		if commit.Id == revision {
			return i
		}
	}
	return -1
}
99134
func (o *ObjectStorage) Commit() error {
	iter, err := o.temporal.IterEncodedObjects(plumbing.AnyObject)
	if err != nil {
		return err
	}

	return iter.ForEach(func(obj plumbing.EncodedObject) error {
		_, err := o.EncodedObjectStorer.SetEncodedObject(obj)
		return err
	})
}
1065003
func (c *ChtIndexerBackend) Commit() error {
	root, err := c.trie.Commit(nil)
	if err != nil {
		return err
	}
	c.triedb.Commit(root, false)

	log.Info("Storing CHT", "section", c.section, "head", fmt.Sprintf("%064x", c.lastHash), "root", fmt.Sprintf("%064x", root))
	StoreChtRoot(c.diskdb, c.section, c.lastHash, root)
	return nil
}
1052613
func (s *Snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) error {
	log.G(ctx).WithFields(logrus.Fields{"name": name, "key": key}).Debug("commit")

	return s.withTransaction(ctx, true, func(ctx context.Context) error {
		id, _, _, err := storage.GetInfo(ctx, key)
		if err != nil {
			return err
		}

		deviceName := s.getDeviceName(id)
		size, err := s.pool.GetUsage(deviceName)
		if err != nil {
			return err
		}

		usage := snapshots.Usage{
			Size: size,
		}

		_, err = storage.CommitActive(ctx, key, name, usage, opts...)
		return err
	})
}
1264003
func (op *noOpUpgrade) Commit(state State) (*State, error) {
	change := stateChange{
		Kind: RunHook,
		Step: Queued,
		Hook: &hook.Info{Kind: hooks.UpgradeCharm},
	}
	newState := change.apply(state)
	return newState, nil
}
616551
func (s *Server) SendUpdate(update interface{}) error {

	select {
	case s.updates <- update:
		return nil
	case <-s.quit:
		return ErrServerShuttingDown
	}
}
1223283
func (tx *protoTxn) Commit(ctx context.Context) error {
	if tx.err != nil {
		return tx.err
	}
	return tx.txn.Commit(ctx)
}
638558
func (t *txn) Commit(ctx context.Context) error {
	_, err := t.c.safeUpdate(t.updates...)
	return err
}
178533
func (r *RollbackTx) Commit() error {
	if err := r.Tx.Commit(); err != nil {
		return err
	}
	r.committed = true
	return nil
}
106129
func (txn *Txn) Commit() error {
	if txn.managed {
		panic("managed transaction cannot be committed directly")
	}

	runtime.SetFinalizer(txn, nil)
	return txn.commit()
}
618967
func (ra *runAction) Commit(state State) (*State, error) {
	return stateChange{
		Kind: continuationKind(state),
		Step: Pending,
		Hook: state.Hook,
	}.apply(state), nil
}
1232290
func (d *LogBatch) Commit() (err error) {
	log.Printf("%s: BatchCommit\n", d.Name)
	return d.child.Commit()
}
234273
func (tx *VTGateTx) Commit(ctx context.Context) error {
	if tx.session == nil {
		return fmt.Errorf("commit: not in transaction")
	}
	err := tx.conn.impl.Commit(ctx, tx.session, false /* twopc */)
	tx.session = nil
	return err
}