Add missing index for read

This commit is contained in:
kisunji 2022-06-07 19:54:09 -04:00 committed by Chris S. Kim
parent d026d84880
commit 196a1c468a
1 changed files with 8 additions and 1 deletions

View File

@ -129,8 +129,15 @@ func (s *ServiceIntentionSourceIndex) FromArgs(args ...interface{}) ([]byte, err
if !ok {
return nil, fmt.Errorf("argument must be a structs.ServiceID: %#v", args[0])
}
// Intention queries cannot use a peered service as a source
peer := structs.LocalPeerKeyword
sn := arg.String()
// add 2 for null separator after each string
buf := newIndexBuilder(len(peer) + len(sn) + 2)
buf.String(peer)
buf.String(sn)
// Add the null character as a terminator
return []byte(arg.String() + "\x00"), nil
return buf.Bytes(), nil
}
func configIntentionsListTxn(tx ReadTxn, ws memdb.WatchSet, entMeta *acl.EnterpriseMeta) (uint64, structs.Intentions, bool, error) {