Documentation ¶
Index ¶
- type Database
- func (d *Database) AddState(ctx context.Context, roomNID types.RoomNID, ...) (stateNID types.StateSnapshotNID, err error)
- func (d *Database) EventIDs(ctx context.Context, eventNIDs []types.EventNID) (map[types.EventNID]string, error)
- func (d *Database) EventNIDs(ctx context.Context, eventIDs []string) (map[string]types.EventNID, error)
- func (d *Database) EventStateKeyNIDs(ctx context.Context, eventStateKeys []string) (map[string]types.EventStateKeyNID, error)
- func (d *Database) EventStateKeys(ctx context.Context, eventStateKeyNIDs []types.EventStateKeyNID) (map[types.EventStateKeyNID]string, error)
- func (d *Database) EventTypeNIDs(ctx context.Context, eventTypes []string) (map[string]types.EventTypeNID, error)
- func (d *Database) Events(ctx context.Context, eventNIDs []types.EventNID) ([]types.Event, error)
- func (d *Database) EventsFromIDs(ctx context.Context, eventIDs []string) ([]types.Event, 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) GetInvitesForUser(ctx context.Context, roomNID types.RoomNID, ...) (senderUserIDs []types.EventStateKeyNID, eventIDs []string, err error)
- func (d *Database) GetKnownRooms(ctx context.Context) ([]string, error)
- func (d *Database) GetKnownUsers(ctx context.Context, userID, searchString string, limit int) ([]string, error)
- func (d *Database) GetLatestEventsForUpdate(ctx context.Context, roomInfo types.RoomInfo) (*LatestEventsUpdater, error)
- func (d *Database) GetMembership(ctx context.Context, roomNID types.RoomNID, requestSenderUserID string) (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) GetPublishedRooms(ctx context.Context) ([]string, error)
- func (d *Database) GetRoomIDForAlias(ctx context.Context, alias string) (string, error)
- func (d *Database) GetRoomsByMembership(ctx context.Context, userID, membership string) ([]string, error)
- func (d *Database) GetStateEvent(ctx context.Context, roomID, evType, stateKey string) (*gomatrixserverlib.HeaderedEvent, error)
- func (d *Database) GetTransactionEventID(ctx context.Context, transactionID string, sessionID int64, userID string) (string, error)
- func (d *Database) JoinedUsersSetInRooms(ctx context.Context, roomIDs []string) (map[string]int, error)
- func (d *Database) LatestEventIDs(ctx context.Context, roomNID types.RoomNID) (references []gomatrixserverlib.EventReference, ...)
- func (d *Database) MembershipUpdater(ctx context.Context, roomID, targetUserID string, targetLocal bool, ...) (*MembershipUpdater, error)
- func (d *Database) PublishRoom(ctx context.Context, roomID string, publish bool) 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) SetRoomAlias(ctx context.Context, alias string, roomID string, creatorUserID string) error
- func (d *Database) SetState(ctx context.Context, eventNID types.EventNID, stateNID types.StateSnapshotNID) error
- func (d *Database) SnapshotNIDFromEventID(ctx context.Context, eventID string) (types.StateSnapshotNID, error)
- func (d *Database) StateAtEventIDs(ctx context.Context, eventIDs []string) ([]types.StateAtEvent, 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) StateEntriesForEventIDs(ctx context.Context, eventIDs []string) ([]types.StateEntry, error)
- func (d *Database) StateEntriesForTuples(ctx context.Context, stateBlockNIDs []types.StateBlockNID, ...) ([]types.StateEntryList, error)
- func (d *Database) StoreEvent(ctx context.Context, event *gomatrixserverlib.Event, ...) (types.RoomNID, types.StateAtEvent, *gomatrixserverlib.Event, string, error)
- func (d *Database) SupportsConcurrentRoomInputs() bool
- type LatestEventsUpdater
- func (t *LatestEventsUpdater) Commit() error
- func (u *LatestEventsUpdater) CurrentStateSnapshotNID() types.StateSnapshotNID
- func (u *LatestEventsUpdater) HasEventBeenSent(eventNID types.EventNID) (bool, error)
- func (u *LatestEventsUpdater) IsReferenced(eventReference gomatrixserverlib.EventReference) (bool, error)
- func (u *LatestEventsUpdater) LastEventIDSent() string
- func (u *LatestEventsUpdater) LatestEvents() []types.StateAtEventAndReference
- func (u *LatestEventsUpdater) MarkEventAsSent(eventNID types.EventNID) error
- func (u *LatestEventsUpdater) MembershipUpdater(targetUserNID types.EventStateKeyNID, targetLocal bool) (*MembershipUpdater, error)
- func (t *LatestEventsUpdater) Rollback() error
- func (u *LatestEventsUpdater) RoomVersion() (version gomatrixserverlib.RoomVersion)
- func (u *LatestEventsUpdater) SetLatestEvents(roomNID types.RoomNID, latest []types.StateAtEventAndReference, ...) error
- func (u *LatestEventsUpdater) StorePreviousEvents(eventNID types.EventNID, ...) error
- type MembershipUpdater
- func (t *MembershipUpdater) Commit() error
- func (u *MembershipUpdater) IsInvite() bool
- func (u *MembershipUpdater) IsJoin() bool
- func (u *MembershipUpdater) IsLeave() bool
- func (t *MembershipUpdater) Rollback() error
- func (u *MembershipUpdater) SetToInvite(event gomatrixserverlib.Event) (bool, error)
- func (u *MembershipUpdater) SetToJoin(senderUserID string, eventID string, isUpdate bool) ([]string, error)
- func (u *MembershipUpdater) SetToLeave(senderUserID string, eventID string) ([]string, error)
- type StatementList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { DB *sql.DB Cache caching.RoomServerCaches Writer sqlutil.Writer EventsTable tables.Events EventJSONTable tables.EventJSON EventTypesTable tables.EventTypes EventStateKeysTable tables.EventStateKeys RoomsTable tables.Rooms TransactionsTable tables.Transactions StateSnapshotTable tables.StateSnapshot StateBlockTable tables.StateBlock RoomAliasesTable tables.RoomAliases PrevEventsTable tables.PreviousEvents InvitesTable tables.Invites MembershipTable tables.Membership PublishedTable tables.Published RedactionsTable tables.Redactions GetLatestEventsForUpdateFn func(ctx context.Context, roomInfo types.RoomInfo) (*LatestEventsUpdater, 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) EventStateKeyNIDs ¶
func (*Database) EventStateKeys ¶
func (d *Database) EventStateKeys( ctx context.Context, eventStateKeyNIDs []types.EventStateKeyNID, ) (map[types.EventStateKeyNID]string, error)
func (*Database) EventTypeNIDs ¶
func (*Database) EventsFromIDs ¶
func (*Database) ForgetRoom ¶ added in v0.3.0
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. nolint:gocyclo
func (*Database) GetCreatorIDForAlias ¶
func (*Database) GetInvitesForUser ¶
func (*Database) GetKnownRooms ¶
GetKnownRooms returns a list of all rooms we know about.
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) GetLatestEventsForUpdate ¶
func (*Database) GetMembership ¶
func (*Database) GetMembershipEventNIDsForRoom ¶
func (*Database) GetPublishedRooms ¶
func (*Database) GetRoomIDForAlias ¶
func (*Database) GetRoomsByMembership ¶
func (d *Database) GetRoomsByMembership(ctx context.Context, userID, membership string) ([]string, error)
GetRoomsByMembership returns a list of room IDs matching the provided membership and user ID (as state_key).
func (*Database) GetStateEvent ¶
func (d *Database) GetStateEvent(ctx context.Context, roomID, evType, stateKey string) (*gomatrixserverlib.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 nolint:gocyclo
func (*Database) GetTransactionEventID ¶
func (*Database) JoinedUsersSetInRooms ¶
func (d *Database) JoinedUsersSetInRooms(ctx context.Context, roomIDs []string) (map[string]int, error)
JoinedUsersSetInRooms returns all joined users in the rooms given, along with the count of how many times they appear.
func (*Database) LatestEventIDs ¶
func (d *Database) LatestEventIDs( ctx context.Context, roomNID types.RoomNID, ) (references []gomatrixserverlib.EventReference, currentStateSnapshotNID types.StateSnapshotNID, depth int64, err error)
func (*Database) MembershipUpdater ¶
func (d *Database) MembershipUpdater( ctx context.Context, roomID, targetUserID string, targetLocal bool, roomVersion gomatrixserverlib.RoomVersion, ) (*MembershipUpdater, error)
func (*Database) PublishRoom ¶
func (*Database) RemoveRoomAlias ¶
func (*Database) SetRoomAlias ¶
func (*Database) SnapshotNIDFromEventID ¶
func (*Database) StateAtEventIDs ¶
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) StateEntriesForEventIDs ¶
func (*Database) StateEntriesForTuples ¶
func (d *Database) StateEntriesForTuples( ctx context.Context, stateBlockNIDs []types.StateBlockNID, stateKeyTuples []types.StateKeyTuple, ) ([]types.StateEntryList, error)
func (*Database) StoreEvent ¶
func (d *Database) StoreEvent( ctx context.Context, event *gomatrixserverlib.Event, txnAndSessionID *api.TransactionID, authEventNIDs []types.EventNID, isRejected bool, ) (types.RoomNID, types.StateAtEvent, *gomatrixserverlib.Event, string, error)
nolint:gocyclo
func (*Database) SupportsConcurrentRoomInputs ¶
type LatestEventsUpdater ¶
type LatestEventsUpdater struct {
// contains filtered or unexported fields
}
func NewLatestEventsUpdater ¶
func (*LatestEventsUpdater) Commit ¶
func (t *LatestEventsUpdater) Commit() error
Commit implements types.Transaction
func (*LatestEventsUpdater) CurrentStateSnapshotNID ¶
func (u *LatestEventsUpdater) CurrentStateSnapshotNID() types.StateSnapshotNID
CurrentStateSnapshotNID implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) HasEventBeenSent ¶
func (u *LatestEventsUpdater) HasEventBeenSent(eventNID types.EventNID) (bool, error)
HasEventBeenSent implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) IsReferenced ¶
func (u *LatestEventsUpdater) IsReferenced(eventReference gomatrixserverlib.EventReference) (bool, error)
IsReferenced implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) LastEventIDSent ¶
func (u *LatestEventsUpdater) LastEventIDSent() string
LastEventIDSent implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) LatestEvents ¶
func (u *LatestEventsUpdater) LatestEvents() []types.StateAtEventAndReference
LatestEvents implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) MarkEventAsSent ¶
func (u *LatestEventsUpdater) MarkEventAsSent(eventNID types.EventNID) error
MarkEventAsSent implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) MembershipUpdater ¶
func (u *LatestEventsUpdater) MembershipUpdater(targetUserNID types.EventStateKeyNID, targetLocal bool) (*MembershipUpdater, error)
func (*LatestEventsUpdater) Rollback ¶
func (t *LatestEventsUpdater) Rollback() error
Rollback implements types.Transaction
func (*LatestEventsUpdater) RoomVersion ¶
func (u *LatestEventsUpdater) RoomVersion() (version gomatrixserverlib.RoomVersion)
RoomVersion implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) SetLatestEvents ¶
func (u *LatestEventsUpdater) SetLatestEvents( roomNID types.RoomNID, latest []types.StateAtEventAndReference, lastEventNIDSent types.EventNID, currentStateSnapshotNID types.StateSnapshotNID, ) error
SetLatestEvents implements types.RoomRecentEventsUpdater
func (*LatestEventsUpdater) StorePreviousEvents ¶
func (u *LatestEventsUpdater) StorePreviousEvents(eventNID types.EventNID, previousEventReferences []gomatrixserverlib.EventReference) error
StorePreviousEvents implements types.RoomRecentEventsUpdater - This must be called from a Writer
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) IsInvite ¶
func (u *MembershipUpdater) IsInvite() bool
IsInvite implements types.MembershipUpdater
func (*MembershipUpdater) IsJoin ¶
func (u *MembershipUpdater) IsJoin() bool
IsJoin 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) SetToInvite ¶
func (u *MembershipUpdater) SetToInvite(event gomatrixserverlib.Event) (bool, error)
SetToInvite implements types.MembershipUpdater
func (*MembershipUpdater) SetToJoin ¶
func (u *MembershipUpdater) SetToJoin(senderUserID string, eventID string, isUpdate bool) ([]string, error)
SetToJoin implements types.MembershipUpdater
func (*MembershipUpdater) SetToLeave ¶
func (u *MembershipUpdater) SetToLeave(senderUserID string, eventID string) ([]string, error)
SetToLeave implements types.MembershipUpdater
type StatementList ¶
StatementList is a list of SQL statements to prepare and a pointer to where to store the resulting prepared statement.