enigmahandlers

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//MaxRetries when engine aborts request
	MaxRetries = 3
)
View Source
const (
	// SenseWsType defines websocket type, used for logging purposes
	SenseWsType = "SenseWebsocket"
)

Variables

This section is empty.

Functions

func ContextWithoutRetries added in v0.14.12

func ContextWithoutRetries(ctx context.Context) context.Context

ContextWithoutRetries creates a new context which disables retires for aborted ws requests.

func NewTopicsHandler added in v0.16.5

func NewTopicsHandler(channel chan enigma.SessionMessage) *topicsHandler

NewTopicsHandler handles pusched topics on message channel

Types

type Cache added in v0.5.8

type Cache struct {
	Field FieldCache
	Var   VarCache
}

type ErrWarn

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

ErrWarn keeps track of errors and warnings within action + total

func (*ErrWarn) Errors

func (ew *ErrWarn) Errors() uint64

Errors report error count

func (*ErrWarn) IncErr

func (ew *ErrWarn) IncErr()

IncErr Add 1 to errors counter

func (*ErrWarn) IncWarn

func (ew *ErrWarn) IncWarn()

IncWarn Add 1 to warnings counter

func (*ErrWarn) Reset

func (ew *ErrWarn) Reset()

Reset reset error and warnings counters

func (*ErrWarn) TotErrors

func (ew *ErrWarn) TotErrors() uint64

TotErrors report total error count

func (*ErrWarn) TotWarnings

func (ew *ErrWarn) TotWarnings() uint64

TotWarnings report total warnings count

func (*ErrWarn) Warnings

func (ew *ErrWarn) Warnings() uint64

Warnings report warning count

type FieldCache added in v0.5.8

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

FieldCache

func NewFieldCache added in v0.5.8

func NewFieldCache() FieldCache

func (*FieldCache) Lookup added in v0.5.8

func (fc *FieldCache) Lookup(name string) (field *enigma.Field, hit bool)

func (*FieldCache) Store added in v0.5.8

func (fc *FieldCache) Store(name string, field *enigma.Field)

type HyperCube

type HyperCube struct {
	*enigma.HyperCube
	Binned bool
}

HyperCube wrapping enigma hypercube with additional if binned or not

type ITrafficLogger

type ITrafficLogger interface {
	enigma.TrafficLogger
	RequestCount() uint64
	ResetRequestCount()
}

ITrafficLogger interface for traffic logger

type NoSessionOnConnectError added in v0.17.0

type NoSessionOnConnectError struct{}

func (NoSessionOnConnectError) Error added in v0.17.0

func (err NoSessionOnConnectError) Error() string

Error to be returned on reconnect without session attached

type ObjChild

type ObjChild struct {
	ExternalReference struct {
		MasterID string `json:"masterId"`
		App      string `json:"app"`
		ViewID   string `json:"viewId"`
	} `json:"externalReference"`
	Label string `json:"label"`
	RefID string `json:"refId"`
	Type  string `json:"type"`
}

type Object

type Object struct {
	// Handle of sense object
	Handle int
	// ID of object
	ID string
	// Type of object
	Type ObjectType
	// EnigmaObject enigma object instance
	EnigmaObject interface{}
	// contains filtered or unexported fields
}

Object sense object handler

func NewObject

func NewObject(handle int, t ObjectType, id string, enigmaobject interface{}) *Object

NewObject container for enigma object

func (*Object) ChildList

func (obj *Object) ChildList() *enigma.ChildList

ChildList child objects of object

func (*Object) Close

func (obj *Object) Close() error

Close execute registered close functions

func (*Object) ExternalReferenceApps

func (obj *Object) ExternalReferenceApps() []string

Get all apps from ExternalReference

func (*Object) HasDims added in v0.11.1

func (obj *Object) HasDims() bool

HasDims returns true if object has at least one dimension

func (*Object) HyperCube

func (obj *Object) HyperCube() *HyperCube

HyperCube of object

func (*Object) HyperCubeDataPages

