topic

package
v0.0.0-...-b3e13b0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShareGroupCompile = `^\$share/([0-9a-zA-Z_-]+)/(.+)$`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentTree

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

* thread safe tree,depends on "github.com/orcaman/concurrent-map"

func NewTree

func NewTree(root string) *ConcurrentTree

* build a thread safe tree,root as root node clientId

func (*ConcurrentTree) String

func (t *ConcurrentTree) String() string

type LocalTree

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

* struct a Subscribe tree,store Subscribe Client and path

func (*LocalTree) AddNodes

func (st *LocalTree) AddNodes(ts []string, dataKey string, dataVal *SubscribeThing)

* give a topic array,tree will add all nodes

func (*LocalTree) GetSubscribers

func (st *LocalTree) GetSubscribers(topic string) (map[string]*SubscribeThing, error)

func (*LocalTree) Subscribe

func (st *LocalTree) Subscribe(topic string, thing *SubscribeThing) error

* Client Subscribe topic

type Manager

type Manager interface {
	AddNodes(ts []string, dataKey string, dataVal *SubscribeThing)
	GetSubscribers(topic string) (map[string]*SubscribeThing, error)
	Subscribe(topic string, thing *SubscribeThing) error
}

func NewManager

func NewManager() Manager

type SubscribeThing

type SubscribeThing struct {
	Id     string
	Client interface{} //store client pointer
	// contains filtered or unexported fields
}

func NewSubscribeThing

func NewSubscribeThing(id string, client interface{}) *SubscribeThing

type TreeNode

type TreeNode struct {
	Id string

	Data cmap.ConcurrentMap
	// contains filtered or unexported fields
}

func NewTreeNode

func NewTreeNode(id string) *TreeNode

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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