util/syspolicy: delete some unused code in handler.go

There's a TODO to delete all of handler.go, but part of it's
still used in another repo.

But this deletes some.

Updates #17022

Change-Id: Ic5a8a5a694ca258440307436731cd92b45ee2d21
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2025-09-03 09:17:24 -07:00 committed by Brad Fitzpatrick
parent c9f214e503
commit 0f3598b467

View File

@ -8,7 +8,6 @@ import (
"tailscale.com/util/syspolicy/rsop"
"tailscale.com/util/syspolicy/setting"
"tailscale.com/util/syspolicy/source"
"tailscale.com/util/testenv"
)
// TODO(nickkhyl): delete this file once other repos are updated.
@ -36,19 +35,10 @@ type Handler interface {
//
// Deprecated: using [RegisterStore] should be preferred.
func RegisterHandler(h Handler) {
rsop.RegisterStore("DeviceHandler", setting.DeviceScope, WrapHandler(h))
rsop.RegisterStore("DeviceHandler", setting.DeviceScope, handlerStore{h})
}
// SetHandlerForTest wraps and sets the specified handler as the device's policy
// [source.Store] for the duration of tb.
//
// Deprecated: using [MustRegisterStoreForTest] should be preferred.
func SetHandlerForTest(tb testenv.TB, h Handler) {
RegisterWellKnownSettingsForTest(tb)
MustRegisterStoreForTest(tb, "DeviceHandler-TestOnly", setting.DefaultScope(), WrapHandler(h))
}
var _ source.Store = (*handlerStore)(nil)
var _ source.Store = handlerStore{}
// handlerStore is a [source.Store] that calls the underlying [Handler].
//
@ -57,11 +47,6 @@ type handlerStore struct {
h Handler
}
// WrapHandler returns a [source.Store] that wraps the specified [Handler].
func WrapHandler(h Handler) source.Store {
return handlerStore{h}
}
// Lock implements [source.Lockable].
func (s handlerStore) Lock() error {
if lockable, ok := s.h.(source.Lockable); ok {