connectionstate

package
v0.0.0-...-365054f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppTopicConnectionState represents the session state change topic
	AppTopicConnectionState = "State"
	// AppTopicConnectionStatistics represents the session stats topic
	AppTopicConnectionStatistics = "Statistics"
	// AppTopicConnectionSession represents the session lifetime changes
	AppTopicConnectionSession = "Session"
)

Topic represents the different topics a consumer can subscribe to

View Source
const (
	// NotConnected means no connection exists
	NotConnected = State("NotConnected")
	// Connecting means that connection is startCalled but not yet fully established
	Connecting = State("Connecting")
	// Connected means that fully established connection exists
	Connected = State("Connected")
	// Disconnecting means that connection close is in progress
	Disconnecting = State("Disconnecting")
	// Reconnecting means that connection is lost but underlying service is trying to reestablish it
	Reconnecting = State("Reconnecting")
	// Unknown means that we could not map the underlying transport state to our state
	Unknown = State("Unknown")
	// Canceled means that connection initialization was started, but failed never reaching Connected state
	Canceled = State("Canceled")
	// StateIPNotChanged means that consumer ip not changed after connection is created
	StateIPNotChanged = State("IPNotChanged")
	// StateConnectionFailed means that underlying connection is failed
	StateConnectionFailed = State("ConnectionFailed")
	// StateOnHold means that underlying connection failed, but manager keeps it not removed to prevent traffic leaks.
	StateOnHold = State("OnHold")
)
View Source
const (
	// SessionCreatedStatus represents a session creation event
	SessionCreatedStatus = "Created"
	// SessionEndedStatus represents a session end
	SessionEndedStatus = "Ended"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppEventConnectionSession

type AppEventConnectionSession struct {
	Status      string
	SessionInfo Status
}

AppEventConnectionSession represents a session related event

type AppEventConnectionState

type AppEventConnectionState struct {
	UUID        string
	State       State
	SessionInfo Status
}

AppEventConnectionState is the struct we'll emit on a AppEventConnectionState topic event

type AppEventConnectionStatistics

type AppEventConnectionStatistics struct {
	UUID        string
	Stats       Statistics
	SessionInfo Status
}

AppEventConnectionStatistics represents a session statistics event

type State

type State string

State represents list of possible connection states

type Statistics

type Statistics struct {
	At            time.Time
	BytesSent     uint64
	BytesReceived uint64
}

Statistics represents connection statistics.

func (Statistics) Diff

func (stats Statistics) Diff(new Statistics) Statistics

Diff calculates the difference in bytes between the old stats and new.

func (Statistics) Plus

func (stats Statistics) Plus(diff Statistics) Statistics

Plus adds up the given statistics with the diff and returns new stats

func (Statistics) String

func (stats Statistics) String() string

type Status

type Status struct {
	StartedAt        time.Time
	ConsumerID       identity.Identity
	ConsumerLocation locationstate.Location
	HermesID         common.Address
	State            State
	SessionID        session.ID
	Proposal         proposal.PricedServiceProposal
}

Status holds connection state, session id and proposal of the connection

func (*Status) Duration

func (s *Status) Duration() time.Duration

Duration returns elapsed time from marked session start

Jump to

Keyboard shortcuts

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