func (obj *Object) HyperCubeDataPages() []*enigma.NxDataPage

HyperCubeDataPages from object hypercube

func (*Object) HyperCubeStackPages

func (obj *Object) HyperCubeStackPages() []*enigma.NxStackPage

HyperCubeStackPages from object hypercube

func (*Object) HyperPivotPages

func (obj *Object) HyperPivotPages() []*enigma.NxPivotPage

HyperPivotPages from object hypercube

func (*Object) ListObject

func (obj *Object) ListObject() *enigma.ListObject

ListObject of object

func (*Object) ListObjectDataPages

func (obj *Object) ListObjectDataPages() []*enigma.NxDataPage

ListObjectDataPages from object listobject

func (*Object) Properties

func (obj *Object) Properties() *enigma.GenericObjectProperties

Properties get object properties

func (*Object) RegisterCloseFunc

func (obj *Object) RegisterCloseFunc(f func() error)

RegisterCloseFunc register function to be executed on object close

func (*Object) SetChildList

func (obj *Object) SetChildList(children *enigma.ChildList)

SetChildList set object childlist

func (*Object) SetChildren

func (obj *Object) SetChildren(children *[]ObjChild)

SetChildren set object children

func (*Object) SetHyperCube

func (obj *Object) SetHyperCube(hypercube *enigma.HyperCube)

SetHyperCube of object

func (*Object) SetHyperCubeDataPages

func (obj *Object) SetHyperCubeDataPages(datapages []*enigma.NxDataPage, binned bool) error

SetHyperCubeDataPages on object hypercube

func (*Object) SetListObject

func (obj *Object) SetListObject(listobject *enigma.ListObject)

SetListObject of object

func (*Object) SetListObjectDataPages

func (obj *Object) SetListObjectDataPages(datapages []*enigma.NxDataPage) error

SetListObjectDataPages on object listobject

func (*Object) SetPivotHyperCubePages

func (obj *Object) SetPivotHyperCubePages(datapages []*enigma.NxPivotPage) error

SetPivotHyperCubePages on object hypercube

func (*Object) SetProperties

func (obj *Object) SetProperties(properties *enigma.GenericObjectProperties)

SetProperties set/update properties of object

func (*Object) SetStackHyperCubePages

func (obj *Object) SetStackHyperCubePages(datapages []*enigma.NxStackPage) error

SetStackHyperCubePages on object hypercube

func (*Object) SetTreeDataPages added in v0.6.26

func (obj *Object) SetTreeDataPages(treeDataPages []*enigma.NxTreeNode) error

SetTreeDataPages on object

type ObjectIDNotFound

type ObjectIDNotFound string

ObjectIDNotFound error

func (ObjectIDNotFound) Error

func (onf ObjectIDNotFound) Error() string

type ObjectNotFound

type ObjectNotFound int

ObjectNotFound error

func (ObjectNotFound) Error

func (onf ObjectNotFound) Error() string

type ObjectType

type ObjectType int

ObjectType type of enigma object

const (
	// ObjTypeApp object is an app
	ObjTypeApp ObjectType = iota
	// ObjTypeSheet object is a sheet
	ObjTypeSheet
	// ObjTypeGenericObject object is sheet object
	ObjTypeGenericObject
)

type ObjectsMap

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

ObjectsMap currently subscribed objects

func (*ObjectsMap) AddObject

func (o *ObjectsMap) AddObject(obj *Object) error

AddObject to object list

func (o *ObjectsMap) AddObjectLink(baseHandle, linkedHandle int)

AddObjectLink link object and sessionobject, to be used for e.g. auto-charts

func (*ObjectsMap) ClearObject

func (o *ObjectsMap) ClearObject(handle int) error

ClearObject remove object from list

func (*ObjectsMap) ClearObjects

func (o *ObjectsMap) ClearObjects(handles []int) error

ClearObjects remove all objects in list

func (*ObjectsMap) ClearObjectsOfType

func (o *ObjectsMap) ClearObjectsOfType(t ObjectType) ([]int, error)

