Documentation
¶
Index ¶
- Constants
- func RegisterSegmentRegPlugin(p SegmentRegistrationPlugin)
- type IgnoreSegmentRegistrar
- type IgnoreSegmentRegistrationPlugin
- type RegistrationSummary
- type SegmentRegistrar
- type SegmentRegistrars
- func (s SegmentRegistrars) GetSegmentRegistrar(policyType beacon.RegPolicyType, registrationPolicy string) (SegmentRegistrar, error)
- func (s SegmentRegistrars) RegisterDefaultSegmentRegistrar(policyType beacon.RegPolicyType, registrar SegmentRegistrar) error
- func (s SegmentRegistrars) RegisterSegmentRegistrar(policyType beacon.RegPolicyType, registrationPolicy string, ...) error
- type SegmentRegistrationPlugin
Constants ¶
const ( LogLevelDebug logLevel = "debug" LogLevelInfo logLevel = "info" LogLevelError logLevel = "error" )
const DefaultPluginID string = "default"
DefaultPluginID is the id for the default segment registration plugin. It is used for the policies that do not have any registration policies.
Variables ¶
This section is empty.
Functions ¶
func RegisterSegmentRegPlugin ¶
func RegisterSegmentRegPlugin(p SegmentRegistrationPlugin)
RegisterSegmentRegPlugin registers a segment registration plugin using its unique ID. It panics if a plugin with the same ID is already registered.
Types ¶
type IgnoreSegmentRegistrar ¶
type IgnoreSegmentRegistrar struct {
// contains filtered or unexported fields
}
func (*IgnoreSegmentRegistrar) RegisterSegments ¶
func (r *IgnoreSegmentRegistrar) RegisterSegments( ctx context.Context, segments []beacon.Beacon, peers []uint16, ) *RegistrationSummary
type IgnoreSegmentRegistrationPlugin ¶
type IgnoreSegmentRegistrationPlugin struct{}
func (IgnoreSegmentRegistrationPlugin) ID ¶
func (p IgnoreSegmentRegistrationPlugin) ID() string
func (IgnoreSegmentRegistrationPlugin) New ¶
func (p IgnoreSegmentRegistrationPlugin) New( ctx context.Context, policyType beacon.RegPolicyType, config map[string]any, ) (SegmentRegistrar, error)
type RegistrationSummary ¶
type RegistrationSummary struct {
// contains filtered or unexported fields
}
func NewSummary ¶
func NewSummary() *RegistrationSummary
func SummarizeSegStats ¶
func SummarizeSegStats(s seghandler.SegStats, b map[string]beacon.Beacon) *RegistrationSummary
func (*RegistrationSummary) GetCount ¶
func (s *RegistrationSummary) GetCount() int
func (*RegistrationSummary) GetIfIDs ¶
func (s *RegistrationSummary) GetIfIDs() []uint16
func (*RegistrationSummary) GetSrcs ¶
func (s *RegistrationSummary) GetSrcs() map[addr.IA]struct{}
func (*RegistrationSummary) RecordBeacon ¶
func (s *RegistrationSummary) RecordBeacon(beacon *beacon.Beacon)
func (*RegistrationSummary) RecordSegment ¶
func (s *RegistrationSummary) RecordSegment(segment *seg.PathSegment)
type SegmentRegistrar ¶
type SegmentRegistrars ¶
type SegmentRegistrars map[beacon.RegPolicyType]map[string]SegmentRegistrar
SegmentRegistrars maps a policy type to a map of registration policy names to their corresponding segment registrars.
func (SegmentRegistrars) GetSegmentRegistrar ¶
func (s SegmentRegistrars) GetSegmentRegistrar( policyType beacon.RegPolicyType, registrationPolicy string, ) (SegmentRegistrar, error)
GetSegmentRegistrar returns the segment registrar for the given policy type and registration policy. It should be registered with either RegisterSegmentRegistrar or RegisterDefaultRegistrar first.
func (SegmentRegistrars) RegisterDefaultSegmentRegistrar ¶
func (s SegmentRegistrars) RegisterDefaultSegmentRegistrar( policyType beacon.RegPolicyType, registrar SegmentRegistrar, ) error
RegisterDefaultSegmentRegistrar registers a default registrar for a given policy type. The default registrar should be registered when no specific registration policy is defined for policyType. The default registrar is associated with the name beacon.DefaultGroup.
func (SegmentRegistrars) RegisterSegmentRegistrar ¶
func (s SegmentRegistrars) RegisterSegmentRegistrar( policyType beacon.RegPolicyType, registrationPolicy string, registrar SegmentRegistrar, ) error
RegisterSegmentRegistrar registers a segment registrar for a given policy type and registration policy.
type SegmentRegistrationPlugin ¶
type SegmentRegistrationPlugin interface {
// ID returns the unique identifier of the plugin.
ID() string
// New creates a new instance of the plugin with the provided configuration.
New(
ctx context.Context,
policyType beacon.RegPolicyType,
config map[string]any,
) (SegmentRegistrar, error)
// Validate validates the configuration of the plugin.
Validate(config map[string]any) error
}
func GetDefaultSegmentRegPlugin ¶
func GetDefaultSegmentRegPlugin() (SegmentRegistrationPlugin, bool)
GetDefaultSegmentRegPlugin retrieves the segment registration plugin that has the id DefaultPluginID.
func GetSegmentRegPlugin ¶
func GetSegmentRegPlugin(id string) (SegmentRegistrationPlugin, bool)
GetSegmentRegPlugin retrieves a segment registration plugin by its ID. It should be registered with RegisterSegmentRegPlugin first. The second return value is false if no plugin with the given ID is found in the registry.