dms

package
v0.0.0-...-36a2cef Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: BSD-2-Clause, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenTypeSmf  TokenType = 0x5000
	TokenTypeSbim TokenType = 0x6000
	TokenTypeUdm  TokenType = 0x7000
	TokenTypeChf  TokenType = 0x8000

	MinStartToken     = 1
	MaxEndToken       = 100
	DefaultStartToken = 1
	DefaultEndToken   = 10
)
View Source
const NullEntityKey = uint64(0)

Variables

View Source
var (
	DefaultSrcSmfEntity  = NewEntity("smf", "smf1", TokenTypeSmf, DefaultStartToken, DefaultEndToken)
	DefaultSrcSbimEntity = NewEntity("sbim", "sbim1", TokenTypeSbim, DefaultStartToken, DefaultEndToken)
	DefaultSrcUdmEntity  = NewEntity("udm", "udm1", TokenTypeUdm, DefaultStartToken, DefaultEndToken)
	DefaultSrcChfEntity  = NewEntity("chf", "chf1", TokenTypeChf, DefaultStartToken, DefaultEndToken)

	DefaultDstSmfEntity  = NewEntity("smf", "smf1", TokenTypeSmf, MinStartToken, MaxEndToken)
	DefaultDstSbimEntity = NewEntity("sbim", "sbim1", TokenTypeSbim, MinStartToken, MaxEndToken)
	DefaultDstUdmEntity  = NewEntity("udm", "udm1", TokenTypeUdm, MinStartToken, MaxEndToken)
	DefaultDstChfEntity  = NewEntity("chf", "chf1", TokenTypeChf, MinStartToken, MaxEndToken)
)

Functions

This section is empty.

Types

type ContextIndex

type ContextIndex uint64

type Dms

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

func NewKafkaDms

func NewKafkaDms(brokers []string, handler ReceiveHandler, servedEntity *Entity) (*Dms, error)

func NewNatsDms

func NewNatsDms(natsUrl, clusterId, clientId string, handler ReceiveHandler, servedEntity *Entity) (*Dms, error)

func (*Dms) Close

func (d *Dms) Close() error

func (*Dms) Run

func (d *Dms) Run(ctx context.Context) error

Run blocked after running

func (*Dms) SendMessage

func (d *Dms) SendMessage(srcKey, dstKey EntityKey, payload []byte) error

type Entity

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

func NewEntity

func NewEntity(className string, objectName string, tokenType TokenType, startToken, endToken uint64) *Entity

NewEntity if the Entity is source of Dms, startToken and endToken is the instance where the entity is located, if the Entity is destination of Dms, startToken is min, endToken is max

func (Entity) NewEntityKey

func (e Entity) NewEntityKey(tokenIndex, ctxIndex uint64) *EntityKey

func (Entity) NewPublicEntityKey

func (e Entity) NewPublicEntityKey() *EntityKey

func (Entity) NewRandomEntityKey

func (e Entity) NewRandomEntityKey() *EntityKey

type EntityKey

type EntityKey uint64

func NewEntityKey

func NewEntityKey(tokenType, tokenIndex, ctxIndex uint64) *EntityKey

NewEntityKey tokenIndex can not be zero, otherwise it will bo assigned to zero

func NewPublicEntityKey

func NewPublicEntityKey(tokenType TokenType) *EntityKey

NewPublicEntityKey so called publicEntityKey means tokenIndex and ContextIndex is zero PublicEntityKey means app isn't assigned a key, and the key will be randomly sent to an instance for processing

func (*EntityKey) AtoI

func (e *EntityKey) AtoI(s string) *EntityKey

func (EntityKey) ContextIndex

func (e EntityKey) ContextIndex() ContextIndex

func (EntityKey) IsPublicEntityKey

func (e EntityKey) IsPublicEntityKey() bool

func (*EntityKey) ItoA

func (e *EntityKey) ItoA() string

func (EntityKey) MapToTopic

func (e EntityKey) MapToTopic() string

func (*EntityKey) SetContextIndex

func (e *EntityKey) SetContextIndex(ctxIndex ContextIndex) *EntityKey

func (*EntityKey) SetToken

func (e *EntityKey) SetToken(token Token) *EntityKey

func (*EntityKey) SetTokenIndex

func (e *EntityKey) SetTokenIndex(tokenIndex TokenIndex) *EntityKey

func (*EntityKey) SetTokenType

func (e *EntityKey) SetTokenType(tokenType TokenType) *EntityKey

func (EntityKey) Token

func (e EntityKey) Token() Token

func (EntityKey) TokenIndex

func (e EntityKey) TokenIndex() TokenIndex

func (EntityKey) TokenType

func (e EntityKey) TokenType() TokenType

type ReceiveHandler

type ReceiveHandler func(srcKey EntityKey, dstKey EntityKey, msg *message.Message) error

type Token

type Token uint64

type TokenIndex

type TokenIndex uint64

type TokenType

type TokenType uint64

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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