ClearObjectsOfType remove all objects of type from list

func (*ObjectsMap) ForEach

func (o *ObjectsMap) ForEach(fe func(obj *Object) error) error

ForEach Perform function on each object

func (*ObjectsMap) ForEachWithLock

func (o *ObjectsMap) ForEachWithLock(fe func(obj *Object) error) error

ForEachWithLock Perform function on each object and lock map during loop, don't combine lock with any other locking function

func (*ObjectsMap) GetAllObjectHandles

func (o *ObjectsMap) GetAllObjectHandles(lock bool, t ObjectType) []int

GetAllObjectHandles returns a slice of the handles present in the ObjectsMap

func (*ObjectsMap) GetObject

func (o *ObjectsMap) GetObject(handle int) (*Object, error)

GetObject get object from object list

func (*ObjectsMap) GetObjectByID

func (o *ObjectsMap) GetObjectByID(id string) (*Object, error)

GetObjectByID get object by id or ObjectIDNotFound error

func (o *ObjectsMap) GetObjectLink(baseHandle int) int

GetObjectLink get linked object handle, defaults to 0 if not found

func (*ObjectsMap) GetObjectsOfType

func (o *ObjectsMap) GetObjectsOfType(typ ObjectType) []*Object

GetObjectsOfType get all objects of type

func (*ObjectsMap) Len added in v0.5.7

func (o *ObjectsMap) Len() int

Len locks objects map and gets current length

func (*ObjectsMap) Load

func (o *ObjectsMap) Load(handle int) *Object

Load object with handle

func (*ObjectsMap) RemoveObject

func (o *ObjectsMap) RemoveObject(handle int) error

RemoveObject from object list

func (o *ObjectsMap) RemoveObjectLink(baseHandle int)

RemoveObjectLink for handle

func (*ObjectsMap) Store

func (o *ObjectsMap) Store(handle int, object *Object)

Store object with handle

type OnAuthenticationInformation

type OnAuthenticationInformation struct {
	// MustAuthenticate tells us if we are authenticated
	MustAuthenticate bool `json:"mustAuthenticate"`
}

OnAuthenticationInformation content structure of OnAuthenticationInformation event

type OnConnected

type OnConnected struct {
	// SessionState received session state, possible states listed as constants in constant.EventTopicOnConnected*
	SessionState string `json:"qSessionState"`
}

OnConnected content structure of EventTopicOnConnected event

type SenseConnection

type SenseConnection struct {
	*SenseUplink
}

SenseConnection direct sense connection implementing IConnection interface

func (*SenseConnection) Disconnect

func (connection *SenseConnection) Disconnect() error

Disconnect uplink

func (*SenseConnection) Sense

func (connection *SenseConnection) Sense() *SenseUplink

Sense implements IConnection interface

func (*SenseConnection) SetSense

func (connection *SenseConnection) SetSense(uplink *SenseUplink)

SetSense implements IConnection interface

type SenseDialer

type SenseDialer struct {
	*wsdialer.WsDialer
}

SenseDialer glue between net.Conn and enigma.Socket implementing required methods

type SenseUplink struct {
	Global       *enigma.Global
	CurrentApp   *senseobjects.App
	Objects      ObjectsMap
	FieldCache   FieldCache
	VarCache     VarCache
	Traffic      ITrafficLogger
	MaxFrameSize int64

	MockMode bool
	// contains filtered or unexported fields
}

SenseUplink handle sense connection for a user

func NewSenseUplink(ctx context.Context, logentry *logger.LogEntry, metrics *requestmetrics.RequestMetrics, trafficLogger ITrafficLogger, maxFrameSize int64) *SenseUplink

NewSenseUplink SenseUplink constructor

func (*SenseUplink) AddNewObject

func (uplink *SenseUplink) AddNewObject(handle int, t ObjectType, id string, enigmaobject interface{}) (*Object, error)

AddNewObject to object list

func (*SenseUplink) Connect

func (uplink *SenseUplink) Connect(ctx context.Context, url string, headers http.Header, cookieJar http.CookieJar, allowUntrusted bool, timeout time.Duration, reconnect bool) error

