Documentation ¶
Index ¶
- Constants
- func IsUnknownMessageType(err error) bool
- func NewSubscription(store store.SubscriptionStore, seqStore ChannelSequenceStore) subscription.Subscribe
- type Channel
- type ChannelSequenceStore
- type PermMask
- type Permission
- type PublishMessage
- type SubscribeWrap
- type SubscriberInfo
- type SubscriberOptions
Constants ¶
View Source
const ( // TypeNotify is the notification message type. TypeNotify // TypeMessage is the chat message type. TypeMessage // TypeSystem is the system message type. TypeSystem )
Variables ¶
This section is empty.
Functions ¶
func IsUnknownMessageType ¶
func NewSubscription ¶
func NewSubscription(store store.SubscriptionStore, seqStore ChannelSequenceStore) subscription.Subscribe
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func NewChannel ¶
func NewChannel(chanID subscription.ChanID, gate gate.Interface, store store.SubscriptionStore, seqStore ChannelSequenceStore) (*Channel, error)
func (*Channel) Subscribe ¶
func (g *Channel) Subscribe(id subscription.SubscriberID, extra interface{}) error
func (*Channel) Unsubscribe ¶
func (g *Channel) Unsubscribe(id subscription.SubscriberID) error
type ChannelSequenceStore ¶
type ChannelSequenceStore interface { // NextSegmentSequence return the next segment of specified channel, and segment length. NextSegmentSequence(id subscription.ChanID, info subscription.ChanInfo) (int64, int64, error) }
ChannelSequenceStore .
type Permission ¶
type Permission int64
const ( PermNone Permission = 0 PermRead Permission = 1 << MaskPermRead PermWrite Permission = 1 << MaskPermWrite PermAdmin Permission = 1 << MaskPermAdmin )
type PublishMessage ¶
type PublishMessage struct { From subscription.SubscriberID Seq int64 Type int Message *messages.GlideMessage }
PublishMessage is the message published to the group.
func (*PublishMessage) GetFrom ¶
func (p *PublishMessage) GetFrom() subscription.SubscriberID
type SubscribeWrap ¶
type SubscribeWrap interface { Subscribe(ch subscription.ChanID, id subscription.SubscriberID, extra interface{}) error UnSubscribe(ch subscription.ChanID, id subscription.SubscriberID) error UpdateSubscriber(ch subscription.ChanID, id subscription.SubscriberID, extra interface{}) error RemoveChannel(ch subscription.ChanID) error CreateChannel(ch subscription.ChanID, update *subscription.ChanInfo) error UpdateChannel(ch subscription.ChanID, update *subscription.ChanInfo) error Publish(ch subscription.ChanID, msg subscription.Message) error }
SubscribeWrap the wrapper for subscription.Subscribe implementation, for convenience.
func NewSubscribeWrap ¶
func NewSubscribeWrap(subscribe subscription.Subscribe) SubscribeWrap
type SubscriberInfo ¶
type SubscriberInfo struct {
Perm Permission
}
func NewSubscriberInfo ¶
func NewSubscriberInfo(so *SubscriberOptions) *SubscriberInfo
type SubscriberOptions ¶
type SubscriberOptions struct {
Perm Permission
}
SubscriberOptions is the options for the subscriber
Click to show internal directories.
Click to hide internal directories.