Documentation ¶
Index ¶
- type Database
- func (d *Database) AddInboundPeek(ctx context.Context, serverName spec.ServerName, roomID string, peekID string, ...) error
- func (d *Database) AddOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID string, peekID string, ...) error
- func (d *Database) AddServerToBlacklist(serverName spec.ServerName) error
- func (d *Database) AssociateEDUWithDestinations(ctx context.Context, destinations map[spec.ServerName]struct{}, ...) error
- func (d *Database) AssociatePDUWithDestinations(ctx context.Context, destinations map[spec.ServerName]struct{}, ...) error
- func (d *Database) CleanEDUs(ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt) error
- func (d *Database) CleanPDUs(ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt) error
- func (d *Database) DeleteExpiredEDUs(ctx context.Context) error
- func (d *Database) FetchKeys(ctx context.Context, ...) (...)
- func (d Database) FetcherName() string
- func (d *Database) GetAllJoinedHosts(ctx context.Context) ([]spec.ServerName, error)
- func (d *Database) GetInboundPeek(ctx context.Context, serverName spec.ServerName, roomID string, peekID string) (*types.InboundPeek, error)
- func (d *Database) GetInboundPeeks(ctx context.Context, roomID string) ([]types.InboundPeek, error)
- func (d *Database) GetJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error)
- func (d *Database) GetJoinedHostsForRooms(ctx context.Context, roomIDs []string, excludeSelf, excludeBlacklisted bool) ([]spec.ServerName, error)
- func (d *Database) GetNotaryKeys(ctx context.Context, serverName spec.ServerName, ...) (sks []gomatrixserverlib.ServerKeys, err error)
- func (d *Database) GetOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string) (*types.OutboundPeek, error)
- func (d *Database) GetOutboundPeeks(ctx context.Context, roomID string) ([]types.OutboundPeek, error)
- func (d *Database) GetPendingEDUServerNames(ctx context.Context) ([]spec.ServerName, error)
- func (d *Database) GetPendingEDUs(ctx context.Context, serverName spec.ServerName, limit int) (edus map[*receipt.Receipt]*gomatrixserverlib.EDU, err error)
- func (d *Database) GetPendingPDUServerNames(ctx context.Context) ([]spec.ServerName, error)
- func (d *Database) GetPendingPDUs(ctx context.Context, serverName spec.ServerName, limit int) (events map[*receipt.Receipt]*types.HeaderedEvent, err error)
- func (d *Database) IsServerAssumedOffline(ctx context.Context, serverName spec.ServerName) (bool, error)
- func (d *Database) IsServerBlacklisted(serverName spec.ServerName) (bool, error)
- func (d *Database) P2PAddRelayServersForServer(ctx context.Context, serverName spec.ServerName, ...) error
- func (d *Database) P2PGetRelayServersForServer(ctx context.Context, serverName spec.ServerName) ([]spec.ServerName, error)
- func (d *Database) P2PRemoveAllRelayServersForServer(ctx context.Context, serverName spec.ServerName) error
- func (d *Database) P2PRemoveRelayServersForServer(ctx context.Context, serverName spec.ServerName, ...) error
- func (d *Database) PurgeRoom(ctx context.Context, roomID string) error
- func (d *Database) RemoveAllServersAssumedOffline(ctx context.Context) error
- func (d *Database) RemoveAllServersFromBlacklist() error
- func (d *Database) RemoveServerAssumedOffline(ctx context.Context, serverName spec.ServerName) error
- func (d *Database) RemoveServerFromBlacklist(serverName spec.ServerName) error
- func (d *Database) RenewInboundPeek(ctx context.Context, serverName spec.ServerName, roomID string, peekID string, ...) error
- func (d *Database) RenewOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID string, peekID string, ...) error
- func (d *Database) SetServerAssumedOffline(ctx context.Context, serverName spec.ServerName) error
- func (d *Database) StoreJSON(ctx context.Context, js string) (*receipt.Receipt, error)
- func (d *Database) StoreKeys(ctx context.Context, ...) error
- func (d *Database) UpdateNotaryKeys(ctx context.Context, serverName spec.ServerName, ...) error
- func (d *Database) UpdateRoom(ctx context.Context, roomID string, addHosts []types.JoinedHost, ...) (joinedHosts []types.JoinedHost, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { DB *sql.DB IsLocalServerName func(spec.ServerName) bool Cache caching.FederationCache Writer sqlutil.Writer FederationQueuePDUs tables.FederationQueuePDUs FederationQueueEDUs tables.FederationQueueEDUs FederationQueueJSON tables.FederationQueueJSON FederationJoinedHosts tables.FederationJoinedHosts FederationBlacklist tables.FederationBlacklist FederationAssumedOffline tables.FederationAssumedOffline FederationRelayServers tables.FederationRelayServers FederationOutboundPeeks tables.FederationOutboundPeeks FederationInboundPeeks tables.FederationInboundPeeks NotaryServerKeysJSON tables.FederationNotaryServerKeysJSON NotaryServerKeysMetadata tables.FederationNotaryServerKeysMetadata ServerSigningKeys tables.FederationServerSigningKeys }
func (*Database) AddInboundPeek ¶
func (*Database) AddOutboundPeek ¶
func (*Database) AddServerToBlacklist ¶
func (d *Database) AddServerToBlacklist( serverName spec.ServerName, ) error
func (*Database) AssociateEDUWithDestinations ¶
func (d *Database) AssociateEDUWithDestinations( ctx context.Context, destinations map[spec.ServerName]struct{}, dbReceipt *receipt.Receipt, eduType string, expireEDUTypes map[string]time.Duration, ) error
AssociateEDUWithDestination creates an association that the destination queues will use to determine which JSON blobs to send to which servers.
func (*Database) AssociatePDUWithDestinations ¶
func (d *Database) AssociatePDUWithDestinations( ctx context.Context, destinations map[spec.ServerName]struct{}, dbReceipt *receipt.Receipt, ) error
AssociatePDUWithDestination creates an association that the destination queues will use to determine which JSON blobs to send to which servers.
func (*Database) CleanEDUs ¶
func (d *Database) CleanEDUs( ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt, ) error
CleanEDUs cleans up all specified EDUs. This is done when a transaction was sent successfully.
func (*Database) CleanPDUs ¶
func (d *Database) CleanPDUs( ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt, ) error
CleanTransactionPDUs cleans up all associated events for a given transaction. This is done when the transaction was sent successfully.
func (*Database) DeleteExpiredEDUs ¶
DeleteExpiredEDUs deletes expired EDUs and evicts them from the cache.
func (*Database) FetchKeys ¶
func (d *Database) FetchKeys( ctx context.Context, requests map[gomatrixserverlib.PublicKeyLookupRequest]spec.Timestamp, ) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error)
FetchKeys implements gomatrixserverlib.KeyDatabase
func (Database) FetcherName ¶
FetcherName implements KeyFetcher
func (*Database) GetAllJoinedHosts ¶
GetAllJoinedHosts returns the currently joined hosts for all rooms known to the federation sender. Returns an error if something goes wrong.
func (*Database) GetInboundPeek ¶
func (d *Database) GetInboundPeek( ctx context.Context, serverName spec.ServerName, roomID string, peekID string, ) (*types.InboundPeek, error)
func (*Database) GetInboundPeeks ¶
func (*Database) GetJoinedHosts ¶
func (d *Database) GetJoinedHosts( ctx context.Context, roomID string, ) ([]types.JoinedHost, error)
GetJoinedHosts returns the currently joined hosts for room, as known to federationserver. Returns an error if something goes wrong.
func (*Database) GetJoinedHostsForRooms ¶
func (*Database) GetNotaryKeys ¶
func (d *Database) GetNotaryKeys( ctx context.Context, serverName spec.ServerName, optKeyIDs []gomatrixserverlib.KeyID, ) (sks []gomatrixserverlib.ServerKeys, err error)
func (*Database) GetOutboundPeek ¶
func (d *Database) GetOutboundPeek( ctx context.Context, serverName spec.ServerName, roomID, peekID string, ) (*types.OutboundPeek, error)
func (*Database) GetOutboundPeeks ¶
func (*Database) GetPendingEDUServerNames ¶
GetPendingServerNames returns the server names that have EDUs waiting to be sent.
func (*Database) GetPendingEDUs ¶
func (d *Database) GetPendingEDUs( ctx context.Context, serverName spec.ServerName, limit int, ) ( edus map[*receipt.Receipt]*gomatrixserverlib.EDU, err error, )
GetNextTransactionEDUs retrieves events from the database for the next pending transaction, up to the limit specified.
func (*Database) GetPendingPDUServerNames ¶
GetPendingServerNames returns the server names that have PDUs waiting to be sent.
func (*Database) GetPendingPDUs ¶
func (d *Database) GetPendingPDUs( ctx context.Context, serverName spec.ServerName, limit int, ) ( events map[*receipt.Receipt]*types.HeaderedEvent, err error, )
GetNextTransactionPDUs retrieves events from the database for the next pending transaction, up to the limit specified.
func (*Database) IsServerAssumedOffline ¶
func (*Database) IsServerBlacklisted ¶
func (d *Database) IsServerBlacklisted( serverName spec.ServerName, ) (bool, error)
func (*Database) P2PAddRelayServersForServer ¶
func (d *Database) P2PAddRelayServersForServer( ctx context.Context, serverName spec.ServerName, relayServers []spec.ServerName, ) error
func (*Database) P2PGetRelayServersForServer ¶
func (d *Database) P2PGetRelayServersForServer( ctx context.Context, serverName spec.ServerName, ) ([]spec.ServerName, error)
func (*Database) P2PRemoveAllRelayServersForServer ¶
func (*Database) P2PRemoveRelayServersForServer ¶
func (d *Database) P2PRemoveRelayServersForServer( ctx context.Context, serverName spec.ServerName, relayServers []spec.ServerName, ) error
func (*Database) RemoveAllServersAssumedOffline ¶
func (*Database) RemoveAllServersFromBlacklist ¶
func (*Database) RemoveServerAssumedOffline ¶
func (*Database) RemoveServerFromBlacklist ¶
func (d *Database) RemoveServerFromBlacklist( serverName spec.ServerName, ) error
func (*Database) RenewInboundPeek ¶
func (*Database) RenewOutboundPeek ¶
func (*Database) SetServerAssumedOffline ¶
func (*Database) StoreJSON ¶
StoreJSON adds a JSON blob into the queue JSON table and returns a NID. The NID will then be used when inserting the per-destination metadata entries.
func (*Database) StoreKeys ¶
func (d *Database) StoreKeys( ctx context.Context, keyMap map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, ) error
StoreKeys implements gomatrixserverlib.KeyDatabase
func (*Database) UpdateNotaryKeys ¶
func (d *Database) UpdateNotaryKeys( ctx context.Context, serverName spec.ServerName, serverKeys gomatrixserverlib.ServerKeys, ) error
func (*Database) UpdateRoom ¶
func (d *Database) UpdateRoom( ctx context.Context, roomID string, addHosts []types.JoinedHost, removeHosts []string, purgeRoomFirst bool, ) (joinedHosts []types.JoinedHost, err error)
UpdateRoom updates the joined hosts for a room and returns what the joined hosts were before the update, or nil if this was a duplicate message. This is called when we receive a message from kafka, so we pass in oldEventID and newEventID to check that we haven't missed any messages or this isn't a duplicate message.