Movatterモバイル変換


[0]ホーム

URL:


rsop

package
v1.92.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License:BSD-3-ClauseImports:18Imported by:3

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package rsop facilitatessource.Store registration viaRegisterStoreand provides access to the effective policy merged from all registered sourcesviaPolicyFor.

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyConsumed =errors.New("the store registration is no longer valid")

ErrAlreadyConsumed is the error returned whenStoreRegistration.ReplaceStoreorStoreRegistration.Unregister is called more than once.

View Source
var ErrPolicyClosed =errors.New("effective policy closed")

ErrPolicyClosed is returned byPolicy.Reload, [Policy.addSource],[Policy.removeSource] and [Policy.replaceSource] if the policy has been closed.

Functions

This section is empty.

Types

typeChange

type Change[Tany] struct {New, Old T}

Change represents a change from the Old to the New value of type T.

typePolicy

type Policy struct {// contains filtered or unexported fields}

Policy provides access to the current effectivesetting.Snapshot for a givenscope and allows to reload it from the underlyingsource.Store list. It also allows tosubscribe and receive a callback whenever the effectivesetting.Snapshot is changed.

It is safe for concurrent use.

funcPolicyFor

func PolicyFor(scopesetting.PolicyScope) (*Policy,error)

PolicyFor returns thePolicy for the specified scope,creating it from the registered [source.Store]s if it doesn't already exist.

func (*Policy)Close

func (p *Policy) Close()

Close initiates the closing of the policy.ThePolicy.Done channel is closed to signal that the operation has been completed.

func (*Policy)Done

func (p *Policy) Done() <-chan struct{}

Done returns a channel that is closed when thePolicy is closed.

func (*Policy)Get

func (p *Policy) Get() *setting.Snapshot

Get returns the effectivesetting.Snapshot.

func (*Policy)IsValid

func (p *Policy) IsValid()bool

IsValid reports whether p is in a valid state and has not been closed.

Since p's state can be changed by other goroutines at any time, this shouldonly be used as an optimization.

func (*Policy)RegisterChangeCallback

func (p *Policy) RegisterChangeCallback(callbackPolicyChangeCallback) (unregister func())

RegisterChangeCallback adds a function to be called whenever the effectivepolicy changes. The returned function can be used to unregister the callback.

func (*Policy)Reload

func (p *Policy) Reload() (*setting.Snapshot,error)

Reload synchronously re-reads policy settings from the underlying list of policy sources,constructing a new mergedsetting.Snapshot even if the policy remains unchanged.In most scenarios, there's no need to re-read the policy manually.Instead, it is recommended to register a policy change callback, or to usethe most recentsetting.Snapshot returned by thePolicy.Get method.

It must not be called with p.mu held.

func (*Policy)Scope

func (p *Policy) Scope()setting.PolicyScope

Scope returns thesetting.PolicyScope that this policy applies to.

typePolicyChange

type PolicyChange struct {// contains filtered or unexported fields}

PolicyChange describes a policy change.

func (PolicyChange)HasChanged

func (cPolicyChange) HasChanged(keypkey.Key)bool

HasChanged reports whether a policy setting with the specifiedpkey.Key, has changed.

func (PolicyChange)HasChangedAnyOfadded inv1.86.0

func (cPolicyChange) HasChangedAnyOf(keys ...pkey.Key)bool

HasChangedAnyOf reports whether any of the specified policy settings has changed.

func (PolicyChange)New

New returns thesetting.Snapshot after the change.

func (PolicyChange)Old

Old returns thesetting.Snapshot before the change.

typePolicyChangeCallback

type PolicyChangeCallback func(policyclient.PolicyChange)

PolicyChangeCallback is a function called whenever a policy changes.

typeStoreRegistration

type StoreRegistration struct {// contains filtered or unexported fields}

StoreRegistration is asource.Store registered for use in the specified scope.It can be used to unregister the store, or replace it with another one.

funcRegisterStore

func RegisterStore(namestring, scopesetting.PolicyScope, storesource.Store) (*StoreRegistration,error)

RegisterStore registers a new policysource.Store with the specified name andsetting.PolicyScope.

funcRegisterStoreForTest

func RegisterStoreForTest(tbtestenv.TB, namestring, scopesetting.PolicyScope, storesource.Store) (*StoreRegistration,error)

RegisterStoreForTest is likeRegisterStore, but unregisters the store whentb and all its subtests complete.

func (*StoreRegistration)ReplaceStore

func (r *StoreRegistration) ReplaceStore(newsource.Store) (*StoreRegistration,error)

ReplaceStore replaces the registered store with the new one,returning a newStoreRegistration or an error.

func (*StoreRegistration)Unregister

func (r *StoreRegistration) Unregister()error

Unregister reverts the registration.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp