Documentation ¶
Overview ¶
Package innerpresence provides the implementation of Presence. If the client is watching a document, the presence is shared with all other clients watching the same document.
Index ¶
- type Map
- func (m *Map) DeepCopy() *Map
- func (m *Map) Delete(clientID string)
- func (m *Map) Has(clientID string) bool
- func (m *Map) Load(clientID string) Presence
- func (m *Map) LoadOrStore(clientID string, presence Presence) Presence
- func (m *Map) Range(f func(clientID string, presence Presence) bool)
- func (m *Map) Store(clientID string, presence Presence)
- type Presence
- type PresenceChange
- type PresenceChangeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a map of Presence. It is wrapper of sync.Map to use type-safe.
func (*Map) LoadOrStore ¶
LoadOrStore returns the existing presence if exists. Otherwise, it stores and returns the given presence.
type PresenceChange ¶
type PresenceChange struct { ChangeType PresenceChangeType `json:"changeType"` Presence Presence `json:"presence"` }
PresenceChange represents the change of presence.
func NewChangeFromJSON ¶
func NewChangeFromJSON(encodedChange string) (*PresenceChange, error)
NewChangeFromJSON creates a new instance of PresenceChange from JSON.
type PresenceChangeType ¶
type PresenceChangeType string
PresenceChangeType represents the type of presence change.
const ( // Put represents the presence is put. Put PresenceChangeType = "put" // Clear represents the presence is cleared. Clear PresenceChangeType = "clear" )
Click to show internal directories.
Click to hide internal directories.