Documentation ¶
Index ¶
- Constants
- func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)
- type Database
- func (d *Database) DeleteDeviceStdMessage(ctx context.Context, targetUID, targetDevice string) error
- func (d *Database) DeleteMacStdMessage(ctx context.Context, identifier, targetUID, targetDevice string) error
- func (d *Database) DeleteStdMessage(ctx context.Context, id int64, targetUID, targetDevice string) error
- func (d *Database) Events(ctx context.Context, eventIDs []string) ([]gomatrixserverlib.ClientEvent, error)
- func (d *Database) GetAllSyncRooms() ([]string, error)
- func (d *Database) GetDB() *sql.DB
- func (d *Database) GetEventRaw(ctx context.Context, eventID string) (int64, []byte, error)
- func (d *Database) GetFriendShip(ctx context.Context, roomIDs []string) ([]string, error)
- func (d *Database) GetHistoryClientDataStream(ctx context.Context, userID string, limit int) (streams []types.ActDataStreamUpdate, offset []int64, err error)
- func (d *Database) GetHistoryEvents(ctx context.Context, roomid string, limit int) (events []gomatrixserverlib.ClientEvent, offsets []int64, err error)
- func (d *Database) GetHistoryKeyChangeStream(ctx context.Context, users []string) (streams []types.KeyChangeStream, offset []int64, err error)
- func (d *Database) GetHistoryPresenceDataStream(ctx context.Context, limit, offset int) ([]types.PresenceStream, []int64, error)
- func (d *Database) GetHistoryReceiptDataStream(ctx context.Context, roomID string) (streams []types.ReceiptStream, offset []int64, err error)
- func (d *Database) GetHistoryStdStream(ctx context.Context, targetUserID, targetDeviceID string, limit int64) ([]types.StdEvent, []int64, error)
- func (d *Database) GetInviteRidsForUser(ctx context.Context, userID string) ([]string, []int64, []string, error)
- func (d *Database) GetJoinRoomOffsets(ctx context.Context, eventIDs []string) ([]int64, []string, []string, error)
- func (d *Database) GetLeaveRidsForUser(ctx context.Context, userID string) ([]string, []int64, []string, error)
- func (d *Database) GetMsgEventsByRoomIDMigration(ctx context.Context, roomID string) ([]int64, []string, [][]byte, error)
- func (d *Database) GetRidsForUser(ctx context.Context, userID string) ([]string, []int64, []string, error)
- func (d *Database) GetRoomLastOffsets(ctx context.Context, roomIDs []string) (map[string]int64, error)
- func (d *Database) GetRoomReceiptLastOffsets(ctx context.Context, roomIDs []string) (map[string]int64, error)
- func (d *Database) GetRoomStateByEventID(ctx context.Context, eventID string) ([]byte, error)
- func (d *Database) GetRoomStateTotal(ctx context.Context) (int, error)
- func (d *Database) GetRoomStateWithLimit(ctx context.Context, limit, offset int64) ([]string, [][]byte, error)
- func (d *Database) GetStateEventsForRoom(ctx context.Context, roomID string) ([]gomatrixserverlib.ClientEvent, []int64, error)
- func (d *Database) GetStateEventsStreamForRoom(ctx context.Context, roomID string) ([]gomatrixserverlib.ClientEvent, []int64, error)
- func (d *Database) GetStateEventsStreamForRoomBeforePos(ctx context.Context, roomID string, pos int64) ([]gomatrixserverlib.ClientEvent, []int64, error)
- func (d *Database) GetSyncEvents(ctx context.Context, start, end int64, limit, offset int64) ([][]byte, error)
- func (d *Database) GetSyncMsgEventsMigration(ctx context.Context, limit, offset int64) ([]int64, []string, [][]byte, error)
- func (d *Database) GetSyncMsgEventsTotalMigration(ctx context.Context) (int, int64, error)
- func (d *Database) GetUserHistoryReceiptData(ctx context.Context, roomID, userID string) (evtOffset int64, content []byte, err error)
- func (d *Database) GetUserMaxReceiptOffset(ctx context.Context, userID string) (offsets int64, err error)
- func (d *Database) GetUserPresenceDataStream(ctx context.Context, users []string) ([]types.PresenceStream, []int64, error)
- func (d *Database) InsertEventRaw(ctx context.Context, id int64, roomId, eventId string, json []byte, ...) (err error)
- func (d *Database) InsertKeyChange(ctx context.Context, changedUserID string, offset int64) error
- func (d *Database) InsertOutputMinStream(ctx context.Context, id int64, roomID string) error
- func (d *Database) InsertStdMessage(ctx context.Context, stdEvent syncapitypes.StdHolder, ...) (err error)
- func (d *Database) InsertUserTimeLine(ctx context.Context, id int64, roomID string, evtNID int64, ...) (err error)
- func (d *Database) OnDeleteDeviceStdMessage(ctx context.Context, targetUID, targetDevice string) error
- func (d *Database) OnDeleteMacStdMessage(ctx context.Context, identifier, targetUID, targetDevice string) error
- func (d *Database) OnDeleteStdMessage(ctx context.Context, id int64, targetUID, targetDevice string) error
- func (d *Database) OnInsertKeyChange(ctx context.Context, id int64, changedUserID string) error
- func (d *Database) OnInsertOutputMinStream(ctx context.Context, id int64, roomID string) error
- func (d *Database) OnInsertStdMessage(ctx context.Context, id int64, stdEvent syncapitypes.StdHolder, ...) (pos int64, err error)
- func (d *Database) OnInsertUserTimeLine(ctx context.Context, id int64, roomID string, evtNID int64, ...) (err error)
- func (d *Database) OnUpdateEvent(ctx context.Context, eventID, roomID string, eventJson []byte, ...) error
- func (d *Database) OnUpdateSyncEvent(ctx context.Context, domainOffset, originTs int64, ...) error
- func (d *Database) OnUpsertClientDataStream(ctx context.Context, id int64, userID, roomID, dataType, streamType string) (syncapitypes.StreamPosition, error)
- func (d *Database) OnUpsertPresenceDataStream(ctx context.Context, id int64, userID, content string) (syncapitypes.StreamPosition, error)
- func (d *Database) OnUpsertReceiptDataStream(ctx context.Context, id, evtOffset int64, roomID, content string) error
- func (d *Database) OnUpsertUserReceiptData(ctx context.Context, roomID, userID, content string, evtOffset int64) (syncapitypes.StreamPosition, error)
- func (d *Database) SelectDomainMaxOffset(ctx context.Context, roomID string) ([]string, []int64, error)
- func (d *Database) SelectEventsByDir(ctx context.Context, userID, roomID string, dir string, from int64, limit int) ([]gomatrixserverlib.ClientEvent, []int64, []int64, error, int64, int64)
- func (d *Database) SelectEventsByDirRange(ctx context.Context, userID, roomID string, dir string, from, to int64) ([]gomatrixserverlib.ClientEvent, []int64, []int64, error, int64, int64)
- func (d *Database) SelectOutputMinStream(ctx context.Context, roomID string) (int64, error)
- func (d *Database) SelectTypeEventForward(ctx context.Context, typ []string, roomID string) (events []gomatrixserverlib.ClientEvent, offsets []int64, err error)
- func (d *Database) SelectUserTimeLineEvents(ctx context.Context, userID string, id int64, limit int) (events []syncapitypes.UserTimeLineStream, err error)
- func (d *Database) SelectUserTimeLineHistory(ctx context.Context, userID string, limit int) (events []syncapitypes.UserTimeLineStream, err error)
- func (d *Database) SelectUserTimeLineMinPos(ctx context.Context, userID string) (int64, error)
- func (d *Database) SelectUserTimeLineOffset(ctx context.Context, userID string, roomOffsets []int64) (events []syncapitypes.UserTimeLineStream, err error)
- func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)
- func (d *Database) SetIDGenerator(idg *uid.UidGenerator)
- func (d *Database) StreamEvents(ctx context.Context, eventIDs []string) ([]gomatrixserverlib.ClientEvent, []int64, error)
- func (d *Database) UpdateEvent(ctx context.Context, event gomatrixserverlib.ClientEvent, eventID string, ...) error
- func (d *Database) UpdateRoomState(ctx context.Context, event gomatrixserverlib.ClientEvent, membership *string, ...) error
- func (d *Database) UpdateRoomState2(ctx context.Context, roomId, eventId string, json []byte, ...) error
- func (d *Database) UpdateRoomStateRaw(ctx context.Context, roomId, eventId string, json []byte, ...) error
- func (d *Database) UpdateRoomStateWithEventID(ctx context.Context, eventID string, eventBytes []byte) error
- func (d *Database) UpdateSyncEvent(ctx context.Context, domainOffset, originTs int64, ...) error
- func (d *Database) UpdateSyncMemberEvent(ctx context.Context, userID, oldAvatarUrl, newAvatarUrl string) error
- func (d *Database) UpdateSyncMsgEventMigration(ctx context.Context, id int64, EncryptedEventBytes []byte) error
- func (d *Database) UpsertClientDataStream(ctx context.Context, userID, roomID, dataType, streamType string) (syncapitypes.StreamPosition, error)
- func (d *Database) UpsertPresenceDataStream(ctx context.Context, userID, content string) (syncapitypes.StreamPosition, error)
- func (d *Database) UpsertReceiptDataStream(ctx context.Context, offset, evtOffset int64, roomID, content string) error
- func (d *Database) UpsertUserReceiptData(ctx context.Context, roomID, userID, content string, evtOffset int64) error
- func (d *Database) WriteDBEvent(ctx context.Context, update *dbtypes.DBEvent) error
- func (d *Database) WriteDBEventWithTbl(ctx context.Context, update *dbtypes.DBEvent, tbl string) error
- func (d *Database) WriteEvent(ctx context.Context, ev *gomatrixserverlib.ClientEvent, ...) error
- type RoomEventVerbose
Constants ¶
const KeyChangeSchema = `` /* 543-byte string literal not displayed */
const OutputMinStreamSchema = `` /* 262-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func NewDatabase ¶
func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)
NewSyncServerDatabase creates a new sync server database
Types ¶
type Database ¶
type Database struct { AsyncSave bool // contains filtered or unexported fields }
SyncServerDatabase represents a sync server database
func (*Database) DeleteDeviceStdMessage ¶
func (*Database) DeleteMacStdMessage ¶
func (*Database) DeleteStdMessage ¶
func (*Database) Events ¶
func (d *Database) Events(ctx context.Context, eventIDs []string) ([]gomatrixserverlib.ClientEvent, error)
Events lookups a list of event by their event ID. Returns a list of events matching the requested IDs found in the database. If an event is not found in the database then it will be omitted from the list. Returns an error if there was a problem talking with the database. Does not include any transaction IDs in the returned events.
func (*Database) GetAllSyncRooms ¶
func (*Database) GetEventRaw ¶
func (*Database) GetFriendShip ¶
func (*Database) GetHistoryClientDataStream ¶
func (*Database) GetHistoryEvents ¶
func (d *Database) GetHistoryEvents( ctx context.Context, roomid string, limit int, ) (events []gomatrixserverlib.ClientEvent, offsets []int64, err error)
func (*Database) GetHistoryKeyChangeStream ¶
func (*Database) GetHistoryPresenceDataStream ¶
func (*Database) GetHistoryReceiptDataStream ¶
func (*Database) GetHistoryStdStream ¶
func (*Database) GetInviteRidsForUser ¶
func (*Database) GetJoinRoomOffsets ¶
func (*Database) GetLeaveRidsForUser ¶
func (*Database) GetMsgEventsByRoomIDMigration ¶
func (*Database) GetRidsForUser ¶
func (*Database) GetRoomLastOffsets ¶
func (*Database) GetRoomReceiptLastOffsets ¶
func (*Database) GetRoomStateByEventID ¶
func (*Database) GetRoomStateTotal ¶
func (*Database) GetRoomStateWithLimit ¶
func (*Database) GetStateEventsForRoom ¶
func (d *Database) GetStateEventsForRoom( ctx context.Context, roomID string, ) ([]gomatrixserverlib.ClientEvent, []int64, error)
GetStateEventsForRoom fetches the state events for a given room. Returns an empty slice if no state events could be found for this room. Returns an error if there was an issue with the retrieval.
func (*Database) GetStateEventsStreamForRoom ¶
func (d *Database) GetStateEventsStreamForRoom( ctx context.Context, roomID string, ) ([]gomatrixserverlib.ClientEvent, []int64, error)
func (*Database) GetStateEventsStreamForRoomBeforePos ¶
func (d *Database) GetStateEventsStreamForRoomBeforePos( ctx context.Context, roomID string, pos int64, ) ([]gomatrixserverlib.ClientEvent, []int64, error)
func (*Database) GetSyncEvents ¶
func (*Database) GetSyncMsgEventsMigration ¶
func (*Database) GetSyncMsgEventsTotalMigration ¶
func (*Database) GetUserHistoryReceiptData ¶
func (*Database) GetUserMaxReceiptOffset ¶
func (*Database) GetUserPresenceDataStream ¶
func (*Database) InsertEventRaw ¶
func (*Database) InsertKeyChange ¶
func (*Database) InsertOutputMinStream ¶
func (*Database) InsertStdMessage ¶
func (d *Database) InsertStdMessage( ctx context.Context, stdEvent syncapitypes.StdHolder, targetUID, targetDevice, identifier string, offset int64, ) (err error)
InsertStdMessage insert std message
func (*Database) InsertUserTimeLine ¶
func (*Database) OnDeleteDeviceStdMessage ¶
func (*Database) OnDeleteMacStdMessage ¶
func (*Database) OnDeleteStdMessage ¶
func (*Database) OnInsertKeyChange ¶
func (*Database) OnInsertOutputMinStream ¶
func (*Database) OnInsertStdMessage ¶
func (*Database) OnInsertUserTimeLine ¶
func (*Database) OnUpdateEvent ¶
func (*Database) OnUpdateSyncEvent ¶
func (*Database) OnUpsertClientDataStream ¶
func (d *Database) OnUpsertClientDataStream( ctx context.Context, id int64, userID, roomID, dataType, streamType string, ) (syncapitypes.StreamPosition, error)
func (*Database) OnUpsertPresenceDataStream ¶
func (d *Database) OnUpsertPresenceDataStream( ctx context.Context, id int64, userID, content string, ) (syncapitypes.StreamPosition, error)
func (*Database) OnUpsertReceiptDataStream ¶
func (*Database) OnUpsertUserReceiptData ¶
func (d *Database) OnUpsertUserReceiptData( ctx context.Context, roomID, userID, content string, evtOffset int64, ) (syncapitypes.StreamPosition, error)
func (*Database) SelectDomainMaxOffset ¶
func (*Database) SelectEventsByDir ¶
func (*Database) SelectEventsByDirRange ¶
func (*Database) SelectOutputMinStream ¶
func (*Database) SelectTypeEventForward ¶
func (d *Database) SelectTypeEventForward( ctx context.Context, typ []string, roomID string, ) (events []gomatrixserverlib.ClientEvent, offsets []int64, err error)
func (*Database) SelectUserTimeLineEvents ¶
func (d *Database) SelectUserTimeLineEvents( ctx context.Context, userID string, id int64, limit int, ) (events []syncapitypes.UserTimeLineStream, err error)
func (*Database) SelectUserTimeLineHistory ¶
func (d *Database) SelectUserTimeLineHistory( ctx context.Context, userID string, limit int, ) (events []syncapitypes.UserTimeLineStream, err error)
func (*Database) SelectUserTimeLineMinPos ¶
func (*Database) SelectUserTimeLineOffset ¶
func (d *Database) SelectUserTimeLineOffset( ctx context.Context, userID string, roomOffsets []int64, ) (events []syncapitypes.UserTimeLineStream, err error)
func (*Database) SetGauge ¶
func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)
func (*Database) SetIDGenerator ¶
func (d *Database) SetIDGenerator(idg *uid.UidGenerator)
func (*Database) StreamEvents ¶
func (d *Database) StreamEvents(ctx context.Context, eventIDs []string) ([]gomatrixserverlib.ClientEvent, []int64, error)
func (*Database) UpdateEvent ¶
func (d *Database) UpdateEvent( ctx context.Context, event gomatrixserverlib.ClientEvent, eventID string, eventType string, RoomID string, ) error
func (*Database) UpdateRoomState ¶
func (d *Database) UpdateRoomState( ctx context.Context, event gomatrixserverlib.ClientEvent, membership *string, streamPos syncapitypes.StreamPosition, ) error
func (*Database) UpdateRoomState2 ¶
func (*Database) UpdateRoomStateRaw ¶
func (*Database) UpdateRoomStateWithEventID ¶
func (*Database) UpdateSyncEvent ¶
func (*Database) UpdateSyncMemberEvent ¶
func (*Database) UpdateSyncMsgEventMigration ¶
func (*Database) UpsertClientDataStream ¶
func (d *Database) UpsertClientDataStream( ctx context.Context, userID, roomID, dataType, streamType string, ) (syncapitypes.StreamPosition, error)
func (*Database) UpsertPresenceDataStream ¶
func (d *Database) UpsertPresenceDataStream( ctx context.Context, userID, content string, ) (syncapitypes.StreamPosition, error)
func (*Database) UpsertReceiptDataStream ¶
func (*Database) UpsertUserReceiptData ¶
func (*Database) WriteDBEvent ¶
WriteOutputEvents implements OutputRoomEventWriter
func (*Database) WriteDBEventWithTbl ¶
func (*Database) WriteEvent ¶
func (d *Database) WriteEvent( ctx context.Context, ev *gomatrixserverlib.ClientEvent, addStateEvents []gomatrixserverlib.ClientEvent, addStateEventIDs, removeStateEventIDs []string, transactionID *roomservertypes.TransactionID, offset, domainOffset, depth int64, domain string, originTs int64, ) error
WriteEvent into the database. It is not safe to call this function from multiple goroutines, as it would create races when generating the stream position for this event. Returns the sync stream position for the inserted event. Returns an error if there was a problem inserting this event.
type RoomEventVerbose ¶
type RoomEventVerbose struct { Stream int64 RoomID string Event gomatrixserverlib.ClientEvent }