multiplex

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context is a type used as a way to pass dynamic parameters coming from specific calls during execution of service (for example CreateSessionRequest)

func NewContext

func NewContext() *Context

NewContext creates a new context

func (*Context) GetError

func (c *Context) GetError() error

func (*Context) GetIMSI

func (c *Context) GetIMSI() (uint64, error)

GetContext returns IMSI in uint64 format That IMSI can come from different sources like IMSI string or SessionId

func (*Context) WithIMSI

func (c *Context) WithIMSI(imsi string) *Context

WithIMSI adds imsi to context from a IMSI string (from IMSI123456789012345 123456789012345)

func (*Context) WithSessionId

func (c *Context) WithSessionId(sessionId string) *Context

WithSessionId adds imsi to context from sessionId (from IMSI123456789012345-54321 to 123456789012345)

type Multiplexor

type Multiplexor interface {
	// GetIndex return an index based on the implementation of Multiplexor
	GetIndex(*Context) (int, error)
}

Multiplexor interface has to be implemented by any new Multiplexor. Multiplexor can be loaded with data during creation and we can pass some dynamic parameters coming from each requests (using context)

func NewStaticMultiplexByIMSI

func NewStaticMultiplexByIMSI(numServers int) (Multiplexor, error)

NewStaticMultiplexByIMSI creates a StaticMultiplexByIMSI with a specific number of servers That number must be specified before service is started. Context must be used to pass dynamic data coming during execution of service

type StaticMultiplexByIMSI

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

StaticMultiplexByIMSI contains is a basic Multiplexor that distribuites each IMSI to a specific index based on the IMSImod(numServers)

func (*StaticMultiplexByIMSI) GetIndex

func (m *StaticMultiplexByIMSI) GetIndex(c *Context) (int, error)

GetIndex provides the index of the server per that IMSI

Jump to

Keyboard shortcuts

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