Documentation ¶
Index ¶
- type MorpheusStore
- type MorpheusSyncer
- func (s *MorpheusSyncer) GetFilterJSON(userID string) json.RawMessage
- func (s *MorpheusSyncer) OnEventType(eventType string, callback OnEventListener)
- func (s *MorpheusSyncer) OnFailedSync(res *gomatrix.RespSync, err error) (time.Duration, error)
- func (s *MorpheusSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (err error)
- type OnEventListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MorpheusStore ¶
type MorpheusStore struct { gomatrix.InMemoryStore CacheDatabase db.Storer }
MorpheusStore implements the gomatrix.Storer interface.
It persists the next batch token in the database, and includes a ClientConfig for the client.
func (*MorpheusStore) LoadNextBatch ¶
func (m *MorpheusStore) LoadNextBatch(userID string) string
LoadNextBatch loads from the database.
func (*MorpheusStore) SaveNextBatch ¶
func (m *MorpheusStore) SaveNextBatch(userID, nextBatch string)
SaveNextBatch saves to the database.
type MorpheusSyncer ¶
type MorpheusSyncer struct { UserID string Store gomatrix.Storer // contains filtered or unexported fields }
func NewMorpheusSyncer ¶
func NewMorpheusSyncer(userID string, store gomatrix.Storer) *MorpheusSyncer
NewMorpheusSyncer returns an instantiated MorpheusSyncer
func (*MorpheusSyncer) GetFilterJSON ¶
func (s *MorpheusSyncer) GetFilterJSON(userID string) json.RawMessage
GetFilterJSON returns a filter with a timeline limit of 50.
func (*MorpheusSyncer) OnEventType ¶
func (s *MorpheusSyncer) OnEventType(eventType string, callback OnEventListener)
OnEventType allows callers to be notified when there are new events for the given event type. There are no duplicate checks.
func (*MorpheusSyncer) OnFailedSync ¶
OnFailedSync always returns a 10 second wait period between failed /syncs, never a fatal error.
func (*MorpheusSyncer) ProcessResponse ¶
func (s *MorpheusSyncer) ProcessResponse(res *gomatrix.RespSync, since string) (err error)
ProcessResponse processes the /sync response in a way suitable for bots. "Suitable for bots" means a stream of unrepeating events. Returns a fatal error if a listener panics.
type OnEventListener ¶
OnEventListener can be used with DefaultSyncer.OnEventType to be informed of incoming events.