Documentation
¶
Index ¶
- func Marshal(message *Message) []byte
- type Client
- type ClientAtomicMap
- type ClientSet
- func (set ClientSet) Add(i *Client) bool
- func (set ClientSet) Cardinality() int
- func (set *ClientSet) Clear()
- func (set ClientSet) Clone() ClientSet
- func (set ClientSet) Contains(i *Client) bool
- func (set ClientSet) ContainsAll(i ...*Client) bool
- func (set ClientSet) Difference(other ClientSet) ClientSet
- func (set ClientSet) Equal(other ClientSet) bool
- func (set ClientSet) Intersect(other ClientSet) ClientSet
- func (set ClientSet) IsSubset(other ClientSet) bool
- func (set ClientSet) IsSuperset(other ClientSet) bool
- func (set ClientSet) Iter() <-chan *Client
- func (set ClientSet) Remove(i *Client)
- func (set ClientSet) SymmetricDifference(other ClientSet) ClientSet
- func (set ClientSet) ToSlice() []*Client
- func (set ClientSet) Union(other ClientSet) ClientSet
- type ClientSetAtomicMap
- type HandlerFunc
- type HandlerFuncAtomicMap
- func (am *HandlerFuncAtomicMap) Delete(key string)
- func (am *HandlerFuncAtomicMap) Get(key string) (value HandlerFunc, ok bool)
- func (am *HandlerFuncAtomicMap) GetAll() map[string]HandlerFunc
- func (am *HandlerFuncAtomicMap) Len() int
- func (am *HandlerFuncAtomicMap) Set(key string, value HandlerFunc)
- type Message
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { Conn *websocket.Conn Outbox chan []byte IsTrusted bool Quit chan bool GUID string UID string Header textproto.MIMEHeader }
Client is used by the MM server to hold information about client connections from trusted service providers and untrusted clients. +gen * set
type ClientAtomicMap ¶
type ClientAtomicMap struct {
// contains filtered or unexported fields
}
ClientAtomicMap is a copy-on-write thread-safe map of pointers to Client
func NewClientAtomicMap ¶
func NewClientAtomicMap() *ClientAtomicMap
NewClientAtomicMap returns a new initialized ClientAtomicMap
func (*ClientAtomicMap) Delete ¶
func (am *ClientAtomicMap) Delete(key string)
Delete removes the pointer to Client under key from the map
func (*ClientAtomicMap) Get ¶
func (am *ClientAtomicMap) Get(key string) (value *Client, ok bool)
Get returns a pointer to Client for a given key
func (*ClientAtomicMap) GetAll ¶
func (am *ClientAtomicMap) GetAll() map[string]*Client
GetAll returns the underlying map of pointers to Client this map must NOT be modified, to change the map safely use the Set and Delete functions and Get the value again
func (*ClientAtomicMap) Len ¶
func (am *ClientAtomicMap) Len() int
Len returns the number of elements in the map
func (*ClientAtomicMap) Set ¶
func (am *ClientAtomicMap) Set(key string, value *Client)
Set inserts in the map a pointer to Client under a given key
type ClientSet ¶
type ClientSet map[*Client]struct{}
ClientSet is the primary type that represents a set
func NewClientSet ¶
NewClientSet creates and returns a reference to an empty set.
func (ClientSet) Cardinality ¶
Cardinality returns how many items are currently in the set.
func (*ClientSet) Clear ¶
func (set *ClientSet) Clear()
Clear clears the entire set to be the empty set.
func (ClientSet) ContainsAll ¶
ContainsAll determines if the given items are all in the set
func (ClientSet) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (ClientSet) Equal ¶
Equal determines if two sets are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (ClientSet) IsSuperset ¶
IsSuperset determines if every item of this set is in the other set.
func (ClientSet) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
type ClientSetAtomicMap ¶
type ClientSetAtomicMap struct {
// contains filtered or unexported fields
}
ClientSetAtomicMap is a copy-on-write thread-safe map of ClientSet
func NewClientSetAtomicMap ¶
func NewClientSetAtomicMap() *ClientSetAtomicMap
NewClientSetAtomicMap returns a new initialized ClientSetAtomicMap
func (*ClientSetAtomicMap) Delete ¶
func (am *ClientSetAtomicMap) Delete(key string)
Delete removes the ClientSet under key from the map
func (*ClientSetAtomicMap) Get ¶
func (am *ClientSetAtomicMap) Get(key string) (value ClientSet, ok bool)
Get returns a ClientSet for a given key
func (*ClientSetAtomicMap) GetAll ¶
func (am *ClientSetAtomicMap) GetAll() map[string]ClientSet
GetAll returns the underlying map of ClientSet this map must NOT be modified, to change the map safely use the Set and Delete functions and Get the value again
func (*ClientSetAtomicMap) Len ¶
func (am *ClientSetAtomicMap) Len() int
Len returns the number of elements in the map
func (*ClientSetAtomicMap) Set ¶
func (am *ClientSetAtomicMap) Set(key string, value ClientSet)
Set inserts in the map a ClientSet under a given key
type HandlerFuncAtomicMap ¶
type HandlerFuncAtomicMap struct {
// contains filtered or unexported fields
}
HandlerFuncAtomicMap is a copy-on-write thread-safe map of HandlerFunc
func NewHandlerFuncAtomicMap ¶
func NewHandlerFuncAtomicMap() *HandlerFuncAtomicMap
NewHandlerFuncAtomicMap returns a new initialized HandlerFuncAtomicMap
func (*HandlerFuncAtomicMap) Delete ¶
func (am *HandlerFuncAtomicMap) Delete(key string)
Delete removes the HandlerFunc under key from the map
func (*HandlerFuncAtomicMap) Get ¶
func (am *HandlerFuncAtomicMap) Get(key string) (value HandlerFunc, ok bool)
Get returns a HandlerFunc for a given key
func (*HandlerFuncAtomicMap) GetAll ¶
func (am *HandlerFuncAtomicMap) GetAll() map[string]HandlerFunc
GetAll returns the underlying map of HandlerFunc this map must NOT be modified, to change the map safely use the Set and Delete functions and Get the value again
func (*HandlerFuncAtomicMap) Len ¶
func (am *HandlerFuncAtomicMap) Len() int
Len returns the number of elements in the map
func (*HandlerFuncAtomicMap) Set ¶
func (am *HandlerFuncAtomicMap) Set(key string, value HandlerFunc)
Set inserts in the map a HandlerFunc under a given key
type Message ¶
type Message struct { Cmd string Key string Header textproto.MIMEHeader Body []byte Client *Client }
Message represents the protocol used for MM communication over the websocket.
type Service ¶
type Service struct { Closed chan bool // contains filtered or unexported fields }
Service is the connection from a service provider to the MM server.
func NewService ¶
NewService creates a connection to an MM server using a websocket URL, eg ws://localhost:8765/
func (Service) RegisterPubHandler ¶
func (mmc Service) RegisterPubHandler(key string, fn HandlerFunc)
Register a HandlerFunc to be called when PUB is received.
func (Service) RegisterReqHandler ¶
func (mmc Service) RegisterReqHandler(key string, fn HandlerFunc)
Register a HandlerFunc to be called when REQ is received.