dmecommon

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestAppInstLatency = "request-appinst-latency"
)

Constants for Debug

View Source
const VeryCloseDistanceKm = 1

1 km is considered near enough to call 2 locations equivalent

Variables

View Source
var (
	LocationUnknown                uint32 = 0
	LocationVerifiedNear           uint32 = 1
	LocationVerifiedMedium         uint32 = 2
	LocationVerifiedFar            uint32 = 3
	LocationMismatchSameCountry    uint32 = 4
	LocationMismatchOtherCountry   uint32 = 5
	LocationRoamingCountryMatch    uint32 = 6
	LocationRoamingCountryMismatch uint32 = 7
)

These are the possible values returned by GDDT in the non-error case. Based on business logic (currently just defaults), we map these to a location range in KM

View Source
var AppInstClientKeyCache edgeproto.AppInstClientKeyCache

it has been agreed that mappings between location result integer and distances in kilometers should be flexible. These are the default mappings

View Source
var InfiniteDistance float64 = 100000

InfiniteDistance is a value higher than the circumference of the globe, any cloudlet found would have to be closer than this.

View Source
var MyCloudletKey edgeproto.CloudletKey

MyCloudlet is the information for the cloudlet in which the DME is instantiated. The key for MyCloudlet is provided as a configuration - either command line or from a file.

View Source
var OptionFindCloudletRandomizeVeryClose bool = true
View Source
var PlatformClientsCache edgeproto.DeviceCache

RateLimitManager

View Source
var ScaleID = flag.String("scaleID", "", "ID to distinguish multiple DMEs in the same cloudlet. Defaults to hostname if unspecified.")
View Source
var StatKeyContextKey = StatKeyContextType("statKey")

Functions

func AddApp

func AddApp(ctx context.Context, in *edgeproto.App)

func AddAppInst

func AddAppInst(ctx context.Context, appInst *edgeproto.AppInst)

func ApiStatToMetric

func ApiStatToMetric(ts *types.Timestamp, key *StatKey, stat *ApiStat) *edgeproto.Metric

func AppExists

func AppExists(orgname string, appname string, appvers string) bool

func AreStatesUsable

func AreStatesUsable(maintenanceState dme.MaintenanceState, cloudletState dme.CloudletState, appInstHealth dme.HealthCheck) bool

Checks dme proto states for an appinst or cloudlet (Maintenance, Cloudlet, and AppInstHealth states)

func ConstructFindCloudletReplyFromDmeAppInst

func ConstructFindCloudletReplyFromDmeAppInst(ctx context.Context, appinst *DmeAppInst, clientloc *dme.Loc, mreply *dme.FindCloudletReply, edgeEventsCookieExpiration time.Duration)

Helper function that creates a FindCloudletReply from a DmeAppInst struct

func CustomStatToMetric

func CustomStatToMetric(ts *types.Timestamp, key CustomStatKey, stat *CustomStat) *edgeproto.Metric

func DeleteCloudletInfo

func DeleteCloudletInfo(ctx context.Context, cloudletKey *edgeproto.CloudletKey)

func DeviceStatToMetric

func DeviceStatToMetric(ts *types.Timestamp, key DeviceStatKey, stat *DeviceStat) *edgeproto.Metric

func DistanceBetween

func DistanceBetween(loc1, loc2 dme.Loc) float64

Use the ‘haversine’ formula to calculate the great-circle distance between two points

func GenerateAuthToken

func GenerateAuthToken(privKeyFile string, appOrg string, appname string, appvers string, expireTime int64) (string, error)

GenerateAuthToken is used only for test purposes, as the DME never generates auth tokens it only verifies them

func GenerateCookie

func GenerateCookie(key *CookieKey, ctx context.Context, cookieExpiration *time.Duration) (string, error)

func GenerateEdgeEventsCookie

func GenerateEdgeEventsCookie(key *EdgeEventsCookieKey, ctx context.Context, cookieExpiration time.Duration) (string, error)

func GetAppInstList

func GetAppInstList(ctx context.Context, ckey *CookieKey, mreq *dme.AppInstListRequest, clist *dme.AppInstListReply, edgeEventsCookieExpiration time.Duration)

func GetAppOfficialFqdn

func GetAppOfficialFqdn(ctx context.Context, ckey *CookieKey, mreq *dme.AppOfficialFqdnRequest, repl *dme.AppOfficialFqdnReply)

func GetAuthPublicKey

func GetAuthPublicKey(orgname string, appname string, appvers string) (string, error)

func GetFqdnList

func GetFqdnList(mreq *dme.FqdnListRequest, clist *dme.FqdnListReply)

func GetLocationResultForDistance

func GetLocationResultForDistance(distance float64) uint32

GetLocationResultForDistance - given a distance, converts that into a location result. This function has no knowledge of country, it is not used when we have access to the real Location Verification API Gateway.

func GetLocationTileFromGpsLocation

func GetLocationTileFromGpsLocation(loc *dme.Loc, locationTileSideLengthKm int) string

func GetStreamAuthInterceptor

func GetStreamAuthInterceptor() grpc.StreamServerInterceptor

func InitAppInstClients

func InitAppInstClients(timeout time.Duration)

func InitVault

func InitVault(addr, region string, done chan struct{}) error

func IsAppInstUsable

func IsAppInstUsable(appInst *DmeAppInst) bool

AppInst state is a superset of the cloudlet state and appInst state Returns if this AppInstance is usable or not

func IsTheSameCluster

func IsTheSameCluster(key1 *EdgeEventsCookieKey, key2 *EdgeEventsCookieKey) bool

func LatencyStatToMetric

func LatencyStatToMetric(ts *types.Timestamp, key LatencyStatKey, stat *LatencyStat) *edgeproto.Metric

func ListAppinstTbl

func ListAppinstTbl(ctx context.Context)

func MetricToStat

func MetricToStat(metric *edgeproto.Metric) (*StatKey, *ApiStat)

func NewCookieContext

func NewCookieContext(ctx context.Context, ckey *CookieKey) context.Context

func NewEdgeEventsCookieContext

func NewEdgeEventsCookieContext(ctx context.Context, eekey *EdgeEventsCookieKey) context.Context

func PeerContext

func PeerContext(ctx context.Context, ip string, port int, span opentracing.Span) context.Context

PeerContext is a helper function to a context with peer info

func PruneAppInsts

func PruneAppInsts(ctx context.Context, appInsts map[edgeproto.AppInstKey]struct{})

pruneApps removes any data that was not sent by the controller.

func PruneApps

func PruneApps(ctx context.Context, apps map[edgeproto.AppKey]struct{})

pruneApps removes any data that was not sent by the controller.

func PruneCloudlets

func PruneCloudlets(ctx context.Context, cloudlets map[edgeproto.CloudletKey]struct{})

Remove any Cloudlets we track that no longer exist and reset the state for the AppInsts

func PruneInstsCloudletState

func PruneInstsCloudletState(ctx context.Context, cloudlets map[edgeproto.CloudletKey]struct{})

Reset the cloudlet state for the AppInsts for any cloudlets that no longer exists

func PurgeAppInstClients

func PurgeAppInstClients(ctx context.Context, appInstKey *edgeproto.AppInstKey, appKey *edgeproto.AppKey)

If an AppInst is deleted, clean up all the clients from it

func RecordDevice

func RecordDevice(ctx context.Context, req *dme.RegisterClientRequest)

Helper function to keep track of the registered devices

func RemoveApp

func RemoveApp(ctx context.Context, in *edgeproto.App)

func RemoveAppInst

func RemoveAppInst(ctx context.Context, appInst *edgeproto.AppInst)

func SearchAppInsts

func SearchAppInsts(ctx context.Context, carrierName string, app *DmeApp, loc *dme.Loc, carrierData map[string]*DmeAppInsts, resultLimit int) []*foundAppInst

given the carrier, update the reply if we find a cloudlet closer than the max distance. Return the distance and whether or not response was updated

func SetInstStateFromCloudlet

func SetInstStateFromCloudlet(ctx context.Context, in *edgeproto.Cloudlet)

SetInstStateFromCloudlet - Sets the current maintenance state of the appInstances for the cloudlet

func SetInstStateFromCloudletInfo

func SetInstStateFromCloudletInfo(ctx context.Context, info *edgeproto.CloudletInfo)

SetInstStateFromCloudletInfo - Sets the current state of the appInstances for the cloudlet This gets called when a cloudlet goes offline, or comes back online

func SettingsUpdated

func SettingsUpdated(ctx context.Context, old *edgeproto.Settings, new *edgeproto.Settings)

func SetupMatchEngine

func SetupMatchEngine(eehandler EdgeEventsHandler)

func StopAppInstClients

func StopAppInstClients()

func StreamEdgeEvent

func StreamEdgeEvent(ctx context.Context, svr dme.MatchEngineApi_StreamEdgeEventServer, edgeEventsCookieExpiration time.Duration) (reterr error)

func UnaryAuthInterceptor

func UnaryAuthInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func UpdateClientsBuffer

func UpdateClientsBuffer(ctx context.Context, msg *edgeproto.AppInstClient)

Add a new client to the list of clients

func ValidateLocation

func ValidateLocation(loc *dme.Loc) error

func VerifyAuthToken

func VerifyAuthToken(ctx context.Context, token string, pubkey string, devname string, appname string, appvers string) error

VerifyAuthToken verifies the token against the provided public key. JWT contents for devname, appname and appvers must match the contents of the token

Types

type ApiStat

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

type ApiStatCall

type ApiStatCall struct {
	Key     StatKey
	Fail    bool
	Latency time.Duration
}

type AutoProvCounts

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

type AutoProvPolicy

type AutoProvPolicy struct {
	Name              string
	DeployClientCount uint32
	IntervalCount     uint32
	Cloudlets         map[string][]*edgeproto.AutoProvCloudlet // index is carrier
}

type AutoProvPolicyHandler

type AutoProvPolicyHandler struct{}

func (*AutoProvPolicyHandler) Delete

func (*AutoProvPolicyHandler) Flush

func (s *AutoProvPolicyHandler) Flush(ctx context.Context, notifyId int64)

func (*AutoProvPolicyHandler) Prune

func (s *AutoProvPolicyHandler) Prune(ctx context.Context, keys map[edgeproto.PolicyKey]struct{})

func (*AutoProvPolicyHandler) Update

type AutoProvStats

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

func InitAutoProvStats

func InitAutoProvStats(intervalSec, offsetSec float64, numShards uint, nodeKey *edgeproto.NodeKey, send func(ctx context.Context, counts *edgeproto.AutoProvCounts) bool) *AutoProvStats

func (*AutoProvStats) Clear

func (s *AutoProvStats) Clear(appKey *edgeproto.AppKey, policy string)

func (*AutoProvStats) Increment

func (s *AutoProvStats) Increment(ctx context.Context, appKey *edgeproto.AppKey, cloudletKey *edgeproto.CloudletKey, policy *AutoProvPolicy)

func (*AutoProvStats) Prune

func (s *AutoProvStats) Prune(apps map[edgeproto.AppKey]struct{})

func (*AutoProvStats) RunNotify

func (s *AutoProvStats) RunNotify()

func (*AutoProvStats) Start

func (s *AutoProvStats) Start()

func (*AutoProvStats) Stop

func (s *AutoProvStats) Stop()

func (*AutoProvStats) UpdateSettings

func (s *AutoProvStats) UpdateSettings(intervalSec float64)

type AutoProvStatsShard

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

type ClientToken

type ClientToken struct {
	Location dme.Loc
	AppKey   edgeproto.AppKey
}

func GetClientDataFromToken

func GetClientDataFromToken(token string) (*ClientToken, error)

type ClientsMap

type ClientsMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ClientsMap) UpdateClientTimeout

func (m *ClientsMap) UpdateClientTimeout(new edgeproto.Duration)

type CookieKey

type CookieKey struct {
	PeerIP       string `json:"peerip,omitempty"`
	OrgName      string `json:"orgname,omitempty"`
	AppName      string `json:"appname,omitempty"`
	AppVers      string `json:"appvers,omitempty"`
	UniqueIdType string `json:"uniqueidtype,omitempty"`
	UniqueId     string `json:"uniqueid,omitempty"`
	Kid          int    `json:"kid,omitempty"`
}

func CookieFromContext

func CookieFromContext(ctx context.Context) (ckey *CookieKey, ok bool)

func VerifyCookie

func VerifyCookie(ctx context.Context, cookie string) (*CookieKey, error)

returns Peer IP or Error

type CustomStat

type CustomStat struct {
	Count             uint64 // number of times this custom stat has been updated
	RollingStatistics *grpcstats.RollingStatistics
	Mux               sync.Mutex
	Changed           bool
}

func NewCustomStat

func NewCustomStat() *CustomStat

func (*CustomStat) Update

func (c *CustomStat) Update(info *CustomStatInfo)

type CustomStatInfo

type CustomStatInfo struct {
	Samples []*dme.Sample
}

Filled in by DME. Added to EdgeEventStatCall to update stats

type CustomStatKey

type CustomStatKey struct {
	AppInstKey  edgeproto.AppInstKey
	AppKey      edgeproto.AppKey
	CloudletKey edgeproto.CloudletKey
	Name        string
}

Used to find corresponding CustomStat Created using CustomStatInfo

func GetCustomStatKey

func GetCustomStatKey(appInst *edgeproto.AppInst, statName string) CustomStatKey

type DeviceInfo

type DeviceInfo struct {
	DeviceInfoStatic  *dme.DeviceInfoStatic
	DeviceInfoDynamic *dme.DeviceInfoDynamic
}

type DeviceStat

type DeviceStat struct {
	NumSessions uint64 // number of sessions that send stats
	Mux         sync.Mutex
	Changed     bool
}

func NewDeviceStat

func NewDeviceStat() *DeviceStat

func (*DeviceStat) Update

func (d *DeviceStat) Update()

type DeviceStatKey

type DeviceStatKey struct {
	AppInstKey      edgeproto.AppInstKey
	AppKey          edgeproto.AppKey
	CloudletKey     edgeproto.CloudletKey
	DeviceCarrier   string
	LocationTile    string
	DataNetworkType string
	DeviceOs        string
	DeviceModel     string
	SignalStrength  uint64
}

Used to find corresponding CustomStat Created using CustomStatInfo

func GetDeviceStatKey

func GetDeviceStatKey(appInst *edgeproto.AppInst, deviceInfo *DeviceInfo, loc *dme.Loc, tileLength int) DeviceStatKey

type DmeApp

type DmeApp struct {
	sync.RWMutex
	AppKey             edgeproto.AppKey
	Carriers           map[string]*DmeAppInsts
	AuthPublicKey      string
	AndroidPackageName string
	OfficialFqdn       string
	AutoProvPolicies   map[string]*AutoProvPolicy
	Deployment         string
	DefaultFlavor      string
	QosSessionProfile  string
	QosSessionDuration time.Duration
	// Non mapped AppPorts from App definition (used for AppOfficialFqdnReply)
	Ports []dme.AppPort
}

func FindCloudlet

func FindCloudlet(ctx context.Context, appkey *edgeproto.AppKey, carrier string, loc *dme.Loc, mreply *dme.FindCloudletReply, edgeEventsCookieExpiration time.Duration) (error, *DmeApp)

type DmeAppInst

type DmeAppInst struct {

	// URI to connect to app inst in this cloudlet
	Uri string

	// Location of the cloudlet site (lat, long?)
	Location dme.Loc

	// State of the cloudlet - copy of the DmeCloudlet
	CloudletState    dme.CloudletState
	MaintenanceState dme.MaintenanceState
	// Health state of the appInst
	AppInstHealth dme.HealthCheck
	TrackedState  edgeproto.TrackedState
	// contains filtered or unexported fields
}

AppInst within a cloudlet

func (*DmeAppInst) GetCloudletKey

func (s *DmeAppInst) GetCloudletKey() *edgeproto.CloudletKey

type DmeAppInstState

type DmeAppInstState struct {
	CloudletState    dme.CloudletState
	MaintenanceState dme.MaintenanceState
	AppInstHealth    dme.HealthCheck
}

type DmeAppInsts

type DmeAppInsts struct {
	Insts         map[edgeproto.AppInstKey]*DmeAppInst
	AllianceInsts map[edgeproto.AppInstKey]*DmeAppInst
}

type DmeApps

type DmeApps struct {
	sync.RWMutex
	Apps                       map[edgeproto.AppKey]*DmeApp
	AppInstApps                map[edgeproto.AppInstKey]edgeproto.AppKey // for delete
	Cloudlets                  map[edgeproto.CloudletKey]*DmeCloudlet
	CarriersByAppInst          map[edgeproto.AppInstKey]edgeproto.CloudletKey // for delete
	AutoProvPolicies           map[edgeproto.PolicyKey]*AutoProvPolicy
	FreeReservableClusterInsts edgeproto.FreeReservableClusterInstCache
	OperatorCodes              edgeproto.OperatorCodeCache
}
var DmeAppTbl *DmeApps

type DmeCloudlet

type DmeCloudlet struct {
	// No need for a mutex - protected under DmeApps mutex
	CloudletKey      edgeproto.CloudletKey
	State            dme.CloudletState
	MaintenanceState dme.MaintenanceState
	GpsLocation      dme.Loc
	AllianceCarriers map[string]struct{}
	AppInstKeys      map[edgeproto.AppInstKey]*edgeproto.AppKey
}

type DmeStats

type DmeStats struct {
	// contains filtered or unexported fields
}
var Stats *DmeStats

func NewDmeStats

func NewDmeStats(interval time.Duration, numShards uint, send func(ctx context.Context, metric *edgeproto.Metric) bool) *DmeStats

func (*DmeStats) GetStreamStatsInterceptor

func (s *DmeStats) GetStreamStatsInterceptor() grpc.StreamServerInterceptor

func (*DmeStats) RecordApiStatCall

func (s *DmeStats) RecordApiStatCall(call *ApiStatCall)

func (*DmeStats) RunNotify

func (s *DmeStats) RunNotify()

RunNotify walks the stats periodically, and uploads the current stats to the controller.

func (*DmeStats) Start

func (s *DmeStats) Start()

func (*DmeStats) Stop

func (s *DmeStats) Stop()

func (*DmeStats) UnaryStatsInterceptor

func (s *DmeStats) UnaryStatsInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func (*DmeStats) UpdateSettings

func (s *DmeStats) UpdateSettings(interval time.Duration)

type EdgeEventMapShard

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

type EdgeEventStatCall

type EdgeEventStatCall struct {
	Metric          string           // Either cloudcommon.LatencyMetric, cloudcommon.DeviceMetric, cloudcommon.CustomMetric
	LatencyStatKey  LatencyStatKey   // Key needed if metric is cloudcommon.LatencyMetric
	LatencyStatInfo *LatencyStatInfo // Latency stat info if metric is cloudcommon.LatencyMetric
	DeviceStatKey   DeviceStatKey    // Key needed if metric is cloudcommon.DeviceStatKey
	CustomStatKey   CustomStatKey    // Key needed if metric is cloudcommon.CustomMetric
	CustomStatInfo  *CustomStatInfo  // Custom stat info if metric is cloudcommon.CustomMetric
}

type EdgeEventStats

type EdgeEventStats struct {
	// contains filtered or unexported fields
}
var EEStats *EdgeEventStats

func NewEdgeEventStats

func NewEdgeEventStats(interval time.Duration, numShards uint, send func(ctx context.Context, metric *edgeproto.Metric) bool) *EdgeEventStats

func (*EdgeEventStats) RecordEdgeEventStatCall

func (e *EdgeEventStats) RecordEdgeEventStatCall(call *EdgeEventStatCall)

func (*EdgeEventStats) RunNotify

func (e *EdgeEventStats) RunNotify()

func (*EdgeEventStats) Start

func (e *EdgeEventStats) Start()

func (*EdgeEventStats) Stop

func (e *EdgeEventStats) Stop()

func (*EdgeEventStats) UpdateSettings

func (e *EdgeEventStats) UpdateSettings(newinterval time.Duration)

type EdgeEventsCookieKey

type EdgeEventsCookieKey struct {
	AppInstName  string  `json:"appinstname,omitempty"`
	ClusterOrg   string  `json:"clusterorg,omitempty"`
	ClusterName  string  `json:"clustername,omitempty"`
	CloudletOrg  string  `json:"cloudletorg,omitempty"`
	CloudletName string  `json:"cloudletname,omitempty"`
	Location     dme.Loc `json:"location,omitempty"`
	Kid          int     `json:"kid,omitempty"`
}

func CreateEdgeEventsCookieKey

func CreateEdgeEventsCookieKey(appInst *DmeAppInst, loc dme.Loc) *EdgeEventsCookieKey

func EdgeEventsCookieFromContext

func EdgeEventsCookieFromContext(ctx context.Context) (eekey *EdgeEventsCookieKey, ok bool)

func VerifyEdgeEventsCookie

func VerifyEdgeEventsCookie(ctx context.Context, cookie string) (*EdgeEventsCookieKey, error)

type EdgeEventsHandler

type EdgeEventsHandler interface {
	GetVersionProperties(ctx context.Context) map[string]string
	AddClient(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, lastLoc dme.Loc, carrier string, sendFunc func(event *dme.ServerEdgeEvent))
	RemoveClient(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey)
	UpdateClientLastLocation(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, lastLoc dme.Loc)
	UpdateClientCarrier(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, carrier string)
	SendAvailableAppInst(ctx context.Context, app *DmeApp, newAppInstKey edgeproto.AppInstKey, newAppInst *DmeAppInst, newAppInstCarrier string)
	RemoveAppInst(ctx context.Context, appInstKey edgeproto.AppInstKey)
	SendLatencyRequestEdgeEvent(ctx context.Context, appInstKey edgeproto.AppInstKey)
	ProcessLatencySamples(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, samples []*dme.Sample) (*dme.Statistics, error)
	SendAppInstStateEdgeEvent(ctx context.Context, appinstState *DmeAppInstState, appInstKey edgeproto.AppInstKey, appKey *edgeproto.AppKey, eventType dme.ServerEdgeEvent_ServerEventType)
	SendCloudletStateEdgeEvent(ctx context.Context, appinstState *DmeAppInstState, cloudletKey edgeproto.CloudletKey)
	SendCloudletMaintenanceStateEdgeEvent(ctx context.Context, appinstState *DmeAppInstState, cloudletKey edgeproto.CloudletKey)
	SendEdgeEventToClient(ctx context.Context, serverEdgeEvent *dme.ServerEdgeEvent, appInstKey edgeproto.AppInstKey, cookieKey CookieKey)
}
var EEHandler EdgeEventsHandler

EdgeEventsHandler implementation (loaded from Plugin)

type EmptyEdgeEventsHandler

type EmptyEdgeEventsHandler struct{}

func (*EmptyEdgeEventsHandler) AddClient

func (e *EmptyEdgeEventsHandler) AddClient(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, lastLoc dme.Loc, carrier string, sendFunc func(event *dme.ServerEdgeEvent))

func (*EmptyEdgeEventsHandler) GetVersionProperties

func (e *EmptyEdgeEventsHandler) GetVersionProperties(ctx context.Context) map[string]string

func (*EmptyEdgeEventsHandler) ProcessLatencySamples

func (e *EmptyEdgeEventsHandler) ProcessLatencySamples(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, samples []*dme.Sample) (*dme.Statistics, error)

func (*EmptyEdgeEventsHandler) RemoveAppInst

func (e *EmptyEdgeEventsHandler) RemoveAppInst(ctx context.Context, appInstKey edgeproto.AppInstKey)

func (*EmptyEdgeEventsHandler) RemoveClient

func (e *EmptyEdgeEventsHandler) RemoveClient(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey)

func (*EmptyEdgeEventsHandler) RemoveCloudlet

func (e *EmptyEdgeEventsHandler) RemoveCloudlet(ctx context.Context, cloudletKey edgeproto.CloudletKey)

func (*EmptyEdgeEventsHandler) SendAppInstStateEdgeEvent

func (e *EmptyEdgeEventsHandler) SendAppInstStateEdgeEvent(ctx context.Context, appinstState *DmeAppInstState, appInstKey edgeproto.AppInstKey, appKey *edgeproto.AppKey, eventType dme.ServerEdgeEvent_ServerEventType)

func (*EmptyEdgeEventsHandler) SendAvailableAppInst

func (e *EmptyEdgeEventsHandler) SendAvailableAppInst(ctx context.Context, app *DmeApp, newAppInstKey edgeproto.AppInstKey, newAppInst *DmeAppInst, newAppInstCarrier string)

func (*EmptyEdgeEventsHandler) SendCloudletMaintenanceStateEdgeEvent

func (e *EmptyEdgeEventsHandler) SendCloudletMaintenanceStateEdgeEvent(ctx context.Context, appinstState *DmeAppInstState, cloudletKey edgeproto.CloudletKey)

func (*EmptyEdgeEventsHandler) SendCloudletStateEdgeEvent

func (e *EmptyEdgeEventsHandler) SendCloudletStateEdgeEvent(ctx context.Context, appinstState *DmeAppInstState, cloudletKey edgeproto.CloudletKey)

func (*EmptyEdgeEventsHandler) SendEdgeEventToClient

func (e *EmptyEdgeEventsHandler) SendEdgeEventToClient(ctx context.Context, serverEdgeEvent *dme.ServerEdgeEvent, appInstKey edgeproto.AppInstKey, cookieKey CookieKey)

func (*EmptyEdgeEventsHandler) SendLatencyRequestEdgeEvent

func (e *EmptyEdgeEventsHandler) SendLatencyRequestEdgeEvent(ctx context.Context, appInstKey edgeproto.AppInstKey)

func (*EmptyEdgeEventsHandler) UpdateClientCarrier

func (e *EmptyEdgeEventsHandler) UpdateClientCarrier(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, carrier string)

func (*EmptyEdgeEventsHandler) UpdateClientLastLocation

func (e *EmptyEdgeEventsHandler) UpdateClientLastLocation(ctx context.Context, appInstKey edgeproto.AppInstKey, cookieKey CookieKey, lastLoc dme.Loc)

type LatencyStat

type LatencyStat struct {
	LatencyCounts     grpcstats.LatencyMetric // buckets for counts
	LatencyBuckets    []time.Duration
	RollingStatistics *grpcstats.RollingStatistics // General stats: Avg, StdDev, Min, Max
	Mux               sync.Mutex
	Changed           bool
}

Wrapper struct that holds values for latency stats

func NewLatencyStat

func NewLatencyStat(latencyBuckets []time.Duration) *LatencyStat

func (*LatencyStat) ResetLatencyStat

func (l *LatencyStat) ResetLatencyStat()

func (*LatencyStat) Update

func (l *LatencyStat) Update(info *LatencyStatInfo)

type LatencyStatInfo

type LatencyStatInfo struct {
	Samples []*dme.Sample
}

Filled in by DME. Added to EdgeEventStatCall to update stats

type LatencyStatKey

type LatencyStatKey struct {
	AppInstKey      edgeproto.AppInstKey
	AppKey          edgeproto.AppKey
	CloudletKey     edgeproto.CloudletKey
	DeviceCarrier   string
	LocationTile    string
	DataNetworkType string
	DeviceOs        string
	DeviceModel     string
	SignalStrength  uint64
}

Used to find corresponding LatencyStat Created from LatencyInfo fields

func GetLatencyStatKey

func GetLatencyStatKey(appInst *edgeproto.AppInst, deviceInfo *DeviceInfo, loc *dme.Loc, tileLength int) LatencyStatKey

type LocationResult

type LocationResult struct {
	DistanceRange        float64
	MatchEngineLocStatus dme.VerifyLocationReply_GPSLocationStatus
}

func GetDistanceAndStatusForLocationResult

func GetDistanceAndStatusForLocationResult(locationResult uint32) LocationResult

GetDistanceAndStatusForLocationResult - Given a value returned by GDDT API GW, map that into a distance and DME return status.

type LocationTileInfo

type LocationTileInfo struct {
	Quadrant   int
	LongIndex  int
	LatIndex   int
	TileLength int
}

type MapShard

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

type ServerStreamWrapper

type ServerStreamWrapper struct {
	grpc.ServerStream
	// contains filtered or unexported fields
}

A wrapper for the real grpc.ServerStream

func (*ServerStreamWrapper) Context

func (s *ServerStreamWrapper) Context() context.Context

func (*ServerStreamWrapper) RecvMsg

func (s *ServerStreamWrapper) RecvMsg(m interface{}) error

func (*ServerStreamWrapper) SendMsg

func (s *ServerStreamWrapper) SendMsg(m interface{}) error

type StatKey

type StatKey struct {
	AppKey        edgeproto.AppKey
	CloudletFound edgeproto.CloudletKey
	Method        string
}

Stats are collected per App per Cloudlet and per method name (verifylocation, etc).

type StatKeyContextType

type StatKeyContextType string

This is for passing the carrier/cloudlet in the context

type StatsStreamWrapper

type StatsStreamWrapper struct {
	grpc.ServerStream
	// contains filtered or unexported fields
}

A wrapper for grpc.ServerStream to handle stats

func (*StatsStreamWrapper) Context

func (w *StatsStreamWrapper) Context() context.Context

func (*StatsStreamWrapper) RecvMsg

func (w *StatsStreamWrapper) RecvMsg(m interface{}) error

func (*StatsStreamWrapper) SendMsg

func (w *StatsStreamWrapper) SendMsg(m interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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