util/syspolicy: add read boolean setting (#9592)

This commit is contained in:
Claire Wang
2023-09-29 21:27:04 -04:00
committed by GitHub
parent 324f0d5f80
commit a56e58c244
7 changed files with 88 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ type Handler interface {
ReadString(key string) (string, error)
// ReadUInt64 reads the policy settings uint64 value given the key.
ReadUInt64(key string) (uint64, error)
// ReadBool reads the policy setting's boolean value, given the key.
ReadBoolean(key string) (bool, error)
}
// ErrNoSuchKey is returned when the specified key does not have a value set.
@@ -35,6 +37,10 @@ func (defaultHandler) ReadUInt64(_ string) (uint64, error) {
return 0, ErrNoSuchKey
}
func (defaultHandler) ReadBoolean(_ string) (bool, error) {
return false, ErrNoSuchKey
}
// markHandlerInUse is called before handler methods are called.
func markHandlerInUse() {
handlerUsed.Store(true)