feat(aa): ensure accesses are slice of string.

This commit is contained in:
Alexandre Pujol 2024-04-23 21:17:25 +01:00
parent a2910122d2
commit c719a0a109
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
16 changed files with 240 additions and 210 deletions

View file

@ -7,7 +7,7 @@ package aa
type IOUring struct {
RuleBase
Qualifier
Access string
Access []string
Label string
}
@ -15,15 +15,15 @@ func newIOUringFromLog(log map[string]string) Rule {
return &IOUring{
RuleBase: newRuleFromLog(log),
Qualifier: newQualifierFromLog(log),
Access: toAccess(log["requested"]),
Access: toAccess(tokIOURING, log["requested"]),
Label: log["label"],
}
}
func (r *IOUring) Less(other any) bool {
o, _ := other.(*IOUring)
if r.Access != o.Access {
return r.Access < o.Access
if len(r.Access) != len(o.Access) {
return len(r.Access) < len(o.Access)
}
if r.Label != o.Label {
return r.Label < o.Label
@ -33,5 +33,7 @@ func (r *IOUring) Less(other any) bool {
func (r *IOUring) Equals(other any) bool {
o, _ := other.(*IOUring)
return r.Access == o.Access && r.Label == o.Label && r.Qualifier.Equals(o.Qualifier)
return slices.Equal(r.Access, o.Access) && r.Label == o.Label && r.Qualifier.Equals(o.Qualifier)
}
}