func NewServer(options ...Option) *Server {
	s := &Server{
		subscriptions: make(map[string]map[string]Query),
	}
	s.BaseService = *cmn.NewBaseService(nil, "PubSub", s)
	for _, option := range options {
		option(s)
	}
	s.cmds = make(chan cmd, s.cmdsCap)
	return s
}
NewServer returns a new server. See the commentary on the Option functions
for a detailed description of how to configure buffering. If no options are
provided, the resulting server's queue is unbuffered.
package pubsub
import (
	"context"
	"errors"
	"sync"
	cmn "github.com/tendermint/tendermint/libs/common"
)
type operation int
const (
	sub operation = iota
	pub
	unsub
	shutdown
)
var (
	ErrSubscriptionNotFound = errors.New("subscription not found")
	ErrAlreadySubscribed = errors.New("already subscribed")
)
type cmd struct {
	op       operation
	query    Query
	ch       chan<- interface{}
	clientID string
	msg      interface{}
	tags     TagMap
}
type Query interface {
	Matches(tags TagMap) bool
	String() string
}
type Server struct {
	cmn.BaseService
	cmds    chan cmd
	cmdsCap int
	mtx           sync.RWMutex
	subscriptions map[string]map[string]Query  
}
type Option func(*Server)
type TagMap interface {
	Get(key string) (value string, ok bool)
	Len() int
}
type tagMap map[string]string
var _ TagMap = (*tagMap)(nil)
func NewTagMap(data map[string]string) TagMap {
	return tagMap(data)
}
func (ts tagMap) Get(key string) (value string, ok bool) {
	value, ok = ts[key]
	return
}
func (ts tagMap) Len() int {
	return len(ts)
}