pubsub

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// MaxBytes the max number of bytes for a filter
	MaxBytes = 1 * 1024 * 1024

	// MaxAddresses the max number of addresses allowed
	MaxAddresses = 10000
)

Variables

View Source
var (
	ErrFilterNotInitialized = errors.New("filter not initialized")
	ErrAddressLimit         = errors.New("address limit exceeded")
	ErrInvalidFilterParam   = errors.New("invalid bloom filter params")
	ErrInvalidCommand       = errors.New("invalid command")
)

Functions

This section is empty.

Types

type AddAddresses

type AddAddresses struct {
	api.JSONAddresses
	// contains filtered or unexported fields
}

AddAddresses command to add addresses

type Command

type Command struct {
	NewBloom     *NewBloom     `json:"newBloom,omitempty"`
	NewSet       *NewSet       `json:"newSet,omitempty"`
	AddAddresses *AddAddresses `json:"addAddresses,omitempty"`
}

Command execution command

func (*Command) String

func (c *Command) String() string

type Filter

type Filter interface {
	Check(addr []byte) bool
}

type FilterParam

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

func NewFilterParam

func NewFilterParam() *FilterParam

func (*FilterParam) Add

func (f *FilterParam) Add(bl ...[]byte) error

func (*FilterParam) Check

func (f *FilterParam) Check(addr []byte) bool

func (*FilterParam) Filter

func (f *FilterParam) Filter() bloom.Filter

func (*FilterParam) Len

func (f *FilterParam) Len() int

func (*FilterParam) NewSet

func (f *FilterParam) NewSet()

func (*FilterParam) SetFilter

func (f *FilterParam) SetFilter(filter bloom.Filter) bloom.Filter

type Filterer

type Filterer interface {
	Filter(connections []Filter) ([]bool, interface{})
}

type NewBloom

type NewBloom struct {
	// MaxElements size of bloom filter
	MaxElements json.Uint64 `json:"maxElements"`
	// CollisionProb expected error rate of filter
	CollisionProb json.Float64 `json:"collisionProb"`
}

NewBloom command for a new bloom filter

func (*NewBloom) IsParamsValid

func (c *NewBloom) IsParamsValid() bool

type NewSet

type NewSet struct{}

NewSet command for a new map set

type Server

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

Server maintains the set of active clients and sends messages to the clients.

func New

func New(networkID uint32, log logging.Logger) *Server

func (*Server) Publish

func (s *Server) Publish(msg interface{}, parser Filterer)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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