id

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentIDNotifyMode

type AgentIDNotifyMode uint8

AgentIDNotifyMode are flags to define for which notifications the listeners are interested.

const (
	// NotifyOnConnect will signal interest for notification when the agent first connect.
	NotifyOnConnect AgentIDNotifyMode = 1 << iota
	// NotifyOnReconnect will signal interest for notification when the agent reconnects.
	NotifyOnReconnect
)

func (AgentIDNotifyMode) Includes

func (a AgentIDNotifyMode) Includes(notifyMode AgentIDNotifyMode) bool

Contains will check if a AgentIDNotifyMode includes a different AgentIDNotifyMode.

type Context

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

Context context for the agent ID.

func NewContext

func NewContext(ctx context.Context) *Context

NewContext creates a new ID context to allow fetching ID in concurrent manner.

func (*Context) AgentID

func (i *Context) AgentID() entity.ID

AgentID provides a non empty agent ID, blocking until it's available

func (*Context) AgentIdentity

func (i *Context) AgentIdentity() entity.Identity

AgentIdentity provides agent identity, blocking until connect succeeded (GUID might still be empty).

func (*Context) AgentIdnOrEmpty

func (i *Context) AgentIdnOrEmpty() entity.Identity

AgentIDOrEmpty provides agent Identity when available, empty otherwise

func (*Context) Notify

func (i *Context) Notify(c chan<- struct{}, notifyMode AgentIDNotifyMode)

Notify will register a channel for receiving notifications based on the level of interest.

func (*Context) SetAgentIdentity

func (i *Context) SetAgentIdentity(id entity.Identity)

SetAgentID sets agent id

type Provide

type Provide func() entity.Identity

Provide identity provider function.

type UpdateNotifyFn

type UpdateNotifyFn func(chan<- struct{}, AgentIDNotifyMode)

UpdateNotifyFn allows to register to listen for ID update events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL