subscriptions

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package subscriptions is a generated protocol buffer package.

It is generated from these files:

types.proto

It has these top-level messages:

Metadata
SubscriptionMetadataList

Index

Constants

View Source
const (
	SubscriptionCreated string = "subscription_created"
	SubscriptionDeleted string = "subscription_deleted"
)

Variables

View Source
var (
	ErrSubscriptionNotFound = errors.New("subscription not found")
)
View Source
var (
	SEP = byte('/')
)

Functions

func TenantTopicIndexer

func TenantTopicIndexer() *topicIndexer

Types

type Channel added in v0.0.39

type Channel interface {
	Broadcast([]byte)
}

type INode

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

func NewINode

func NewINode() *INode

func (*INode) AddNode

func (d *INode) AddNode(node *Node)

func (*INode) Insert

func (d *INode) Insert(topic Topic, tenant string, subscription Subscription)

func (*INode) Remove

func (d *INode) Remove(tenant, id string, topic Topic) error

func (*INode) Select

func (d *INode) Select(tenant string, set SubscriptionSet, topic Topic) SubscriptionSet

type Metadata added in v0.0.39

type Metadata struct {
	ID          string `protobuf:"bytes,1,opt,name=ID" json:"ID,omitempty"`
	SessionID   string `protobuf:"bytes,2,opt,name=SessionID" json:"SessionID,omitempty"`
	Tenant      string `protobuf:"bytes,3,opt,name=Tenant" json:"Tenant,omitempty"`
	Pattern     []byte `protobuf:"bytes,4,opt,name=Pattern,proto3" json:"Pattern,omitempty"`
	Qos         int32  `protobuf:"varint,5,opt,name=Qos" json:"Qos,omitempty"`
	Peer        string `protobuf:"bytes,6,opt,name=Peer" json:"Peer,omitempty"`
	LastAdded   int64  `protobuf:"varint,7,opt,name=LastAdded" json:"LastAdded,omitempty"`
	LastDeleted int64  `protobuf:"varint,8,opt,name=LastDeleted" json:"LastDeleted,omitempty"`
}

func (*Metadata) Descriptor added in v0.0.39

func (*Metadata) Descriptor() ([]byte, []int)

func (*Metadata) GetID added in v0.0.39

func (m *Metadata) GetID() string

func (*Metadata) GetLastAdded added in v0.0.39

func (m *Metadata) GetLastAdded() int64

func (*Metadata) GetLastDeleted added in v0.0.39

func (m *Metadata) GetLastDeleted() int64

func (*Metadata) GetPattern added in v0.0.39

func (m *Metadata) GetPattern() []byte

func (*Metadata) GetPeer added in v0.0.39

func (m *Metadata) GetPeer() string

func (*Metadata) GetQos added in v0.0.39

func (m *Metadata) GetQos() int32

func (*Metadata) GetSessionID added in v0.0.39

func (m *Metadata) GetSessionID() string

func (*Metadata) GetTenant added in v0.0.39

func (m *Metadata) GetTenant() string

func (*Metadata) ProtoMessage added in v0.0.39

func (*Metadata) ProtoMessage()

func (*Metadata) Reset added in v0.0.39

func (m *Metadata) Reset()

func (*Metadata) String added in v0.0.39

func (m *Metadata) String() string

type Node

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

func NewNode

func NewNode(tenant string, pattern []byte) *Node

func (*Node) AddSubscription

func (n *Node) AddSubscription(tenant string, subscription Subscription) *Node

func (*Node) DelSubscription

func (n *Node) DelSubscription(id string) *Node

type RemoteSender added in v0.0.39

type RemoteSender func(host string, session string, publish packet.Publish) error

type Store

type Store interface {
	ByTopic(tenant string, pattern []byte) (SubscriptionSet, error)
	ByID(id string) (Subscription, error)
	All() (SubscriptionSet, error)
	ByPeer(peer string) (SubscriptionSet, error)
	BySession(id string) (SubscriptionSet, error)
	Sessions() ([]string, error)
	Create(message Subscription, sender func(packet.Publish) error) error
	Delete(id string) error
	On(event string, handler func(Subscription)) func()
}

func NewMemDBStore

func NewMemDBStore(mesh cluster.Mesh, sender RemoteSender) (Store, error)

type Subscription

type Subscription struct {
	Metadata
	Sender func(packet.Publish) error
}

type SubscriptionFilter

type SubscriptionFilter func(Subscription) bool

type SubscriptionMetadataList added in v0.0.39

type SubscriptionMetadataList struct {
	Metadatas []*Metadata `protobuf:"bytes,1,rep,name=Metadatas" json:"Metadatas,omitempty"`
}

func (*SubscriptionMetadataList) Descriptor added in v0.0.39

func (*SubscriptionMetadataList) Descriptor() ([]byte, []int)

func (*SubscriptionMetadataList) GetMetadatas added in v0.0.39

func (m *SubscriptionMetadataList) GetMetadatas() []*Metadata

func (*SubscriptionMetadataList) ProtoMessage added in v0.0.39

func (*SubscriptionMetadataList) ProtoMessage()

func (*SubscriptionMetadataList) Reset added in v0.0.39

func (m *SubscriptionMetadataList) Reset()

func (*SubscriptionMetadataList) String added in v0.0.39

func (m *SubscriptionMetadataList) String() string

type SubscriptionSet added in v0.0.39

type SubscriptionSet []Subscription

func (SubscriptionSet) Apply added in v0.0.39

func (set SubscriptionSet) Apply(f func(Subscription))

func (SubscriptionSet) ApplyE added in v0.0.39

func (set SubscriptionSet) ApplyE(f func(Subscription) error) (err error)

func (SubscriptionSet) ApplyIdx added in v0.0.39

func (set SubscriptionSet) ApplyIdx(f func(idx int, s Subscription))

func (SubscriptionSet) Filter added in v0.0.39

func (set SubscriptionSet) Filter(filters ...SubscriptionFilter) SubscriptionSet

type Topic

type Topic []byte

func (Topic) Chop

func (t Topic) Chop() (Topic, []byte, bool)

Jump to

Keyboard shortcuts

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