Documentation ¶
Index ¶
- Constants
- Variables
- func GetPrivateIP() (net.IP, error)
- func NewReliableStorage(s Storage) *reliableStorage
- func RandomID() string
- func RandomIV(size int) []byte
- func RandomKey(size int) []byte
- func RandomMailbox() string
- func XORBytes(dst, a, b []byte) int
- type Abandon
- type AckMessage
- type Acker
- type Byter
- type Client
- func (c *Client) Abandon(name string) error
- func (c *Client) Close() (err error)
- func (c *Client) Declare(name string) error
- func (c *Client) EphemeralDeclare(name string) error
- func (c *Client) LongPoll(name string, til time.Duration) (*Delivery, error)
- func (c *Client) LongPollCancelable(name string, til time.Duration, done chan struct{}) (*Delivery, error)
- func (c *Client) Poll(name string) (*Delivery, error)
- func (c *Client) Push(name string, body *Message) error
- func (c *Client) Session() (*yamux.Session, error)
- func (c *Client) Stats() (*ClientStats, error)
- type ClientStats
- type Declare
- type Delivery
- type Error
- type FeatureClient
- func (fc *FeatureClient) Clone() *FeatureClient
- func (fc *FeatureClient) ConnectPipe(name string) (*PipeConn, error)
- func (fc *FeatureClient) Declare(name string) error
- func (fc *FeatureClient) HandleRequests(name string, h Handler) error
- func (fc *FeatureClient) ListenPipe(name string) (*PipeConn, error)
- func (fc *FeatureClient) LocalMailbox() string
- func (fc *FeatureClient) Receive(name string) *Receiver
- func (fc *FeatureClient) Request(name string, msg *Message) (*Delivery, error)
- type HTTPService
- type Handler
- type LongPoll
- type Mailbox
- type MailboxStats
- type MemMailbox
- func (mm *MemMailbox) Abandon() error
- func (mm *MemMailbox) Ack(id MessageId) error
- func (mm *MemMailbox) AddWatcher() <-chan *Message
- func (mm *MemMailbox) AddWatcherCancelable(done chan struct{}) <-chan *Message
- func (mm *MemMailbox) Nack(id MessageId) error
- func (mm *MemMailbox) Poll() (*Message, error)
- func (mm *MemMailbox) Push(value *Message) error
- func (mm *MemMailbox) Stats() *MailboxStats
- type MemRouteTable
- type Message
- type MessageId
- type MessageType
- type MultiPusher
- type NackMessage
- type Nacker
- type PipeConn
- func (p *PipeConn) Close() error
- func (p *PipeConn) LocalAddr() net.Addr
- func (p *PipeConn) Read(b []byte) (int, error)
- func (p *PipeConn) RemoteAddr() net.Addr
- func (p *PipeConn) SendBulk(data io.Reader) (int64, error)
- func (p *PipeConn) SetDeadline(t time.Time) error
- func (p *PipeConn) SetReadDeadline(t time.Time) error
- func (p *PipeConn) SetWriteDeadline(t time.Time) error
- func (p *PipeConn) Write(b []byte) (int, error)
- type Poll
- type PollResult
- type Push
- type Pusher
- type Receiver
- type Registry
- func (r *Registry) Abandon(name string) error
- func (r *Registry) Declare(name string) error
- func (r *Registry) LongPoll(name string, til time.Duration) (*Delivery, error)
- func (r *Registry) LongPollCancelable(name string, til time.Duration, done chan struct{}) (*Delivery, error)
- func (r *Registry) Poll(name string) (*Delivery, error)
- func (r *Registry) Push(name string, value *Message) error
- type RouteTable
- type Router
- type Service
- type Storage
- type Subscription
Constants ¶
View Source
const DefaultPort = 8475
Variables ¶
View Source
var DefaultHTTPPort = 8477
View Source
var ENoMailbox = errors.New("No such mailbox available")
View Source
var EProtocolError = errors.New("protocol error")
View Source
var ETimeout = errors.New("operation timeout")
View Source
var EUnknownMessage = errors.New("Unknown message id")
View Source
var ErrUknownSystemMailbox = errors.New("unknown system mailbox")
View Source
var NullStorage = &nullStorage{}
Functions ¶
func GetPrivateIP ¶
GetPrivateIP is used to return the first private IP address associated with an interface on the machine
func NewReliableStorage ¶
func NewReliableStorage(s Storage) *reliableStorage
func RandomMailbox ¶
func RandomMailbox() string
Types ¶
type AckMessage ¶
type AckMessage struct {
MessageId MessageId
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewInsecureClient ¶
func (*Client) EphemeralDeclare ¶
func (*Client) LongPollCancelable ¶
func (*Client) Stats ¶
func (c *Client) Stats() (*ClientStats, error)
type ClientStats ¶
type ClientStats struct {
InFlight int
}
type Delivery ¶
func NewDelivery ¶
type FeatureClient ¶
type FeatureClient struct { *Client // contains filtered or unexported fields }
Wraps Client to provide highlevel behaviors that build on the basics of the distributed mailboxes. Should only be used by one goroutine at a time.
func Dial ¶
func Dial(addr string) (*FeatureClient, error)
func Local ¶
func Local() (*FeatureClient, error)
func NewFeatureClient ¶
func NewFeatureClient(c *Client) *FeatureClient
Create a new FeatureClient wrapping a explicit Client
func (*FeatureClient) Clone ¶
func (fc *FeatureClient) Clone() *FeatureClient
Create a new FeatureClient that wraps the same Client as this one. Useful for creating a new instance to use in a new goroutine
func (*FeatureClient) ConnectPipe ¶
func (fc *FeatureClient) ConnectPipe(name string) (*PipeConn, error)
func (*FeatureClient) Declare ¶
func (fc *FeatureClient) Declare(name string) error
func (*FeatureClient) HandleRequests ¶
func (fc *FeatureClient) HandleRequests(name string, h Handler) error
func (*FeatureClient) ListenPipe ¶
func (fc *FeatureClient) ListenPipe(name string) (*PipeConn, error)
func (*FeatureClient) LocalMailbox ¶
func (fc *FeatureClient) LocalMailbox() string
Return the name of a ephemeral mailbox only for this instance
func (*FeatureClient) Receive ¶
func (fc *FeatureClient) Receive(name string) *Receiver
type HTTPService ¶
type HTTPService struct { Address string Registry Storage // contains filtered or unexported fields }
func NewHTTPService ¶
func NewHTTPService(port string, reg Storage) *HTTPService
func (*HTTPService) Accept ¶
func (h *HTTPService) Accept() error
func (*HTTPService) BackgroundTimeouts ¶
func (h *HTTPService) BackgroundTimeouts()
func (*HTTPService) CheckTimeouts ¶
func (h *HTTPService) CheckTimeouts()
func (*HTTPService) Close ¶
func (h *HTTPService) Close()
func (*HTTPService) Listen ¶
func (h *HTTPService) Listen() error
type Handler ¶
func HandlerFunc ¶
type Mailbox ¶
type Mailbox interface { Abandon() error Push(*Message) error Poll() (*Message, error) Ack(MessageId) error Nack(MessageId) error AddWatcher() <-chan *Message AddWatcherCancelable(chan struct{}) <-chan *Message Stats() *MailboxStats }
func NewMemMailbox ¶
type MailboxStats ¶
type MemMailbox ¶
type MemMailbox struct {
// contains filtered or unexported fields
}
func (*MemMailbox) Abandon ¶
func (mm *MemMailbox) Abandon() error
func (*MemMailbox) Ack ¶
func (mm *MemMailbox) Ack(id MessageId) error
func (*MemMailbox) AddWatcher ¶
func (mm *MemMailbox) AddWatcher() <-chan *Message
func (*MemMailbox) AddWatcherCancelable ¶
func (mm *MemMailbox) AddWatcherCancelable(done chan struct{}) <-chan *Message
func (*MemMailbox) Nack ¶
func (mm *MemMailbox) Nack(id MessageId) error
func (*MemMailbox) Poll ¶
func (mm *MemMailbox) Poll() (*Message, error)
func (*MemMailbox) Push ¶
func (mm *MemMailbox) Push(value *Message) error
func (*MemMailbox) Stats ¶
func (mm *MemMailbox) Stats() *MailboxStats
type MemRouteTable ¶
func (MemRouteTable) Remove ¶
func (ht MemRouteTable) Remove(name string) error
type Message ¶
type Message struct { // Simple generic headers available to be used by the application Headers map[string]interface{} `codec:"headers,omitempty" json:"headers,omitempty"` // Properties ContentType string `codec:"content_type,omitempty" json:"content_type,omitempty"` // MIME content type ContentEncoding string `codec:"content_encoding,omitempty" json:"content_encoding,omitempty"` // MIME content encoding Priority uint8 `codec:"priority,omitempty" json:"priority,omitempty"` // 0 to 9 CorrelationId string `codec:"correlation_id,omitempty" json:"correlation_id,omitempty"` // correlation identifier ReplyTo string `codec:"reply_to,omitempty" json:"reply_to,omitempty"` // address to to reply to MessageId MessageId `codec:"message_id,omitempty" json:"message_id,omitempty"` // message identifier Timestamp *time.Time `codec:"timestamp,omitempty" json:"timestamp,omitempty"` // message timestamp Type string `codec:"type,omitempty" json:"type,omitempty"` // message type name UserId string `codec:"user_id,omitempty" json:"user_id,omitempty"` // creating user id AppId string `codec:"app_id,omitempty" json:"app_id,omitempty"` // creating application id Body []byte `codec:"body,omitempty" json:"body,omitempty"` }
func DecodeMessage ¶
type MessageId ¶
type MessageId string
func NextMessageID ¶
func NextMessageID() MessageId
func (MessageId) AppendLocalIndex ¶
func (MessageId) LocalIndex ¶
type MessageType ¶
type MessageType int
const ( NoopType MessageType = iota SuccessType ErrorType DeclareType EphemeralDeclareType AbandonType PollType PollResultType LongPollType PushType CloseType NackType AckType StatsType StatsResultType )
type MultiPusher ¶
type MultiPusher struct {
Pushers []Pusher
}
func NewMultiPusher ¶
func NewMultiPusher() *MultiPusher
func (*MultiPusher) Add ¶
func (mp *MultiPusher) Add(p Pusher)
type NackMessage ¶
type NackMessage struct {
MessageId MessageId
}
type PipeConn ¶
type PipeConn struct {
// contains filtered or unexported fields
}
func (*PipeConn) RemoteAddr ¶
type PollResult ¶
type PollResult struct {
Message *Message
}
type Receiver ¶
type Registry ¶
func NewMemRegistry ¶
func NewMemRegistry() *Registry
func NewRegistry ¶
func (*Registry) LongPollCancelable ¶
type RouteTable ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(rt RouteTable) *Router
type Subscription ¶
func ParseSubscription ¶
func ParseSubscription(pattern string) *Subscription
func (*Subscription) Match ¶
func (s *Subscription) Match(lit string) bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.