Documentation ¶
Index ¶
- type EDUCache
- func (t *EDUCache) AddSendToDeviceMessage() int64
- func (t *EDUCache) AddTypingUser(userID, roomID string, expire *time.Time) int64
- func (t *EDUCache) GetLatestSyncPosition() int64
- func (t *EDUCache) GetTypingUsers(roomID string) []string
- func (t *EDUCache) GetTypingUsersIfUpdatedAfter(roomID string, position int64) (users []string, updated bool)
- func (t *EDUCache) RemoveUser(userID, roomID string) int64
- func (t *EDUCache) SetTimeoutCallback(fn TimeoutCallbackFn)
- type TimeoutCallbackFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EDUCache ¶
EDUCache maintains a list of users typing in each room.
func (*EDUCache) AddSendToDeviceMessage ¶
AddSendToDeviceMessage increases the sync position for send-to-device updates. Returns the sync position before update, as the caller will use this to record the current stream position at the time that the send-to-device message was sent.
func (*EDUCache) AddTypingUser ¶
AddTypingUser sets an user as typing in a room. expire is the time when the user typing should time out. if expire is nil, defaultTypingTimeout is assumed. Returns the latest sync position for typing after update.
func (*EDUCache) GetLatestSyncPosition ¶
func (*EDUCache) GetTypingUsers ¶
GetTypingUsers returns the list of users typing in a room.
func (*EDUCache) GetTypingUsersIfUpdatedAfter ¶
func (t *EDUCache) GetTypingUsersIfUpdatedAfter( roomID string, position int64, ) (users []string, updated bool)
GetTypingUsersIfUpdatedAfter returns all users typing in this room with updated == true if the typing sync position of the room is after the given position. Otherwise, returns an empty slice with updated == false.
func (*EDUCache) RemoveUser ¶
RemoveUser with mutex lock & stop the timer. Returns the latest sync position for typing after update.
func (*EDUCache) SetTimeoutCallback ¶
func (t *EDUCache) SetTimeoutCallback(fn TimeoutCallbackFn)
SetTimeoutCallback sets a callback function that is called right after a user is removed from the typing user list due to timeout.
type TimeoutCallbackFn ¶
TimeoutCallbackFn is a function called right after the removal of a user from the typing user list due to timeout. latestSyncPosition is the typing sync position after the removal.