mirror of
https://github.com/tailscale/tailscale.git
synced 2025-09-21 13:41:46 +02:00
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:
parent
c9f214e503
commit
0f3598b467
@ -8,7 +8,6 @@ import (
|
|||||||
"tailscale.com/util/syspolicy/rsop"
|
"tailscale.com/util/syspolicy/rsop"
|
||||||
"tailscale.com/util/syspolicy/setting"
|
"tailscale.com/util/syspolicy/setting"
|
||||||
"tailscale.com/util/syspolicy/source"
|
"tailscale.com/util/syspolicy/source"
|
||||||
"tailscale.com/util/testenv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(nickkhyl): delete this file once other repos are updated.
|
// TODO(nickkhyl): delete this file once other repos are updated.
|
||||||
@ -36,19 +35,10 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// Deprecated: using [RegisterStore] should be preferred.
|
// Deprecated: using [RegisterStore] should be preferred.
|
||||||
func RegisterHandler(h Handler) {
|
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
|
var _ source.Store = handlerStore{}
|
||||||
// [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)
|
|
||||||
|
|
||||||
// handlerStore is a [source.Store] that calls the underlying [Handler].
|
// handlerStore is a [source.Store] that calls the underlying [Handler].
|
||||||
//
|
//
|
||||||
@ -57,11 +47,6 @@ type handlerStore struct {
|
|||||||
h Handler
|
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].
|
// Lock implements [source.Lockable].
|
||||||
func (s handlerStore) Lock() error {
|
func (s handlerStore) Lock() error {
|
||||||
if lockable, ok := s.h.(source.Lockable); ok {
|
if lockable, ok := s.h.(source.Lockable); ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user