mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-09 08:55:13 -04:00
Add back upsertEntityNonLocked
This commit is contained in:
parent
f5fa4b8f6e
commit
5ddb2c3cb4
1 changed files with 17 additions and 0 deletions
|
|
@ -324,6 +324,23 @@ func (i *IdentityStore) upsertEntity(entity *identity.Entity, previousEntity *id
|
|||
return nil
|
||||
}
|
||||
|
||||
// upsertEntityNonLocked creates or updates an entity. The lock to modify the
|
||||
// entity should be held before calling this function.
|
||||
func (i *IdentityStore) upsertEntityNonLocked(entity *identity.Entity, previousEntity *identity.Entity, persist bool) error {
|
||||
// Create a MemDB transaction to update both alias and entity
|
||||
txn := i.db.Txn(true)
|
||||
defer txn.Abort()
|
||||
|
||||
err := i.upsertEntityInTxn(txn, entity, previousEntity, persist, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
txn.Commit()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *IdentityStore) MemDBUpsertAliasInTxn(txn *memdb.Txn, alias *identity.Alias, groupAlias bool) error {
|
||||
if txn == nil {
|
||||
return fmt.Errorf("nil txn")
|
||||
|
|
|
|||
Loading…
Reference in a new issue