use const instead of literals for `tableIndex` (#11039)
This commit is contained in:
parent
ffe3806aaf
commit
25ea1a9276
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// ACLTokens is used when saving a snapshot
|
// ACLTokens is used when saving a snapshot
|
||||||
func (s *Snapshot) ACLTokens() (memdb.ResultIterator, error) {
|
func (s *Snapshot) ACLTokens() (memdb.ResultIterator, error) {
|
||||||
iter, err := s.tx.Get(tableACLTokens, "id")
|
iter, err := s.tx.Get(tableACLTokens, indexID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ func aclTokenGetFromIndex(tx ReadTxn, id string, index string, entMeta *structs.
|
||||||
}
|
}
|
||||||
|
|
||||||
func aclTokenListAll(tx ReadTxn, _ *structs.EnterpriseMeta) (memdb.ResultIterator, error) {
|
func aclTokenListAll(tx ReadTxn, _ *structs.EnterpriseMeta) (memdb.ResultIterator, error) {
|
||||||
return tx.Get(tableACLTokens, "id")
|
return tx.Get(tableACLTokens, indexID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func aclTokenListByPolicy(tx ReadTxn, policy string, _ *structs.EnterpriseMeta) (memdb.ResultIterator, error) {
|
func aclTokenListByPolicy(tx ReadTxn, policy string, _ *structs.EnterpriseMeta) (memdb.ResultIterator, error) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ func systemMetadataSetTxn(tx WriteTxn, idx uint64, entry *structs.SystemMetadata
|
||||||
if err := tx.Insert(tableSystemMetadata, entry); err != nil {
|
if err := tx.Insert(tableSystemMetadata, entry); err != nil {
|
||||||
return fmt.Errorf("failed inserting system metadata: %s", err)
|
return fmt.Errorf("failed inserting system metadata: %s", err)
|
||||||
}
|
}
|
||||||
if err := tx.Insert("index", &IndexEntry{tableSystemMetadata, idx}); err != nil {
|
if err := tx.Insert(tableIndex, &IndexEntry{tableSystemMetadata, idx}); err != nil {
|
||||||
return fmt.Errorf("failed updating index: %v", err)
|
return fmt.Errorf("failed updating index: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ func systemMetadataDeleteTxn(tx WriteTxn, idx uint64, key string) error {
|
||||||
if err := tx.Delete(tableSystemMetadata, existing); err != nil {
|
if err := tx.Delete(tableSystemMetadata, existing); err != nil {
|
||||||
return fmt.Errorf("failed removing system metadata: %s", err)
|
return fmt.Errorf("failed removing system metadata: %s", err)
|
||||||
}
|
}
|
||||||
if err := tx.Insert("index", &IndexEntry{tableSystemMetadata, idx}); err != nil {
|
if err := tx.Insert(tableIndex, &IndexEntry{tableSystemMetadata, idx}); err != nil {
|
||||||
return fmt.Errorf("failed updating index: %s", err)
|
return fmt.Errorf("failed updating index: %s", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue