msg

package
v0.0.0-...-dd333d9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MPL-2.0 Imports: 9 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	RemoteShosetType string
	RemoteAddress    string
	// contains filtered or unexported fields
}

Cell : witch contain messages and useful intel

func (*Cell) GetMessage

func (c *Cell) GetMessage() Message

GetMessage :

type Command

type Command struct {
	MessageBase
	Target  string
	Command string
	Context map[string]interface{}
}

Command : gandalf commands

func NewCommand

func NewCommand(target string, command string, payload string) *Command

NewCommand : Command constructor todo : passer une map pour gerer les valeurs optionnelles ?

func (Command) GetCommand

func (c Command) GetCommand() string

GetCommand :

func (Command) GetContext

func (c Command) GetContext() map[string]interface{}

GetContext :

func (Command) GetMsgType

func (c Command) GetMsgType() string

GetMsgType accessor

func (Command) GetTarget

func (c Command) GetTarget() string

GetTarget :

type Config

type Config struct {
	MessageBase
	Target  string
	Command string
	Context map[string]interface{}
}

TODO MOVE TO GANDALF Config : gandalf configs

func NewConfig

func NewConfig(target string, command string, payload string) *Config

NewConfig : Config constructor todo : passer une map pour gerer les valeurs optionnelles ?

func (Config) GetCommand

func (c Config) GetCommand() string

GetCommand :

func (Config) GetContext

func (c Config) GetContext() map[string]interface{}

GetContext :

func (Config) GetMsgType

func (c Config) GetMsgType() string

GetMsgType accessor

func (Config) GetTarget

func (c Config) GetTarget() string

GetTarget :

type ConfigProtocol

type ConfigProtocol struct {
	MessageBase
	CommandName  string
	LogicalName  string
	ShosetType   string
	Address      string
	MyBrothers   []string
	YourBrothers []string
}

ConfigProtocol : Gandalf Socket config

func NewCfg

func NewCfg(address, lName, shosetType, commandName string) *ConfigProtocol

for link and join

func NewCfgBrothers

func NewCfgBrothers(myBrothers, yourBrothers []string, lName, commandName, shosetType string) *ConfigProtocol

for link

func (ConfigProtocol) GetAddress

func (c ConfigProtocol) GetAddress() string

GetAddress :

func (ConfigProtocol) GetCommandName

func (c ConfigProtocol) GetCommandName() string

GetCommandName :

func (ConfigProtocol) GetLogicalName

func (c ConfigProtocol) GetLogicalName() string

GetLogicalName :

func (ConfigProtocol) GetMsgType

func (c ConfigProtocol) GetMsgType() string

GetMsgType accessor

func (ConfigProtocol) GetMyBrothers

func (c ConfigProtocol) GetMyBrothers() []string

GetConns :

func (ConfigProtocol) GetShosetType

func (c ConfigProtocol) GetShosetType() string

GetShosetType :

func (ConfigProtocol) GetYourBrothers

func (c ConfigProtocol) GetYourBrothers() []string

GetBros :

type Event

type Event struct {
	MessageBase
	Topic         string
	Event         string
	ReferenceUUID string
}

Event : Gandalf event internal

func NewEvent

func NewEvent(params map[string]string) *Event

NewEvent : Event constructor

func NewEventClassic

func NewEventClassic(topic, event, payload string) *Event

NewEventClassic : Event Classic constructor

func (Event) GetEvent

func (e Event) GetEvent() string

GetEvent :

func (Event) GetMsgType

func (e Event) GetMsgType() string

GetMsgType accessor

func (Event) GetReferenceUUID

func (e Event) GetReferenceUUID() string

GetReferenceUUID :

func (Event) GetTopic

func (e Event) GetTopic() string

GetTopic :

type Iterator

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

Iterator : queue allowing access via a string key

func NewIterator

func NewIterator(queue *Queue) *Iterator

NewIterator : constructor

func (*Iterator) Close

func (i *Iterator) Close()

Close : fermeture de l'iterateur

func (*Iterator) Get

func (i *Iterator) Get() *Cell

Get : get next unseen element

func (*Iterator) Init

func (i *Iterator) Init(queue *Queue)

Init : initialisation

func (*Iterator) PrintQueue

func (i *Iterator) PrintQueue()

PrintQueue : print la queue

type Message

type Message interface {
	GetMsgType() string
	GetUUID() string
	GetTenant() string
	GetToken() string
	GetTimestamp() int64
	GetTimeout() int64
	GetPayload() string
	GetMajor() int8
	GetMinor() int8
}

Message interface

type MessageBase

type MessageBase struct {
	UUID      string
	Tenant    string
	Token     string
	Timeout   int64
	Timestamp int64
	Payload   string
	Next      string
	Major     int8
	Minor     int8
}

MessageBase base struct for messages

func (MessageBase) GetMajor

func (m MessageBase) GetMajor() int8

GetMajor accessor

func (MessageBase) GetMinor

func (m MessageBase) GetMinor() int8

GetMinor accessor

func (MessageBase) GetPayload

func (m MessageBase) GetPayload() string

GetPayload accessor

func (MessageBase) GetTenant

func (m MessageBase) GetTenant() string

GetTenant accessor

func (MessageBase) GetTimeout

func (m MessageBase) GetTimeout() int64

GetTimeout accessor

func (MessageBase) GetTimestamp

func (m MessageBase) GetTimestamp() int64

GetTimestamp accessor

func (MessageBase) GetToken

func (m MessageBase) GetToken() string

GetToken accessor

func (MessageBase) GetUUID

func (m MessageBase) GetUUID() string

GetUUID accessor

func (*MessageBase) InitMessageBase

func (m *MessageBase) InitMessageBase()

InitMessageBase constructor

type Queue

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

Queue : queue allowing access via a string key

func NewQueue

func NewQueue() *Queue

NewQueue : constructor

func (*Queue) First

func (q *Queue) First() *Cell

First :

func (*Queue) GetByReferencesUUID

func (q *Queue) GetByReferencesUUID(uuid string) *Event

Init :

func (*Queue) Init

func (q *Queue) Init()

Init :

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

IsEmpty : the event queue is empty

func (*Queue) Next

func (q *Queue) Next(key string) *Cell

Next :

func (*Queue) Print

func (q *Queue) Print()

Print :

func (*Queue) Push

func (q *Queue) Push(m Message, RemoteShosetType, RemoteAddress string) bool

Push : insert a new value in the queue except if the UUID is already present and remove after timeout expiration

type Reader

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

Reader : simple bufio.Reader safe for goroutines...

func NewReader

func NewReader(rd io.Reader) *Reader

NewReader : constructor

func (*Reader) ReadMessage

func (r *Reader) ReadMessage(data interface{}) error

ReadMessage : decode a message in a safe way for goroutines

func (*Reader) ReadString

func (r *Reader) ReadString() (string, error)

ReadString : safe version for goroutines

type Writer

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

Writer : simple bufio.Writer safe for goroutines...

func NewWriter

func NewWriter(wd io.Writer) *Writer

NewWriter : constructor

func (*Writer) Flush

func (r *Writer) Flush() error

Flush : safe version for goroutines

func (*Writer) WriteMessage

func (r *Writer) WriteMessage(data interface{}) error

WriteMessage : encode a message in a safe way for goroutines

func (*Writer) WriteString

func (r *Writer) WriteString(data string) (int, error)

WriteString : safe version for goroutines

Jump to

Keyboard shortcuts

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