Documentation ¶
Index ¶
- Constants
- Variables
- func Barrier()
- func DumpMsg(prefix string, msg [][]byte)
- func InsertEnvelope(msg [][]byte, e *Envelope) ([][]byte, error)
- func InsertLeadingDelimeter(msg [][]byte) [][]byte
- func NewHalfPair(c *zmq.Context, bind bool) (*zmq.Socket, string, error)
- func NewPair(c *zmq.Context) (a *zmq.Socket, b *zmq.Socket, err error)
- func NewPeerEntries() peerEntries
- func NewServerEntries() serverEntries
- func NewSocketAndAddress(c *zmq.Context, bind bool, t zmq.Type, name string) (a *zmq.Socket, addr string, err error)
- type AttributeFilter
- type ComparableEnvelope
- func (ce *ComparableEnvelope) Compare(than *ComparableEnvelope) int
- func (ce *ComparableEnvelope) EnsureSortOrder()
- func (ce *ComparableEnvelope) Equal(than *ComparableEnvelope) bool
- func (ce *ComparableEnvelope) Invalidate()
- func (ce *ComparableEnvelope) Less(than *ComparableEnvelope) bool
- func (ce *ComparableEnvelope) MakeSortOrder()
- type Envelope
- func DecodeEnvelope(data []byte) (*Envelope, error)
- func FindEnvelope(msg [][]byte) (*Envelope, int, error)
- func NewEndpointEnvelope(serviceType, serviceId, shardId string) *Envelope
- func NewEnvelopeFromMsg(msg [][]byte, filter *AttributeFilter) (*Envelope, error)
- func RemoveEnvelope(msg [][]byte) ([][]byte, *Envelope, error)
- type Peer
- type PeerDefinition
- type PeerImpl
- type PeerType
- type RouterElement
- func (re *RouterElement) AddPeer(def PeerDefinition) error
- func (re *RouterElement) Close()
- func (re *RouterElement) DeleteAll() error
- func (re *RouterElement) DeleteAllType(peerType PeerType) error
- func (re *RouterElement) DeletePeer(name string) error
- func (re *RouterElement) GetPeer(name string) (*Peer, bool)
- func (re *RouterElement) ReplacePeers(peerType PeerType, defs []PeerDefinition) error
- type ServerEntry
- type ServiceDispatcher
- type ServiceDispatcherPeerImpl
- type ServiceLookupKey
- type ServiceRouter
- func (sr *ServiceRouter) AddService(re *RouterElement, peerName string, e *Envelope) error
- func (sr *ServiceRouter) DeleteAllPeerEntries(re *RouterElement, peerName string) error
- func (sr *ServiceRouter) DeleteService(re *RouterElement, peerName string, e *Envelope) error
- func (sr *ServiceRouter) DeleteServiceStrings(re *RouterElement, peerName string, ...) error
- func (sr *ServiceRouter) GetServerEntry(serviceType, serviceId, shardId string) *ServerEntry
- func (sr *ServiceRouter) LenPeerEntries(re *RouterElement, peerName string) int
- func (sr *ServiceRouter) Validate() error
Constants ¶
View Source
const ( EA_REQUESTID = "ri" // unique ID of the request EA_ORIGINATORID = "oi" // oi - originator ID EA_SERVICETYPE = "st" // hash(com.extl.blah) EA_SERVICEID = "si" // instance of service (e.g. multiple clusters) EA_SHARDID = "sh" // Thing to hash on (empty = random) EA_SERVERID = "se" // se - ID of particular server EA_ENDPOINTID = "ep" // ID of a thread (multiple threads on same endpoint) )
View Source
const ( CM_ADD = iota CM_DELETE = iota CM_REPLACEALL = iota CM_DELETEALL = iota )
View Source
const ( PT_CLIENTSNOENV = "clientsnoenv" // a BIND peer expecting clients to connect and not provide an envelope PT_CLIENTSENV = "clientsenv" // a BIND peer expecting clients to connect and provide an envelope PT_DOWNSTREAMENV = "downstreamenv" PT_DOWNSTREAMENVREP = "downstreamenvrep" )
View Source
const (
EN_VERSION = 0 // for serialization future compatibility
)
Variables ¶
View Source
var ClientAttributeFilter = &AttributeFilter{ Compulsory: map[string]bool{ EA_ORIGINATORID: false, EA_SERVICETYPE: true, EA_SERVICEID: false, EA_SHARDID: false, }, }
View Source
var DispatcherAttributeFilter = &AttributeFilter{ Compulsory: map[string]bool{ EA_SERVICETYPE: true, EA_SERVICEID: true, EA_SHARDID: false, }, }
View Source
var EndpointAttributeFilter = &AttributeFilter{ Compulsory: map[string]bool{ EA_SERVICETYPE: true, EA_SERVICEID: true, EA_SHARDID: false, }, }
Functions ¶
func InsertLeadingDelimeter ¶
func NewPeerEntries ¶
func NewPeerEntries() peerEntries
func NewServerEntries ¶
func NewServerEntries() serverEntries
Types ¶
type AttributeFilter ¶
type ComparableEnvelope ¶
type ComparableEnvelope struct { Envelope // contains filtered or unexported fields }
func (*ComparableEnvelope) Compare ¶
func (ce *ComparableEnvelope) Compare(than *ComparableEnvelope) int
func (*ComparableEnvelope) EnsureSortOrder ¶
func (ce *ComparableEnvelope) EnsureSortOrder()
func (*ComparableEnvelope) Equal ¶
func (ce *ComparableEnvelope) Equal(than *ComparableEnvelope) bool
func (*ComparableEnvelope) Invalidate ¶
func (ce *ComparableEnvelope) Invalidate()
func (*ComparableEnvelope) Less ¶
func (ce *ComparableEnvelope) Less(than *ComparableEnvelope) bool
func (*ComparableEnvelope) MakeSortOrder ¶
func (ce *ComparableEnvelope) MakeSortOrder()
type Envelope ¶
type Envelope struct { Version int `json:"v"` // version of encoded header Attributes map[string]string `json:"a"` // attributes }
func DecodeEnvelope ¶
func NewEndpointEnvelope ¶
func NewEnvelopeFromMsg ¶
func NewEnvelopeFromMsg(msg [][]byte, filter *AttributeFilter) (*Envelope, error)
func (*Envelope) Validate ¶
func (e *Envelope) Validate(filter *AttributeFilter) error
type Peer ¶
type Peer struct { PeerDefinition // contains filtered or unexported fields }
type PeerDefinition ¶
func (*PeerDefinition) Equals ¶
func (a *PeerDefinition) Equals(b *PeerDefinition) bool
type PeerImpl ¶
type PeerImpl interface { GetType() PeerType PreDelete(re *RouterElement, peer *Peer) PostCreate(re *RouterElement, peer *Peer) }
type RouterElement ¶
type RouterElement struct {
// contains filtered or unexported fields
}
func NewRouterElement ¶
func (*RouterElement) AddPeer ¶
func (re *RouterElement) AddPeer(def PeerDefinition) error
func (*RouterElement) Close ¶
func (re *RouterElement) Close()
func (*RouterElement) DeleteAll ¶
func (re *RouterElement) DeleteAll() error
func (*RouterElement) DeleteAllType ¶
func (re *RouterElement) DeleteAllType(peerType PeerType) error
func (*RouterElement) DeletePeer ¶
func (re *RouterElement) DeletePeer(name string) error
func (*RouterElement) ReplacePeers ¶
func (re *RouterElement) ReplacePeers(peerType PeerType, defs []PeerDefinition) error
type ServerEntry ¶
type ServerEntry struct { Peer *Peer Slk ServiceLookupKey ServerId string ShardId string Priority int64 }
type ServiceDispatcher ¶
type ServiceDispatcher struct { EnvRouterPeer string NoEnvRouterPeer string ServiceRouter *RouterElement // contains filtered or unexported fields }
func NewServiceDispatcher ¶
func NewServiceDispatcher(context *zmq.Context, bufferSize int) (*ServiceDispatcher, error)
func (*ServiceDispatcher) AddPeer ¶
func (sd *ServiceDispatcher) AddPeer(def PeerDefinition, peerType PeerType) error
func (*ServiceDispatcher) NewServiceDispatcherPeerImpl ¶
func (sd *ServiceDispatcher) NewServiceDispatcherPeerImpl(peerType PeerType) *ServiceDispatcherPeerImpl
type ServiceDispatcherPeerImpl ¶
type ServiceDispatcherPeerImpl struct { PeerType PeerType // contains filtered or unexported fields }
func (*ServiceDispatcherPeerImpl) GetType ¶
func (m *ServiceDispatcherPeerImpl) GetType() PeerType
func (*ServiceDispatcherPeerImpl) PostCreate ¶
func (m *ServiceDispatcherPeerImpl) PostCreate(re *RouterElement, peer *Peer)
func (*ServiceDispatcherPeerImpl) PreDelete ¶
func (m *ServiceDispatcherPeerImpl) PreDelete(re *RouterElement, peer *Peer)
type ServiceLookupKey ¶
type ServiceRouter ¶
type ServiceRouter struct {
// contains filtered or unexported fields
}
func NewServiceRouter ¶
func NewServiceRouter() ServiceRouter
func (*ServiceRouter) AddService ¶
func (sr *ServiceRouter) AddService(re *RouterElement, peerName string, e *Envelope) error
func (*ServiceRouter) DeleteAllPeerEntries ¶
func (sr *ServiceRouter) DeleteAllPeerEntries(re *RouterElement, peerName string) error
func (*ServiceRouter) DeleteService ¶
func (sr *ServiceRouter) DeleteService(re *RouterElement, peerName string, e *Envelope) error
func (*ServiceRouter) DeleteServiceStrings ¶
func (sr *ServiceRouter) DeleteServiceStrings(re *RouterElement, peerName string, serviceType, serviceId, serverId, shardId string) error
func (*ServiceRouter) GetServerEntry ¶
func (sr *ServiceRouter) GetServerEntry(serviceType, serviceId, shardId string) *ServerEntry
func (*ServiceRouter) LenPeerEntries ¶
func (sr *ServiceRouter) LenPeerEntries(re *RouterElement, peerName string) int
func (*ServiceRouter) Validate ¶
func (sr *ServiceRouter) Validate() error
Click to show internal directories.
Click to hide internal directories.