gofmqp

package module
v0.0.0-...-e386398 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: GPL-3.0 Imports: 6 Imported by: 1

README

gofmqp

Implementation of the FMQP protocol for go

Documentation

Overview

This file is part of gofmqp.

gofmqp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

gofmqp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with gofmqp. If not, see <https://www.gnu.org/licenses/>.

This file is part of gofmqp.

gofmqp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

gofmqp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with gofmqp. If not, see <https://www.gnu.org/licenses/>.

This file is part of gofmqp.

gofmqp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

gofmqp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with gofmqp. If not, see <https://www.gnu.org/licenses/>.

This file is part of gofmqp.

gofmqp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

gofmqp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with gofmqp. If not, see <https://www.gnu.org/licenses/>.

This file is part of gofmqp.

gofmqp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

gofmqp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with gofmqp. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const DEFAULT_COLLECTION_FREQUENCY = 100
View Source
const NO_COLLECT = 9223372036854775807

Variables

This section is empty.

Functions

func CompareTopics

func CompareTopics(a, b MsgTopic) bool

Types

type Cache

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

func NewCache

func NewCache() Cache

func (*Cache) Add

func (cache *Cache) Add(msg Message)

func (*Cache) Get

func (cache *Cache) Get(topic MsgTopic) []Message

type Connection

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

func Dial

func Dial(network, address string, config *tls.Config) (conn Connection, err error)

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Next

func (c *Connection) Next() (msg Message, err error)

func (*Connection) NextRaw

func (c *Connection) NextRaw() (msg RawMessage, err error)

func (*Connection) NextUnchecked

func (c *Connection) NextUnchecked() (msg Message, err error)

func (*Connection) Send

func (c *Connection) Send(msg *Message) (err error)

func (*Connection) SendRaw

func (c *Connection) SendRaw(msg *RawMessage) (err error)

type IMsgReader

type IMsgReader interface {
	NextRaw() (msg RawMessage, err error)
	NextUnchecked() (msg Message, err error)
	Next() (msg Message, err error)
}

type IMsgWriter

type IMsgWriter interface {
	SendRaw(msg *RawMessage) (err error)
	Send(msg *Message) (err error)
}

type Id

type Id int

type Listener

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

func Listen

func Listen(network, laddr string, config *tls.Config) (listener Listener, err error)

func (*Listener) Accept

func (l *Listener) Accept() (conn Connection, err error)

func (*Listener) Close

func (l *Listener) Close() error

type Message

type Message struct {
	Type      PackageType
	SubType   SubscribeType
	TopicType TopicSystem
	Debug     bool
	LastWill  bool
	Cache     bool
	Topic     *MsgTopic
	Body      []byte
}

type MsgReader

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

func NewMsgReader

func NewMsgReader(input io.Reader) MsgReader

func (*MsgReader) Next

func (r *MsgReader) Next() (msg Message, err error)

func (*MsgReader) NextRaw

func (r *MsgReader) NextRaw() (msg RawMessage, err error)

func (*MsgReader) NextUnchecked

func (r *MsgReader) NextUnchecked() (msg Message, err error)

type MsgTopic

type MsgTopic string

func ClearTopic

func ClearTopic(t MsgTopic) MsgTopic

type MsgWriter

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

func NewMsgWriter

func NewMsgWriter(out io.Writer) MsgWriter

func (*MsgWriter) Send

func (w *MsgWriter) Send(msg *Message) (err error)

func (*MsgWriter) SendRaw

func (w *MsgWriter) SendRaw(msg *RawMessage) (err error)

type PackageType

type PackageType bool
const (
	PackageTypePub PackageType = false
	PackageTypeSub             = true
)

type RawMessage

type RawMessage struct {
	Type      PackageType
	SubType   SubscribeType
	TopicType TopicSystem
	Debug     bool
	LastWill  bool
	Cache     bool
	Topic     []byte
	Body      []byte
}

type Router

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

func NewRouter

func NewRouter() Router

func NewRouterFrq

func NewRouterFrq(cf uint64) Router

func (*Router) Collect

func (router *Router) Collect()

func (*Router) GetSubscriptions

func (router *Router) GetSubscriptions(sub Id) []MsgTopic

func (*Router) Route

func (router *Router) Route(ptopic MsgTopic) map[Id]bool

func (*Router) Sub

func (router *Router) Sub(sub Id, topic MsgTopic)

func (*Router) SubscribersCount

func (router *Router) SubscribersCount(stopic MsgTopic) int

func (*Router) Unsub

func (router *Router) Unsub(sub Id, topic MsgTopic)

func (*Router) UnsubAll

func (router *Router) UnsubAll(sub Id)

type SubscribeType

type SubscribeType bool
const (
	SubscribeTypeSub   SubscribeType = false
	SubscribeTypeUnsub               = true
)

type TopicSystem

type TopicSystem bool
const (
	TopicSystemRegular  TopicSystem = false
	TopicSystemFeedback             = true
)

Jump to

Keyboard shortcuts

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