func NewServer(options ...Option) *Server {
	s := &Server{
		subscriptions: make(map[string]map[string]struct{}),
	}
	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/XuanMaoSecLab/DolphinChain/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 Query interface {
	Matches(tags map[string]string) bool
	String() string
}
type cmd struct {
	op operation
	query        Query
	subscription *Subscription
	clientID     string
	msg  interface{}
	tags map[string]string
}
type Server struct {
	cmn.BaseService
	cmds    chan cmd
	cmdsCap int
	mtx           sync.RWMutex
	subscriptions map[string]map[string]struct{}  
}
type Option func(*Server)