metadata

package
v3.19.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterPeerAccess

type ClusterPeerAccess interface {
	GetPeerConn(ctx context.Context, role ttnpb.ClusterRole, ids cluster.EntityIdentifiers) (*grpc.ClientConn, error)
	WithClusterAuth() grpc.CallOption
}

ClusterPeerAccess provides access to cluster peers.

type EndDeviceLocationCache

type EndDeviceLocationCache interface {
	// Get retrieves the end device locations and the remaining TTL for the entry.
	Get(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) (map[string]*ttnpb.Location, *time.Time, error)
	// Set sets the end device locations.
	Set(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, update map[string]*ttnpb.Location, ttl time.Duration) error
	// Delete removes the locations from the cache.
	Delete(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) error
}

EndDeviceLocationCache is a cache for end device locations.

func NewMetricsEndDeviceLocationCache

func NewMetricsEndDeviceLocationCache(inner EndDeviceLocationCache) EndDeviceLocationCache

NewMetricsEndDeviceLocationCache constructs an EndDeviceLocationCache that collects metrics.

type EndDeviceLocationRegistry

type EndDeviceLocationRegistry interface {
	// Get retrieves the end device locations.
	Get(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers) (map[string]*ttnpb.Location, error)
	// Merge merges the end device locations.
	Merge(ctx context.Context, ids *ttnpb.EndDeviceIdentifiers, update map[string]*ttnpb.Location) (map[string]*ttnpb.Location, error)
}

EndDeviceLocationRegistry is a registry for end device locations.

func NewCachedEndDeviceLocationRegistry

func NewCachedEndDeviceLocationRegistry(ctx context.Context, c workerpool.Component, registry EndDeviceLocationRegistry, cache EndDeviceLocationCache, minRefreshInterval, maxRefreshInterval, ttl time.Duration) EndDeviceLocationRegistry

NewCachedEndDeviceLocationRegistry returns an EndDeviceLocationRegistry that caches the responses of the provided EndDeviceLocationRegistry in the provided EndDeviceLocationCache. On cache miss, the registry will retrieve and cache the locations asynchronously. Items whose TTL is within the soft TTL window have a chance to trigger an asynchronous cache synchronization event on location retrieval. The probability of a synchronization event increases linearly between the soft TTL (0%) and the hard TTL (100%).

func NewClusterEndDeviceLocationRegistry

func NewClusterEndDeviceLocationRegistry(cluster ClusterPeerAccess, timeout time.Duration) EndDeviceLocationRegistry

NewClusterEndDeviceLocationRegistry returns an EndDeviceLocationRegistry connected to the Entity Registry.

func NewMetricsEndDeviceLocationRegistry

func NewMetricsEndDeviceLocationRegistry(inner EndDeviceLocationRegistry) EndDeviceLocationRegistry

NewMetricsEndDeviceLocationRegistry returns an EndDeviceLocationRegistry that collects metrics.

func NewNoopEndDeviceLocationRegistry

func NewNoopEndDeviceLocationRegistry() EndDeviceLocationRegistry

NewNoopEndDeviceLocationRegistry returns a noop EndDeviceLocationRegistry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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