Documentation ¶
Overview ¶
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
const ( EmptyKey = Key("") EmptyID = ID(0) EmptyGUID = GUID("") )
Variables ¶
Functions ¶
Types ¶
type Entity ¶
Entity information.
func NewFromNameWithoutID ¶
NewFromNameWithoutID will create a new Entity object without entityID from a string entityName.
func NewWithoutID ¶
NewWithoutID will create a new Entity object without entityID.
type Fields ¶
type Fields struct { Name string `json:"name"` Type Type `json:"type"` IDAttributes IDAttributes `json:"id_attributes"` DisplayName string `json:"displayName"` Metadata map[string]interface{} `json:"metadata"` }
Fields store the identifying fields of an entity, which can be used to compose the entity Key
type IDAttribute ¶
IDAttribute is an attribute which defines uniqueness in the entity key.
type IDAttributes ¶
type IDAttributes []IDAttribute
IDAttributes this sorted list ensures uniqueness for the entity key.
func (IDAttributes) Less ¶
func (a IDAttributes) Less(i, j int) bool
Less is part of sort.Interface.
type KnownIDs ¶
type KnownIDs struct {
// contains filtered or unexported fields
}
KnownIDs maps the entity IDs given their respective entity Keys.
It associates a TTL to each entry, which expires after a given time without being accesses (both for setting and for reading values).
The default TTL is 24h, but it is possible to register custom TTLs per entity type.
func NewKnownIDs ¶
func NewKnownIDs() KnownIDs
NewKnownIDs creates and returns an empty KnownIDs map
func (*KnownIDs) CleanOld ¶
func (k *KnownIDs) CleanOld()
Clean removes the expired Key <-> ID entries
func (*KnownIDs) Get ¶
Get returns the entity ID for the given entity Key, if exists. If the entry is found, its expiration time is updated to the current time + TTL.
func (*KnownIDs) Put ¶
Put registers an entity ID for a given entity Key. The entry has a default TTL of 24 hours.