subscriptions

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: MPL-2.0 Imports: 11 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:

Subscription
SubscriptionList

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 IsOutdated

func IsOutdated(s *Subscription, remote *Subscription) (outdated bool)

func TenantTopicIndexer

func TenantTopicIndexer() *topicIndexer

Types

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 *SubscriptionList, topic Topic) *SubscriptionList

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 Store

type Store interface {
	ByTopic(tenant string, pattern []byte) (*SubscriptionList, error)
	ByID(id string) (*Subscription, error)
	All() (SubscriptionList, error)
	ByPeer(peer uint64) (SubscriptionList, error)
	BySession(id string) (SubscriptionList, error)
	Sessions() ([]string, error)
	Create(message *Subscription) error
	Delete(id string) error
	On(event string, handler func(*Subscription)) func()
}

func NewMemDBStore

func NewMemDBStore(router state.Router) (Store, error)

type Subscription

type Subscription 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        uint64 `protobuf:"varint,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 (*Subscription) Descriptor

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

func (*Subscription) GetID

func (m *Subscription) GetID() string

func (*Subscription) GetLastAdded

func (m *Subscription) GetLastAdded() int64

func (*Subscription) GetLastDeleted

func (m *Subscription) GetLastDeleted() int64

func (*Subscription) GetPattern

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

func (*Subscription) GetPeer

func (m *Subscription) GetPeer() uint64

func (*Subscription) GetQos

func (m *Subscription) GetQos() int32

func (*Subscription) GetSessionID

func (m *Subscription) GetSessionID() string

func (*Subscription) GetTenant

func (m *Subscription) GetTenant() string

func (*Subscription) IsAdded

func (s *Subscription) IsAdded() bool

func (*Subscription) IsRemoved

func (s *Subscription) IsRemoved() bool

func (*Subscription) ProtoMessage

func (*Subscription) ProtoMessage()

func (*Subscription) Reset

func (m *Subscription) Reset()

func (*Subscription) String

func (m *Subscription) String() string

type SubscriptionFilter

type SubscriptionFilter func(*Subscription) bool

type SubscriptionList

type SubscriptionList struct {
	Subscriptions []*Subscription `protobuf:"bytes,1,rep,name=Subscriptions" json:"Subscriptions,omitempty"`
}

func (*SubscriptionList) Append

func (e *SubscriptionList) Append(entry state.Entry)

func (SubscriptionList) Apply

func (set SubscriptionList) Apply(f func(*Subscription))

func (SubscriptionList) ApplyE

func (set SubscriptionList) ApplyE(f func(*Subscription) error) (err error)

func (SubscriptionList) ApplyIdx

func (set SubscriptionList) ApplyIdx(f func(idx int, s *Subscription))

func (*SubscriptionList) AtIndex

func (e *SubscriptionList) AtIndex(idx int) state.Entry

func (*SubscriptionList) Descriptor

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

func (SubscriptionList) Filter

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

func (*SubscriptionList) GetSubscriptions

func (m *SubscriptionList) GetSubscriptions() []*Subscription

func (*SubscriptionList) Length

func (e *SubscriptionList) Length() int

func (*SubscriptionList) New

func (e *SubscriptionList) New() state.EntrySet

func (*SubscriptionList) ProtoMessage

func (*SubscriptionList) ProtoMessage()

func (*SubscriptionList) Range

func (e *SubscriptionList) Range(f func(idx int, entry state.Entry))

func (*SubscriptionList) Reset

func (m *SubscriptionList) Reset()

func (*SubscriptionList) Set

func (e *SubscriptionList) Set(idx int, entry state.Entry)

func (*SubscriptionList) String

func (m *SubscriptionList) String() string

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