Connect connect to sense environment

func (*SenseUplink) Disconnect

func (uplink *SenseUplink) Disconnect()

Disconnect Sense connection

func (*SenseUplink) IsConnected added in v0.16.5

func (uplink *SenseUplink) IsConnected() bool

IsConnected returns true if uplink is live

func (*SenseUplink) LogMetric

func (uplink *SenseUplink) LogMetric(invocation *enigma.Invocation, metrics *enigma.InvocationMetrics, result *enigma.InvocationResponse)

LogMetric async log metric, this is injected into the enigma dialer and is responsible for recording message sent and received times, these times are used to record response times both for individual requests and entire actions

func (*SenseUplink) OnUnexpectedDisconnect

func (uplink *SenseUplink) OnUnexpectedDisconnect(f func())

OnUnexpectedDisconnect registers an function to be executed on unexpected disconnect

func (*SenseUplink) SetCurrentApp added in v0.5.7

func (uplink *SenseUplink) SetCurrentApp(appGUID string, doc *enigma.Doc) error

type TrafficLogger

type TrafficLogger struct {
	LogEntry *logger.LogEntry
	Requests *atomichandlers.AtomicCounter
	Counters *statistics.ExecutionCounters
}

trafficLogger implementation of enigma.trafficLogger interface

func NewTrafficLogger

func NewTrafficLogger(logEntry *logger.LogEntry, counters *statistics.ExecutionCounters) *TrafficLogger

NewTrafficLogger create new instance of traffic logger with default values

func (*TrafficLogger) Closed

func (tl *TrafficLogger) Closed()

Closed log socket closed

func (*TrafficLogger) Opened

func (tl *TrafficLogger) Opened()

Opened socket was opened

func (*TrafficLogger) Received

func (tl *TrafficLogger) Received(message []byte)

Received message received on socket

func (*TrafficLogger) RequestCount

func (tl *TrafficLogger) RequestCount() uint64

RequestCount get current request count

func (*TrafficLogger) ResetRequestCount

func (tl *TrafficLogger) ResetRequestCount()

ResetRequestCount reset current request count

func (*TrafficLogger) Sent

func (tl *TrafficLogger) Sent(message []byte)

Sent message sent on socket

type TrafficRequestCounter

type TrafficRequestCounter struct {
	Requests *atomichandlers.AtomicCounter
	Counters *statistics.ExecutionCounters
}

TrafficRequestCounter implementation of enigma.trafficLogger interface

func NewTrafficRequestCounter

func NewTrafficRequestCounter(counters *statistics.ExecutionCounters) *TrafficRequestCounter

NewTrafficRequestCounter create new instance of traffic request counter

func (*TrafficRequestCounter) Closed

func (tl *TrafficRequestCounter) Closed()

Closed implements trafficLogger interface

func (*TrafficRequestCounter) Opened

func (tl *TrafficRequestCounter) Opened()

Opened implements trafficLogger interface

func (*TrafficRequestCounter) Received

func (tl *TrafficRequestCounter) Received(message []byte)

Received implements trafficLogger interface

func (*TrafficRequestCounter) RequestCount

func (tl *TrafficRequestCounter) RequestCount() uint64

RequestCount get current request count

func (*TrafficRequestCounter) ResetRequestCount

func (tl *TrafficRequestCounter) ResetRequestCount()

ResetRequestCount reset current request count

func (*TrafficRequestCounter) Sent

func (tl *TrafficRequestCounter) Sent(message []byte)

Sent count sent requests

type VarCache added in v0.5.8

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

varCache

func NewVarCache added in v0.5.8

func NewVarCache() VarCache

func (*VarCache) Lookup added in v0.5.8

func (vc *VarCache) Lookup(varName string) (varValue *enigma.GenericVariable, hit bool)

func (*VarCache) Store added in v0.5.8

func (vc *VarCache) Store(name string, variable *enigma.GenericVariable)

Jump to

Keyboard shortcuts

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