Documentation ¶
Index ¶
- type Database
- func (d *Database) AddState(ctx context.Context, roomNID types.RoomNID, ...) (stateNID types.StateSnapshotNID, err error)
- func (d *Database) AdminDeleteEventReport(ctx context.Context, reportID uint64) error
- func (d *Database) AssignRoomNID(ctx context.Context, roomID spec.RoomID, ...) (roomNID types.RoomNID, err error)
- func (d *Database) BulkSelectSnapshotsFromEventIDs(ctx context.Context, eventIDs []string) (map[types.StateSnapshotNID][]string, error)
- func (d *Database) ForgetRoom(ctx context.Context, userID, roomID string, forget bool) error
- func (d *Database) GetAliasesForRoomID(ctx context.Context, roomID string) ([]string, error)
- func (d *Database) GetBulkStateContent(ctx context.Context, roomIDs []string, ...) ([]tables.StrippedEvent, error)
- func (d *Database) GetCreatorIDForAlias(ctx context.Context, alias string) (string, error)
- func (d *Database) GetHistoryVisibilityState(ctx context.Context, roomInfo *types.RoomInfo, eventID string, domain string) ([]gomatrixserverlib.PDU, error)
- func (d *Database) GetInvitesForUser(ctx context.Context, roomNID types.RoomNID, ...) (senderUserIDs []types.EventStateKeyNID, eventIDs []string, ...)
- func (d *Database) GetKnownUsers(ctx context.Context, userID, searchString string, limit int) ([]string, error)
- func (d *Database) GetLeftUsers(ctx context.Context, userIDs []string) ([]string, error)
- func (d *Database) GetLocalServerInRoom(ctx context.Context, roomNID types.RoomNID) (bool, error)
- func (d *Database) GetMembership(ctx context.Context, roomNID types.RoomNID, requestSenderID spec.SenderID) (membershipEventNID types.EventNID, stillInRoom, isRoomforgotten bool, ...)
- func (d *Database) GetMembershipEventNIDsForRoom(ctx context.Context, roomNID types.RoomNID, joinOnly bool, localOnly bool) ([]types.EventNID, error)
- func (d *Database) GetMembershipForHistoryVisibility(ctx context.Context, userNID types.EventStateKeyNID, roomInfo *types.RoomInfo, ...) (map[string]*types.HeaderedEvent, error)
- func (d *Database) GetOrCreateEventStateKeyNID(ctx context.Context, eventStateKey *string) (eventStateKeyNID types.EventStateKeyNID, err error)
- func (d *Database) GetOrCreateEventTypeNID(ctx context.Context, eventType string) (eventTypeNID types.EventTypeNID, err error)
- func (d *Database) GetOrCreateRoomInfo(ctx context.Context, event gomatrixserverlib.PDU) (roomInfo *types.RoomInfo, err error)
- func (d *Database) GetPublishedRoom(ctx context.Context, roomID string) (bool, error)
- func (d *Database) GetPublishedRooms(ctx context.Context, networkID string, includeAllNetworks bool) ([]string, error)
- func (d *Database) GetRoomIDForAlias(ctx context.Context, alias string) (string, error)
- func (d *Database) GetRoomUpdater(ctx context.Context, roomInfo *types.RoomInfo) (*RoomUpdater, error)
- func (d *Database) GetRoomVersion(ctx context.Context, roomID string) (gomatrixserverlib.RoomVersion, error)
- func (d *Database) GetRoomsByMembership(ctx context.Context, userID spec.UserID, membership string) ([]string, error)
- func (d *Database) GetServerInRoom(ctx context.Context, roomNID types.RoomNID, serverName spec.ServerName) (bool, error)
- func (d *Database) GetStateEvent(ctx context.Context, roomID, evType, stateKey string) (*types.HeaderedEvent, error)
- func (d *Database) GetStateEventsWithEventType(ctx context.Context, roomID, evType string) ([]*types.HeaderedEvent, error)
- func (d *Database) InsertReportedEvent(ctx context.Context, roomID, eventID, reportingUserID, reason string, ...) (int64, error)
- func (d *Database) InsertUserRoomPrivatePublicKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID, ...) (result ed25519.PrivateKey, err error)
- func (d *Database) InsertUserRoomPublicKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID, ...) (result ed25519.PublicKey, err error)
- func (d *Database) IsEventRejected(ctx context.Context, roomNID types.RoomNID, eventID string) (bool, error)
- func (d *Database) JoinedUsersSetInRooms(ctx context.Context, roomIDs, userIDs []string, localOnly bool) (map[string]int, error)
- func (d *Database) LatestEventIDs(ctx context.Context, roomNID types.RoomNID) (references []string, currentStateSnapshotNID types.StateSnapshotNID, ...)
- func (d *Database) MembershipUpdater(ctx context.Context, roomID, targetUserID string, targetLocal bool, ...) (*MembershipUpdater, error)
- func (d *Database) MissingAuthPrevEvents(ctx context.Context, e gomatrixserverlib.PDU) (missingAuth, missingPrev []string, err error)
- func (d *Database) PublishRoom(ctx context.Context, roomID, appserviceID, networkID string, publish bool) error
- func (d *Database) PurgeRoom(ctx context.Context, roomID string) error
- func (d *Database) QueryAdminEventReport(ctx context.Context, reportID uint64) (api.QueryAdminEventReportResponse, error)
- func (d *Database) QueryAdminEventReports(ctx context.Context, from uint64, limit uint64, backwards bool, userID string, ...) ([]api.QueryAdminEventReportsResponse, int64, error)
- func (d *Database) RemoveRoomAlias(ctx context.Context, alias string) error
- func (d *Database) RoomInfo(ctx context.Context, roomID string) (*types.RoomInfo, error)
- func (d *Database) RoomInfoByNID(ctx context.Context, roomNID types.RoomNID) (*types.RoomInfo, error)
- func (d *Database) RoomsWithACLs(ctx context.Context) ([]string, error)
- func (d *Database) SelectUserIDsForPublicKeys(ctx context.Context, publicKeys map[spec.RoomID][]ed25519.PublicKey) (result map[spec.RoomID]map[string]string, err error)
- func (d *Database) SelectUserRoomPrivateKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (key ed25519.PrivateKey, err error)
- func (d *Database) SelectUserRoomPublicKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (key ed25519.PublicKey, err error)
- func (d *Database) SetRoomAlias(ctx context.Context, alias string, roomID string, creatorUserID string) error
- func (d *Database) StateBlockNIDs(ctx context.Context, stateNIDs []types.StateSnapshotNID) ([]types.StateBlockNIDList, error)
- func (d *Database) StateEntries(ctx context.Context, stateBlockNIDs []types.StateBlockNID) ([]types.StateEntryList, error)
- func (d *Database) StateEntriesForTuples(ctx context.Context, stateBlockNIDs []types.StateBlockNID, ...) ([]types.StateEntryList, error)
- func (d *Database) SupportsConcurrentRoomInputs() bool
- func (d *Database) UpgradeRoom(ctx context.Context, oldRoomID, newRoomID, eventSender string) error
- type EventDatabase
- func (d *EventDatabase) EventIDs(ctx context.Context, eventNIDs []types.EventNID) (map[types.EventNID]string, error)
- func (d *EventDatabase) EventNIDs(ctx context.Context, eventIDs []string) (map[string]types.EventMetadata, error)
- func (d *EventDatabase) EventStateKeyNIDs(ctx context.Context, eventStateKeys []string) (map[string]types.EventStateKeyNID, error)
- func (d *EventDatabase) EventStateKeys(ctx context.Context, eventStateKeyNIDs []types.EventStateKeyNID) (map[types.EventStateKeyNID]string, error)
- func (d *EventDatabase) EventTypeNIDs(ctx context.Context, eventTypes []string) (map[string]types.EventTypeNID, error)
- func (d *EventDatabase) Events(ctx context.Context, roomVersion gomatrixserverlib.RoomVersion, ...) ([]types.Event, error)
- func (d *EventDatabase) EventsFromIDs(ctx context.Context, roomInfo *types.RoomInfo, eventIDs []string) ([]types.Event, error)
- func (d *EventDatabase) MaybeRedactEvent(ctx context.Context, roomInfo *types.RoomInfo, eventNID types.EventNID, ...) (gomatrixserverlib.PDU, gomatrixserverlib.PDU, error)
- func (d *EventDatabase) SetState(ctx context.Context, eventNID types.EventNID, stateNID types.StateSnapshotNID) error
- func (d *EventDatabase) SnapshotNIDFromEventID(ctx context.Context, eventID string) (types.StateSnapshotNID, error)
- func (d *EventDatabase) StateAtEventIDs(ctx context.Context, eventIDs []string) ([]types.StateAtEvent, error)
- func (d *EventDatabase) StateEntriesForEventIDs(ctx context.Context, eventIDs []string, excludeRejected bool) ([]types.StateEntry, error)
- func (d *EventDatabase) StoreEvent(ctx context.Context, event gomatrixserverlib.PDU, roomInfo *types.RoomInfo, ...) (types.EventNID, types.StateAtEvent, error)
- type MembershipUpdater
- func (t *MembershipUpdater) Commit() error
- func (u *MembershipUpdater) Delete() error
- func (u *MembershipUpdater) IsInvite() bool
- func (u *MembershipUpdater) IsJoin() bool
- func (u *MembershipUpdater) IsKnock() bool
- func (u *MembershipUpdater) IsLeave() bool
- func (t *MembershipUpdater) Rollback() error
- func (u *MembershipUpdater) Update(newMembership tables.MembershipState, event *types.Event) (bool, []string, error)
- type RoomUpdater
- func (u *RoomUpdater) AddState(ctx context.Context, roomNID types.RoomNID, ...) (stateNID types.StateSnapshotNID, err error)
- func (u *RoomUpdater) BulkSelectSnapshotsFromEventIDs(ctx context.Context, eventIDs []string) (map[types.StateSnapshotNID][]string, error)
- func (u *RoomUpdater) Commit() error
- func (u *RoomUpdater) CurrentStateSnapshotNID() types.StateSnapshotNID
- func (u *RoomUpdater) EventIDs(ctx context.Context, eventNIDs []types.EventNID) (map[types.EventNID]string, error)
- func (u *RoomUpdater) EventStateKeyNIDs(ctx context.Context, eventStateKeys []string) (map[string]types.EventStateKeyNID, error)
- func (u *RoomUpdater) EventTypeNIDs(ctx context.Context, eventTypes []string) (map[string]types.EventTypeNID, error)
- func (u *RoomUpdater) Events(ctx context.Context, _ gomatrixserverlib.RoomVersion, ...) ([]types.Event, error)
- func (u *RoomUpdater) EventsFromIDs(ctx context.Context, roomInfo *types.RoomInfo, eventIDs []string) ([]types.Event, error)
- func (u *RoomUpdater) HasEventBeenSent(eventNID types.EventNID) (bool, error)
- func (u *RoomUpdater) IsEventRejected(ctx context.Context, roomNID types.RoomNID, eventID string) (bool, error)
- func (u *RoomUpdater) IsReferenced(eventID string) (bool, error)
- func (u *RoomUpdater) LastEventIDSent() string
- func (u *RoomUpdater) LatestEvents() []types.StateAtEventAndReference
- func (u *RoomUpdater) MarkEventAsSent(eventNID types.EventNID) error
- func (u *RoomUpdater) MembershipUpdater(targetUserNID types.EventStateKeyNID, targetLocal bool) (*MembershipUpdater, error)
- func (u *RoomUpdater) Rollback() error
- func (u *RoomUpdater) RoomExists() bool
- func (u *RoomUpdater) RoomInfo(ctx context.Context, roomID string) (*types.RoomInfo, error)
- func (u *RoomUpdater) RoomVersion() (version gomatrixserverlib.RoomVersion)
- func (u *RoomUpdater) SetLatestEvents(roomNID types.RoomNID, latest []types.StateAtEventAndReference, ...) error
- func (u *RoomUpdater) SetState(ctx context.Context, eventNID types.EventNID, stateNID types.StateSnapshotNID) error
- func (u *RoomUpdater) SnapshotNIDFromEventID(ctx context.Context, eventID string) (types.StateSnapshotNID, error)
- func (u *RoomUpdater) StateAtEventIDs(ctx context.Context, eventIDs []string) ([]types.StateAtEvent, error)
- func (u *RoomUpdater) StateBlockNIDs(ctx context.Context, stateNIDs []types.StateSnapshotNID) ([]types.StateBlockNIDList, error)
- func (u *RoomUpdater) StateEntries(ctx context.Context, stateBlockNIDs []types.StateBlockNID) ([]types.StateEntryList, error)
- func (u *RoomUpdater) StateEntriesForTuples(ctx context.Context, stateBlockNIDs []types.StateBlockNID, ...) ([]types.StateEntryList, error)
- type StatementList
- type UnsentFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { DB *sql.DB EventDatabase Cache caching.RoomServerCaches Writer sqlutil.Writer RoomsTable tables.Rooms StateSnapshotTable tables.StateSnapshot StateBlockTable tables.StateBlock RoomAliasesTable tables.RoomAliases InvitesTable tables.Invites MembershipTable tables.Membership PublishedTable tables.Published Purge tables.Purge UserRoomKeyTable tables.UserRoomKeys GetRoomUpdaterFn func(ctx context.Context, roomInfo *types.RoomInfo) (*RoomUpdater, error) }
func (*Database) AddState ¶
func (d *Database) AddState( ctx context.Context, roomNID types.RoomNID, stateBlockNIDs []types.StateBlockNID, state []types.StateEntry, ) (stateNID types.StateSnapshotNID, err error)
func (*Database) AdminDeleteEventReport ¶
func (*Database) AssignRoomNID ¶
func (d *Database) AssignRoomNID(ctx context.Context, roomID spec.RoomID, roomVersion gomatrixserverlib.RoomVersion) (roomNID types.RoomNID, err error)
func (*Database) BulkSelectSnapshotsFromEventIDs ¶
func (*Database) ForgetRoom ¶
ForgetRoom sets a users room to forgotten
func (*Database) GetAliasesForRoomID ¶
func (*Database) GetBulkStateContent ¶
func (d *Database) GetBulkStateContent(ctx context.Context, roomIDs []string, tuples []gomatrixserverlib.StateKeyTuple, allowWildcards bool) ([]tables.StrippedEvent, error)
GetBulkStateContent returns all state events which match a given room ID and a given state key tuple. Both must be satisfied for a match. If a tuple has the StateKey of '*' and allowWildcards=true then all state events with the EventType should be returned.
func (*Database) GetCreatorIDForAlias ¶
func (*Database) GetHistoryVisibilityState ¶
func (*Database) GetInvitesForUser ¶
func (*Database) GetKnownUsers ¶
func (d *Database) GetKnownUsers(ctx context.Context, userID, searchString string, limit int) ([]string, error)
GetKnownUsers searches all users that userID knows about.
func (*Database) GetLeftUsers ¶
GetLeftUsers calculates users we (the server) don't share a room with anymore.
func (*Database) GetLocalServerInRoom ¶
GetLocalServerInRoom returns true if we think we're in a given room or false otherwise.
func (*Database) GetMembership ¶
func (*Database) GetMembershipEventNIDsForRoom ¶
func (*Database) GetMembershipForHistoryVisibility ¶
func (*Database) GetOrCreateEventStateKeyNID ¶
func (*Database) GetOrCreateEventTypeNID ¶
func (*Database) GetOrCreateRoomInfo ¶
func (d *Database) GetOrCreateRoomInfo(ctx context.Context, event gomatrixserverlib.PDU) (roomInfo *types.RoomInfo, err error)
GetOrCreateRoomInfo gets or creates a new RoomInfo, which is only safe to use with functions only needing a roomVersion or roomNID.
func (*Database) GetPublishedRoom ¶
func (*Database) GetPublishedRooms ¶
func (*Database) GetRoomIDForAlias ¶
func (*Database) GetRoomUpdater ¶
func (*Database) GetRoomVersion ¶
func (d *Database) GetRoomVersion(ctx context.Context, roomID string) (gomatrixserverlib.RoomVersion, error)
func (*Database) GetRoomsByMembership ¶
func (d *Database) GetRoomsByMembership(ctx context.Context, userID spec.UserID, membership string) ([]string, error)
GetRoomsByMembership returns a list of room IDs matching the provided membership and user ID (as state_key).
func (*Database) GetServerInRoom ¶
func (d *Database) GetServerInRoom(ctx context.Context, roomNID types.RoomNID, serverName spec.ServerName) (bool, error)
GetServerInRoom returns true if we think a server is in a given room or false otherwise.
func (*Database) GetStateEvent ¶
func (d *Database) GetStateEvent(ctx context.Context, roomID, evType, stateKey string) (*types.HeaderedEvent, error)
GetStateEvent returns the current state event of a given type for a given room with a given state key If no event could be found, returns nil If there was an issue during the retrieval, returns an error
func (*Database) GetStateEventsWithEventType ¶
func (d *Database) GetStateEventsWithEventType(ctx context.Context, roomID, evType string) ([]*types.HeaderedEvent, error)
Same as GetStateEvent but returns all matching state events with this event type. Returns no error if there are no events with this event type.
func (*Database) InsertReportedEvent ¶
func (d *Database) InsertReportedEvent( ctx context.Context, roomID, eventID, reportingUserID, reason string, score int64, ) (int64, error)
InsertReportedEvent stores a reported event.
func (*Database) InsertUserRoomPrivatePublicKey ¶
func (d *Database) InsertUserRoomPrivatePublicKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID, key ed25519.PrivateKey) (result ed25519.PrivateKey, err error)
InsertUserRoomPrivatePublicKey inserts a new user room key for the given user and room. Returns the newly inserted private key or an existing private key. If there is an error talking to the database, returns that error.
func (*Database) InsertUserRoomPublicKey ¶
func (d *Database) InsertUserRoomPublicKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID, key ed25519.PublicKey) (result ed25519.PublicKey, err error)
InsertUserRoomPublicKey inserts a new user room key for the given user and room. Returns the newly inserted public key or an existing public key. If there is an error talking to the database, returns that error.
func (*Database) IsEventRejected ¶
func (*Database) JoinedUsersSetInRooms ¶
func (d *Database) JoinedUsersSetInRooms(ctx context.Context, roomIDs, userIDs []string, localOnly bool) (map[string]int, error)
JoinedUsersSetInRooms returns a map of how many times the given users appear in the specified rooms.
func (*Database) LatestEventIDs ¶
func (*Database) MembershipUpdater ¶
func (d *Database) MembershipUpdater( ctx context.Context, roomID, targetUserID string, targetLocal bool, roomVersion gomatrixserverlib.RoomVersion, ) (*MembershipUpdater, error)
func (*Database) MissingAuthPrevEvents ¶
func (*Database) PublishRoom ¶
func (*Database) PurgeRoom ¶
PurgeRoom removes all information about a given room from the roomserver. For large rooms this operation may take a considerable amount of time.
func (*Database) QueryAdminEventReport ¶
func (*Database) QueryAdminEventReports ¶
func (d *Database) QueryAdminEventReports(ctx context.Context, from uint64, limit uint64, backwards bool, userID string, roomID string) ([]api.QueryAdminEventReportsResponse, int64, error)
QueryAdminEventReports returns event reports given a filter.
func (*Database) RemoveRoomAlias ¶
func (*Database) RoomInfoByNID ¶
func (*Database) RoomsWithACLs ¶
func (*Database) SelectUserIDsForPublicKeys ¶
func (d *Database) SelectUserIDsForPublicKeys(ctx context.Context, publicKeys map[spec.RoomID][]ed25519.PublicKey) (result map[spec.RoomID]map[string]string, err error)
SelectUserIDsForPublicKeys returns a map from roomID -> map from senderKey -> userID
func (*Database) SelectUserRoomPrivateKey ¶
func (d *Database) SelectUserRoomPrivateKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (key ed25519.PrivateKey, err error)
SelectUserRoomPrivateKey queries the users room private key. If no key exists, returns no key and no error. Otherwise returns the key and a database error, if any. TODO: Cache this?
func (*Database) SelectUserRoomPublicKey ¶
func (d *Database) SelectUserRoomPublicKey(ctx context.Context, userID spec.UserID, roomID spec.RoomID) (key ed25519.PublicKey, err error)
SelectUserRoomPublicKey queries the users room public key. If no key exists, returns no key and no error. Otherwise returns the key and a database error, if any.
func (*Database) SetRoomAlias ¶
func (*Database) StateBlockNIDs ¶
func (d *Database) StateBlockNIDs( ctx context.Context, stateNIDs []types.StateSnapshotNID, ) ([]types.StateBlockNIDList, error)
func (*Database) StateEntries ¶
func (d *Database) StateEntries( ctx context.Context, stateBlockNIDs []types.StateBlockNID, ) ([]types.StateEntryList, error)
func (*Database) StateEntriesForTuples ¶
func (d *Database) StateEntriesForTuples( ctx context.Context, stateBlockNIDs []types.StateBlockNID, stateKeyTuples []types.StateKeyTuple, ) ([]types.StateEntryList, error)
func (*Database) SupportsConcurrentRoomInputs ¶
type EventDatabase ¶
type EventDatabase struct { DB *sql.DB Cache caching.RoomServerCaches Writer sqlutil.Writer EventsTable tables.Events EventJSONTable tables.EventJSON EventTypesTable tables.EventTypes EventStateKeysTable tables.EventStateKeys PrevEventsTable tables.PreviousEvents RedactionsTable tables.Redactions ReportedEventsTable tables.ReportedEvents }
EventDatabase contains all tables needed to work with events
func (*EventDatabase) EventNIDs ¶
func (d *EventDatabase) EventNIDs( ctx context.Context, eventIDs []string, ) (map[string]types.EventMetadata, error)
func (*EventDatabase) EventStateKeyNIDs ¶
func (d *EventDatabase) EventStateKeyNIDs( ctx context.Context, eventStateKeys []string, ) (map[string]types.EventStateKeyNID, error)
func (*EventDatabase) EventStateKeys ¶
func (d *EventDatabase) EventStateKeys( ctx context.Context, eventStateKeyNIDs []types.EventStateKeyNID, ) (map[types.EventStateKeyNID]string, error)
func (*EventDatabase) EventTypeNIDs ¶
func (d *EventDatabase) EventTypeNIDs( ctx context.Context, eventTypes []string, ) (map[string]types.EventTypeNID, error)
func (*EventDatabase) Events ¶
func (d *EventDatabase) Events(ctx context.Context, roomVersion gomatrixserverlib.RoomVersion, eventNIDs []types.EventNID) ([]types.Event, error)
func (*EventDatabase) EventsFromIDs ¶
func (*EventDatabase) MaybeRedactEvent ¶
func (d *EventDatabase) MaybeRedactEvent( ctx context.Context, roomInfo *types.RoomInfo, eventNID types.EventNID, event gomatrixserverlib.PDU, plResolver state.PowerLevelResolver, querier api.QuerySenderIDAPI, ) (gomatrixserverlib.PDU, gomatrixserverlib.PDU, error)
nolint:gocyclo MaybeRedactEvent manages the redacted status of events. There's two cases to consider in order to comply with the spec: "servers should not apply or send redactions to clients until both the redaction event and original event have been seen, and are valid." https://matrix.org/docs/spec/rooms/v3#authorization-rules-for-events These cases are:
- This is a redaction event, redact the event it references if we know about it.
- This is a normal event which may have been previously redacted.
In the first case, check if we have the referenced event then apply the redaction, else store it in the redactions table with validated=FALSE. In the second case, check if there is a redaction for it: if there is then apply the redactions and set validated=TRUE.
When an event is redacted, the redacted event JSON is modified to add an `unsigned.redacted_because` field. We use this field when loading events to determine whether to apply redactions. This keeps the hot-path of reading events quick as we don't need to cross-reference with other tables when loading.
Returns the redaction event and the redacted event if this call resulted in a redaction.
func (*EventDatabase) SetState ¶
func (d *EventDatabase) SetState( ctx context.Context, eventNID types.EventNID, stateNID types.StateSnapshotNID, ) error
func (*EventDatabase) SnapshotNIDFromEventID ¶
func (d *EventDatabase) SnapshotNIDFromEventID( ctx context.Context, eventID string, ) (types.StateSnapshotNID, error)
func (*EventDatabase) StateAtEventIDs ¶
func (d *EventDatabase) StateAtEventIDs( ctx context.Context, eventIDs []string, ) ([]types.StateAtEvent, error)
func (*EventDatabase) StateEntriesForEventIDs ¶
func (d *EventDatabase) StateEntriesForEventIDs( ctx context.Context, eventIDs []string, excludeRejected bool, ) ([]types.StateEntry, error)
func (*EventDatabase) StoreEvent ¶
func (d *EventDatabase) StoreEvent( ctx context.Context, event gomatrixserverlib.PDU, roomInfo *types.RoomInfo, eventTypeNID types.EventTypeNID, eventStateKeyNID types.EventStateKeyNID, authEventNIDs []types.EventNID, isRejected bool, ) (types.EventNID, types.StateAtEvent, error)
type MembershipUpdater ¶
type MembershipUpdater struct {
// contains filtered or unexported fields
}
func NewMembershipUpdater ¶
func NewMembershipUpdater( ctx context.Context, d *Database, txn *sql.Tx, roomID, targetUserID string, targetLocal bool, roomVersion gomatrixserverlib.RoomVersion, ) (*MembershipUpdater, error)
func (*MembershipUpdater) Commit ¶
func (t *MembershipUpdater) Commit() error
Commit implements types.Transaction
func (*MembershipUpdater) Delete ¶
func (u *MembershipUpdater) Delete() error
func (*MembershipUpdater) IsInvite ¶
func (u *MembershipUpdater) IsInvite() bool
IsInvite implements types.MembershipUpdater
func (*MembershipUpdater) IsJoin ¶
func (u *MembershipUpdater) IsJoin() bool
IsJoin implements types.MembershipUpdater
func (*MembershipUpdater) IsKnock ¶
func (u *MembershipUpdater) IsKnock() bool
IsKnock implements types.MembershipUpdater
func (*MembershipUpdater) IsLeave ¶
func (u *MembershipUpdater) IsLeave() bool
IsLeave implements types.MembershipUpdater
func (*MembershipUpdater) Rollback ¶
func (t *MembershipUpdater) Rollback() error
Rollback implements types.Transaction
func (*MembershipUpdater) Update ¶
func (u *MembershipUpdater) Update(newMembership tables.MembershipState, event *types.Event) (bool, []string, error)
type RoomUpdater ¶
type RoomUpdater struct {
// contains filtered or unexported fields
}
func NewRoomUpdater ¶
func (*RoomUpdater) AddState ¶
func (u *RoomUpdater) AddState( ctx context.Context, roomNID types.RoomNID, stateBlockNIDs []types.StateBlockNID, state []types.StateEntry, ) (stateNID types.StateSnapshotNID, err error)
func (*RoomUpdater) BulkSelectSnapshotsFromEventIDs ¶
func (u *RoomUpdater) BulkSelectSnapshotsFromEventIDs(ctx context.Context, eventIDs []string) (map[types.StateSnapshotNID][]string, error)
func (*RoomUpdater) CurrentStateSnapshotNID ¶
func (u *RoomUpdater) CurrentStateSnapshotNID() types.StateSnapshotNID
CurrentStateSnapshotNID implements types.RoomRecentEventsUpdater
func (*RoomUpdater) EventStateKeyNIDs ¶
func (u *RoomUpdater) EventStateKeyNIDs( ctx context.Context, eventStateKeys []string, ) (map[string]types.EventStateKeyNID, error)
func (*RoomUpdater) EventTypeNIDs ¶
func (u *RoomUpdater) EventTypeNIDs( ctx context.Context, eventTypes []string, ) (map[string]types.EventTypeNID, error)
func (*RoomUpdater) Events ¶
func (u *RoomUpdater) Events(ctx context.Context, _ gomatrixserverlib.RoomVersion, eventNIDs []types.EventNID) ([]types.Event, error)
func (*RoomUpdater) EventsFromIDs ¶
func (*RoomUpdater) HasEventBeenSent ¶
func (u *RoomUpdater) HasEventBeenSent(eventNID types.EventNID) (bool, error)
HasEventBeenSent implements types.RoomRecentEventsUpdater
func (*RoomUpdater) IsEventRejected ¶
func (*RoomUpdater) IsReferenced ¶
func (u *RoomUpdater) IsReferenced(eventID string) (bool, error)
IsReferenced implements types.RoomRecentEventsUpdater
func (*RoomUpdater) LastEventIDSent ¶
func (u *RoomUpdater) LastEventIDSent() string
LastEventIDSent implements types.RoomRecentEventsUpdater
func (*RoomUpdater) LatestEvents ¶
func (u *RoomUpdater) LatestEvents() []types.StateAtEventAndReference
LatestEvents implements types.RoomRecentEventsUpdater
func (*RoomUpdater) MarkEventAsSent ¶
func (u *RoomUpdater) MarkEventAsSent(eventNID types.EventNID) error
MarkEventAsSent implements types.RoomRecentEventsUpdater
func (*RoomUpdater) MembershipUpdater ¶
func (u *RoomUpdater) MembershipUpdater(targetUserNID types.EventStateKeyNID, targetLocal bool) (*MembershipUpdater, error)
func (*RoomUpdater) Rollback ¶
func (u *RoomUpdater) Rollback() error
Implements sqlutil.Transaction
func (*RoomUpdater) RoomExists ¶
func (u *RoomUpdater) RoomExists() bool
RoomExists returns true if the room exists and false otherwise.
func (*RoomUpdater) RoomVersion ¶
func (u *RoomUpdater) RoomVersion() (version gomatrixserverlib.RoomVersion)
RoomVersion implements types.RoomRecentEventsUpdater
func (*RoomUpdater) SetLatestEvents ¶
func (u *RoomUpdater) SetLatestEvents( roomNID types.RoomNID, latest []types.StateAtEventAndReference, lastEventNIDSent types.EventNID, currentStateSnapshotNID types.StateSnapshotNID, ) error
SetLatestEvents implements types.RoomRecentEventsUpdater
func (*RoomUpdater) SetState ¶
func (u *RoomUpdater) SetState( ctx context.Context, eventNID types.EventNID, stateNID types.StateSnapshotNID, ) error
func (*RoomUpdater) SnapshotNIDFromEventID ¶
func (u *RoomUpdater) SnapshotNIDFromEventID( ctx context.Context, eventID string, ) (types.StateSnapshotNID, error)
func (*RoomUpdater) StateAtEventIDs ¶
func (u *RoomUpdater) StateAtEventIDs( ctx context.Context, eventIDs []string, ) ([]types.StateAtEvent, error)
func (*RoomUpdater) StateBlockNIDs ¶
func (u *RoomUpdater) StateBlockNIDs( ctx context.Context, stateNIDs []types.StateSnapshotNID, ) ([]types.StateBlockNIDList, error)
func (*RoomUpdater) StateEntries ¶
func (u *RoomUpdater) StateEntries( ctx context.Context, stateBlockNIDs []types.StateBlockNID, ) ([]types.StateEntryList, error)
func (*RoomUpdater) StateEntriesForTuples ¶
func (u *RoomUpdater) StateEntriesForTuples( ctx context.Context, stateBlockNIDs []types.StateBlockNID, stateKeyTuples []types.StateKeyTuple, ) ([]types.StateEntryList, error)
type StatementList ¶
StatementList is a list of SQL statements to prepare and a pointer to where to store the resulting prepared statement.
type UnsentFilter ¶
type UnsentFilter bool
const ( NoFilter UnsentFilter = false FilterUnsentOnly UnsentFilter = true )