import "github.com/prologic/msgbus"
metrics.go msgbus.go queue.go version.go
const ( // DefaultMaxQueueSize is the default maximum size of queues DefaultMaxQueueSize = 1000 // ~4MB per queue (1000 * 4KB) // DefaultMaxPayloadSize is the default maximum payload size DefaultMaxPayloadSize = 8192 // 8KB // DefaultBufferLength is the default buffer length for subscriber chans DefaultBufferLength = 100 )
var ( // Version release version Version = "0.1.1" // Build will be overwritten automatically by the build system Build = "dev" // GitCommit will be overwritten automatically by the build system GitCommit = "HEAD" )
DefObjectives ...
FullVersion returns the full version, build and commit hash
type Client struct {
// contains filtered or unexported fields
}
Client ...
NewClient ...
Start ...
HandlerFunc ...
ListenerOptions ...
Listeners ...
func NewListeners(options *ListenerOptions) *Listeners
NewListeners ...
Add ...
Exists ...
Get ...
Length ...
NotifyAll ...
Remove ...
type Message struct { ID uint64 `json:"id"` Topic *Topic `json:"topic"` Payload []byte `json:"payload"` Created time.Time `json:"created"` }
Message ...
MessageBus ...
func New(options *Options) *MessageBus
New ...
func (mb *MessageBus) Get(t *Topic) (Message, bool)
Get ...
func (mb *MessageBus) Len() int
Len ...
func (mb *MessageBus) Metrics() *Metrics
Metrics ...
func (mb *MessageBus) NewMessage(topic *Topic, payload []byte) Message
NewMessage ...
func (mb *MessageBus) NewTopic(topic string) *Topic
NewTopic ...
func (mb *MessageBus) Put(message Message)
Put ...
func (mb *MessageBus) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (mb *MessageBus) Subscribe(id, topic string) chan Message
Subscribe ...
func (mb *MessageBus) Unsubscribe(id, topic string)
Unsubscribe ...
Metrics ...
NewMetrics ...
func (m *Metrics) Counter(subsystem, name string) prometheus.Counter
Counter ...
func (m *Metrics) CounterVec(subsystem, name string) *prometheus.CounterVec
CounterVec ...
func (m *Metrics) Gauge(subsystem, name string) prometheus.Gauge
Gauge ...
func (m *Metrics) GaugeVec(subsystem, name string) *prometheus.GaugeVec
GaugeVec ...
Handler ...
func (m *Metrics) NewCounter(subsystem, name, help string) prometheus.Counter
NewCounter ...
func (m *Metrics) NewCounterFunc(subsystem, name, help string, f func() float64) prometheus.CounterFunc
NewCounterFunc ...
func (m *Metrics) NewCounterVec(subsystem, name, help string, labels []string) *prometheus.CounterVec
NewCounterVec ...
func (m *Metrics) NewGauge(subsystem, name, help string) prometheus.Gauge
NewGauge ...
func (m *Metrics) NewGaugeFunc(subsystem, name, help string, f func() float64) prometheus.GaugeFunc
NewGaugeFunc ...
NewGaugeVec ...
func (m *Metrics) NewSummary(subsystem, name, help string) prometheus.Summary
NewSummary ...
func (m *Metrics) NewSummaryVec(subsystem, name, help string, labels []string) *prometheus.SummaryVec
NewSummaryVec ...
Run ...
func (m *Metrics) Summary(subsystem, name string) prometheus.Summary
Summary ...
func (m *Metrics) SummaryVec(subsystem, name string) *prometheus.SummaryVec
SummaryVec ...
Options ...
Queue represents a single instance of a bounded queue data structure with access to both side. If maxlen is non-zero the queue is bounded otherwise unbounded.
NewQueue creates a new instance of Queue with the provided maxlen
Empty returns true if the queue is empty false otherwise
Full returns true if the queue is full false otherwise
Len returns the number of elements currently stored in the queue.
MaxLen returns the maxlen of the queue
Peek returns the element at the front of the queue.
Pop removes and returns the element from the front of the queue.
Push appends an element to the back of the queue.
Size returns the current size of the queue
type Topic struct { Name string `json:"name"` Sequence uint64 `json:"seq"` Created time.Time `json:"created"` }
Topic ...
Path | Synopsis |
---|---|
client | |
examples |
Package msgbus imports 12 packages (graph) and is imported by 5 packages. Updated 2019-09-09. Refresh now. Tools for package owners.