ops

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: CC0-1.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTerminateConnection  = errors.New("unsupported opcode, begin connection tear down")
	ErrConnectionTerminated = errors.New("connection already teared down")
	ErrEmptyTopicSet        = errors.New("topic list is empty")
	ErrListenerNotStarted   = errors.New("failed to start listener")
	ErrEmptyRead            = errors.New("read zero bytes from socket")
	ErrIllegalRead          = errors.New("illegal envelope read completion event")
)

Functions

This section is empty.

Types

type AddSubscriptionRequest

type AddSubscriptionRequest struct {
	Id     uint64
	Topics []string
}

AddSubscriptionRequest - After a subcriber is registered i.e. has been allocated one unique subscription id they can subscribe to more topics, that's what's being done here

func (*AddSubscriptionRequest) ReadFrom

func (a *AddSubscriptionRequest) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Read subscription request back from stream & constructs object

func (*AddSubscriptionRequest) WriteEnvelope added in v0.2.0

func (a *AddSubscriptionRequest) WriteEnvelope(w io.Writer) (int64, error)

WriteEnvelope - Subscriber invokes for writing message envelope so that Hub can understand `how to handle message ?`

It should write 5-bytes into stream, in ideal condition

func (*AddSubscriptionRequest) WriteTo

func (a *AddSubscriptionRequest) WriteTo(w io.Writer) (int64, error)

WriteTo - Writes subscription request to stream in recoverable form

type CountResponse

type CountResponse uint32

CountResponse - Lets publisher/ subscriber know of some sort of count which has context specific meaning like `how many topics were successfully subscribed to ?` or `how many subscribers received message ?`

func (*CountResponse) ReadFrom

func (p *CountResponse) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Recover content back from stream

func (CountResponse) WriteTo

func (p CountResponse) WriteTo(w io.Writer) (int64, error)

WriteTo - Write to stream

type Msg

type Msg pubsub.Message

Publisher to send message in this form

func (*Msg) ReadFrom

func (m *Msg) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Reconstructs message back from stream

func (*Msg) WriteEnvelope added in v0.2.0

func (m *Msg) WriteEnvelope(w io.Writer) (int64, error)

WriteEnvelope - Publisher invokes for writing message envelope so that Hub can understand `how to handle message ?`

It should write 5-bytes into stream, in ideal condition

func (*Msg) WriteTo

func (m *Msg) WriteTo(w io.Writer) (int64, error)

WriteTo - Writes message to byte stream in recoverable form

type NewSubResponse

type NewSubResponse struct {
	Id         uint64
	TopicCount uint32
}

NewSubResponse - After sending subscriber registration request along with topic list of interest, it expects to hear back with `what's its subcriber id ?` & `how many topics it successfully got subscribed to ?`

func (*NewSubResponse) ReadFrom

func (n *NewSubResponse) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Reads back from stream into structured form

func (*NewSubResponse) WriteTo

func (n *NewSubResponse) WriteTo(w io.Writer) (int64, error)

WriteTo - Writes to stream

type NewSubscriptionRequest

type NewSubscriptionRequest struct {
	Topics []string
}

NewSubscriptionRequest - Subscriber to send new topic subscription request over stream

func (*NewSubscriptionRequest) ReadFrom

func (n *NewSubscriptionRequest) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Read subscription request back from stream & constructs object

func (*NewSubscriptionRequest) WriteEnvelope added in v0.2.0

func (n *NewSubscriptionRequest) WriteEnvelope(w io.Writer) (int64, error)

WriteEnvelope - Subscriber invokes for writing message envelope so that Hub can understand `how to handle message ?`

It should write 5-bytes into stream, in ideal condition

func (*NewSubscriptionRequest) WriteTo

func (n *NewSubscriptionRequest) WriteTo(w io.Writer) (int64, error)

WriteTo - Writes subscription request to stream in recoverable form

type OP

type OP uint8
const (
	UNSUPPORTED OP = iota + 1
	PUB_REQ
	PUB_RESP
	NEW_SUB_REQ
	NEW_SUB_RESP
	MSG_PUSH
	ADD_SUB_REQ
	ADD_SUB_RESP
	UNSUB_REQ
	UNSUB_RESP
)

func (*OP) ReadFrom

func (o *OP) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Reads operation code from stream & uses proper handler method for reading messsage, eventually acts on it

func (OP) WriteTo

func (o OP) WriteTo(w io.Writer) (int64, error)

WriteTo - Writes operation type to stream, so that receiving party can understand intention of message it's going to read

type PushedMessage

type PushedMessage pubsub.PublishedMessage

PushedMessage - Manager to push message to subscriber in this form as soon as it's ready to push it, after getting notified by HUB

func (*PushedMessage) ReadFrom

func (p *PushedMessage) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Subscriber reads received pushed message from byte stream into structured data

func (*PushedMessage) WriteTo

func (p *PushedMessage) WriteTo(w io.Writer) (int64, error)

WriteTo - Writes to message binary to byte stream

type UnsubcriptionRequest

type UnsubcriptionRequest struct {
	Id     uint64
	Topics []string
}

UnsubcriptionRequest - Client to send topic unsubscription request in this form

func (*UnsubcriptionRequest) ReadFrom

func (u *UnsubcriptionRequest) ReadFrom(r io.Reader) (int64, error)

ReadFrom - Read unsubscription request back from stream & constructs object

func (*UnsubcriptionRequest) WriteEnvelope added in v0.2.0

func (u *UnsubcriptionRequest) WriteEnvelope(w io.Writer) (int64, error)

WriteEnvelope - Subscriber invokes for writing message envelope so that Hub can understand `how to handle message ?`

It should write 5-bytes into stream, in ideal condition

func (*UnsubcriptionRequest) WriteTo

func (u *UnsubcriptionRequest) WriteTo(w io.Writer) (int64, error)

WriteTo - Subscriber to write topic unsubcription request to stream

Jump to

Keyboard shortcuts

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