frostfs-api-go/acl/match.go
2020-07-08 01:08:53 +03:00

29 lines
546 B
Go

package acl
const (
_ MatchType = iota
StringEqual
StringNotEqual
)
// Maps MatchType to corresponding function.
// 1st argument of function - header value, 2nd - header filter.
var mMatchFns = map[MatchType]func(Header, Header) bool{
StringEqual: stringEqual,
StringNotEqual: stringNotEqual,
}
const (
mResUndefined = iota
mResMatch
mResMismatch
)
func stringEqual(header, filter Header) bool {
return header.Value() == filter.Value()
}
func stringNotEqual(header, filter Header) bool {
return header.Value() != filter.Value()
}