Documentation
¶
Index ¶
- Constants
- Variables
- func AssertEventIDsEqual(t *testing.T, gotEventIDs []string, wants []*types.HeaderedEvent)
- func AssertEventsEqual(t *testing.T, gots, wants []*types.HeaderedEvent)
- func DeepJsonCompare(jsonA, jsonB []byte) bool
- func GuestsCanJoin(canJoin bool) roomModifier
- func ListenAndServe(ctx context.Context, t *testing.T, router http.Handler, withTLS bool) (apiURL string, cancel func())
- func NewInMemoryConnectionManager() sqlutil.ConnectionManager
- func NewMatrixKey(matrixKeyPath string) (err error)
- func NewRequest(t *testing.T, method, path string, opts ...HTTPRequestOpt) *http.Request
- func NewTLSKey(tlsKeyPath, tlsCertPath string, keySize int) error
- func NewTLSKeyWithAuthority(...) error
- func PrepareCacheConnection(ctx context.Context, randomnesPrefix string, testOpts DependancyOption) (connStr config.DataSource, close func(ctx context.Context), err error)
- func PrepareDatabaseConnection(ctx context.Context, randomnesPrefix string, testOpts DependancyOption) (postgresDataSource config.DataSource, close func(context.Context), err error)
- func PrepareDefaultDSConnections(ctx context.Context, testOpts DependancyOption) (config.DefaultOpts, func(ctx context.Context), error)
- func PrepareQueueConnection(_ context.Context, randomnesPrefix string, testOpts DependancyOption) (connStr config.DataSource, close func(ctx context.Context), err error)
- func Reversed(in []*types.HeaderedEvent) []*types.HeaderedEvent
- func RoomHistoryVisibility(vis gomatrixserverlib.HistoryVisibility) roomModifier
- func RoomPreset(p Preset) roomModifier
- func RoomVersion(ver gomatrixserverlib.RoomVersion) roomModifier
- func SaveMatrixKey(matrixKeyPath string, data ed25519.PrivateKey) error
- func UnsortedStringSliceEqual(first, second []string) bool
- func UserIDForSender(roomID spec.RoomID, senderID spec.SenderID) (*spec.UserID, error)
- func WithAllDatabases(t *testing.T, testFn func(t *testing.T, db DependancyOption))
- func WithAuthIDs(evs []string) eventModifier
- func WithKeyID(keyID gomatrixserverlib.KeyID) eventModifier
- func WithOrigin(origin spec.ServerName) eventModifier
- func WithPrivateKey(pkey ed25519.PrivateKey) eventModifier
- func WithStateKey(skey string) eventModifier
- func WithTimestamp(ts time.Time) eventModifier
- func WithUnsigned(unsigned interface{}) eventModifier
- type DependancyOption
- type HTTPRequestOpt
- type InMemoryFederationDatabase
- func (d *InMemoryFederationDatabase) AddInboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, ...) error
- func (d *InMemoryFederationDatabase) AddOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, ...) error
- func (d *InMemoryFederationDatabase) AddServerToBlacklist(_ context.Context, serverName spec.ServerName) error
- func (d *InMemoryFederationDatabase) AssociateEDUWithDestinations(ctx context.Context, destinations map[spec.ServerName]struct{}, ...) error
- func (d *InMemoryFederationDatabase) AssociatePDUWithDestinations(ctx context.Context, destinations map[spec.ServerName]struct{}, ...) error
- func (d *InMemoryFederationDatabase) CleanEDUs(ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt) error
- func (d *InMemoryFederationDatabase) CleanPDUs(ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt) error
- func (d *InMemoryFederationDatabase) DeleteExpiredEDUs(ctx context.Context) error
- func (d *InMemoryFederationDatabase) FetchKeys(ctx context.Context, ...) (...)
- func (d *InMemoryFederationDatabase) FetcherName() string
- func (d *InMemoryFederationDatabase) GetAllJoinedHosts(ctx context.Context) ([]spec.ServerName, error)
- func (d *InMemoryFederationDatabase) GetInboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string) (*types.InboundPeek, error)
- func (d *InMemoryFederationDatabase) GetInboundPeeks(ctx context.Context, roomID string) ([]types.InboundPeek, error)
- func (d *InMemoryFederationDatabase) GetJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error)
- func (d *InMemoryFederationDatabase) GetJoinedHostsForRooms(ctx context.Context, roomIDs []string, excludeSelf, excludeBlacklisted bool) ([]spec.ServerName, error)
- func (d *InMemoryFederationDatabase) GetNotaryKeys(ctx context.Context, serverName spec.ServerName, ...) ([]gomatrixserverlib.ServerKeys, error)
- func (d *InMemoryFederationDatabase) GetOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string) (*types.OutboundPeek, error)
- func (d *InMemoryFederationDatabase) GetOutboundPeeks(ctx context.Context, roomID string) ([]types.OutboundPeek, error)
- func (d *InMemoryFederationDatabase) GetPendingEDUCount(ctx context.Context, serverName spec.ServerName) (int64, error)
- func (d *InMemoryFederationDatabase) GetPendingEDUServerNames(ctx context.Context) ([]spec.ServerName, error)
- func (d *InMemoryFederationDatabase) GetPendingEDUs(ctx context.Context, serverName spec.ServerName, limit int) (edus map[*receipt.Receipt]*gomatrixserverlib.EDU, err error)
- func (d *InMemoryFederationDatabase) GetPendingPDUCount(ctx context.Context, serverName spec.ServerName) (int64, error)
- func (d *InMemoryFederationDatabase) GetPendingPDUServerNames(ctx context.Context) ([]spec.ServerName, error)
- func (d *InMemoryFederationDatabase) GetPendingPDUs(ctx context.Context, serverName spec.ServerName, limit int) (pdus map[*receipt.Receipt]*rstypes.HeaderedEvent, err error)
- func (d *InMemoryFederationDatabase) IsServerAssumedOffline(ctx context.Context, serverName spec.ServerName) (bool, error)
- func (d *InMemoryFederationDatabase) IsServerBlacklisted(_ context.Context, serverName spec.ServerName) (bool, error)
- func (d *InMemoryFederationDatabase) P2PAddRelayServersForServer(ctx context.Context, serverName spec.ServerName, ...) error
- func (d *InMemoryFederationDatabase) P2PGetRelayServersForServer(ctx context.Context, serverName spec.ServerName) ([]spec.ServerName, error)
- func (d *InMemoryFederationDatabase) P2PRemoveAllRelayServersForServer(ctx context.Context, serverName spec.ServerName) error
- func (d *InMemoryFederationDatabase) P2PRemoveRelayServersForServer(ctx context.Context, serverName spec.ServerName, ...) error
- func (d *InMemoryFederationDatabase) PurgeRoom(ctx context.Context, roomID string) error
- func (d *InMemoryFederationDatabase) RemoveAllServersAssumedOffine(ctx context.Context) error
- func (d *InMemoryFederationDatabase) RemoveAllServersAssumedOffline(ctx context.Context) error
- func (d *InMemoryFederationDatabase) RemoveAllServersFromBlacklist(_ context.Context) error
- func (d *InMemoryFederationDatabase) RemoveServerAssumedOffline(ctx context.Context, serverName spec.ServerName) error
- func (d *InMemoryFederationDatabase) RemoveServerFromBlacklist(_ context.Context, serverName spec.ServerName) error
- func (d *InMemoryFederationDatabase) RenewInboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, ...) error
- func (d *InMemoryFederationDatabase) RenewOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, ...) error
- func (d *InMemoryFederationDatabase) SetServerAssumedOffline(ctx context.Context, serverName spec.ServerName) error
- func (d *InMemoryFederationDatabase) StoreJSON(ctx context.Context, js string) (*receipt.Receipt, error)
- func (d *InMemoryFederationDatabase) StoreKeys(ctx context.Context, ...) error
- func (d *InMemoryFederationDatabase) UpdateNotaryKeys(ctx context.Context, serverName spec.ServerName, ...) error
- func (d *InMemoryFederationDatabase) UpdateRoom(ctx context.Context, roomID string, addHosts []types.JoinedHost, ...) (joinedHosts []types.JoinedHost, err error)
- type InMemoryRelayDatabase
- func (d *InMemoryRelayDatabase) DeleteQueueEntries(_ context.Context, serverName spec.ServerName, jsonNIDs []int64) error
- func (d *InMemoryRelayDatabase) DeleteQueueJSON(_ context.Context, nids []int64) error
- func (d *InMemoryRelayDatabase) InsertQueueEntry(_ context.Context, transactionID gomatrixserverlib.TransactionID, ...) error
- func (d *InMemoryRelayDatabase) InsertQueueJSON(_ context.Context, json string) (int64, error)
- func (d *InMemoryRelayDatabase) SelectQueueEntries(_ context.Context, serverName spec.ServerName, limit int) ([]int64, error)
- func (d *InMemoryRelayDatabase) SelectQueueEntryCount(_ context.Context, serverName spec.ServerName) (int64, error)
- func (d *InMemoryRelayDatabase) SelectQueueJSON(_ context.Context, jsonNIDs []int64) (map[int64][]byte, error)
- type MemoryConnectionManager
- func (m MemoryConnectionManager) BeginTx(ctx context.Context, _ ...*sqlutil.WriterOption) (context.Context, sqlutil.Transaction, error)
- func (m MemoryConnectionManager) Collect(_ ...*frame.MigrationPatch) error
- func (m MemoryConnectionManager) Connection(_ context.Context, _ bool) *gorm.DB
- func (m MemoryConnectionManager) DS() *config.DataSource
- func (m MemoryConnectionManager) Do(ctx context.Context, f func(ctx context.Context) error, ...) error
- func (m MemoryConnectionManager) FromOptions(_ context.Context, _ *config.DatabaseOptions) (sqlutil.ConnectionManager, error)
- func (m MemoryConnectionManager) Migrate(_ context.Context) error
- type NopJSONVerifier
- type Preset
- type Room
- func (r *Room) CreateAndInsert(t *testing.T, creator *User, eventType string, content interface{}, ...) *rstypes.HeaderedEvent
- func (r *Room) CreateEvent(t *testing.T, creator *User, eventType string, content interface{}, ...) *rstypes.HeaderedEvent
- func (r *Room) CurrentState() []*rstypes.HeaderedEvent
- func (r *Room) Events() []*rstypes.HeaderedEvent
- func (r *Room) ForwardExtremities() []string
- func (r *Room) InsertEvent(t *testing.T, he *rstypes.HeaderedEvent)
- func (r *Room) MustGetAuthEventRefsForEvent(t *testing.T, needed gomatrixserverlib.StateNeeded) []string
- type User
- type UserOpt
Constants ¶
const ( DefaultDB = "postgres" DefaultCache = "redis" DefaultQueue = "nats" )
const ( // ServerKeyFile is the name of the file holding the matrix server private key. ServerKeyFile = "server_key.pem" // TLSCertFile is the name of the file holding the TLS certificate used for federation. TLSCertFile = "tls_cert.pem" // TLSKeyFile is the name of the file holding the TLS key used for federation. TLSKeyFile = "tls_key.pem" )
Variables ¶
var ( // private keys that tests can use PrivateKeyA = ed25519.NewKeyFromSeed([]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 77, }) PrivateKeyB = ed25519.NewKeyFromSeed([]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 66, }) )
Functions ¶
func AssertEventIDsEqual ¶
func AssertEventIDsEqual(t *testing.T, gotEventIDs []string, wants []*types.HeaderedEvent)
func AssertEventsEqual ¶
func AssertEventsEqual(t *testing.T, gots, wants []*types.HeaderedEvent)
func DeepJsonCompare ¶ added in v0.5.0
func GuestsCanJoin ¶
func GuestsCanJoin(canJoin bool) roomModifier
func ListenAndServe ¶
func ListenAndServe(ctx context.Context, t *testing.T, router http.Handler, withTLS bool) (apiURL string, cancel func())
ListenAndServe will listen on a random high-numbered port and attach the given router. Returns the base URL to send requests to. Call `cancel` to shutdown the server, which will block until it has closed.
func NewInMemoryConnectionManager ¶ added in v0.6.21
func NewInMemoryConnectionManager() sqlutil.ConnectionManager
func NewMatrixKey ¶
NewMatrixKey generates a new ed25519 matrix server key and writes it to a file.
func NewRequest ¶
func NewTLSKeyWithAuthority ¶
func PrepareCacheConnection ¶ added in v0.6.21
func PrepareCacheConnection(ctx context.Context, randomnesPrefix string, testOpts DependancyOption) (connStr config.DataSource, close func(ctx context.Context), err error)
PrepareCacheConnection Prepare a redis connection string for testing. Returns the connection string to use and a close function which must be called when the test finishes. Calling this function twice will return the same database, which will have data from previous tests unless close() is called.
func PrepareDatabaseConnection ¶ added in v0.6.21
func PrepareDatabaseConnection(ctx context.Context, randomnesPrefix string, testOpts DependancyOption) (postgresDataSource config.DataSource, close func(context.Context), err error)
PrepareDatabaseConnection Prepare a postgres connection string for testing. Returns the connection string to use and a close function which must be called when the test finishes. Calling this function twice will return the same database, which will have data from previous tests unless close() is called.
func PrepareDefaultDSConnections ¶ added in v0.2.5
func PrepareDefaultDSConnections(ctx context.Context, testOpts DependancyOption) (config.DefaultOpts, func(ctx context.Context), error)
func PrepareQueueConnection ¶ added in v0.6.21
func PrepareQueueConnection(_ context.Context, randomnesPrefix string, testOpts DependancyOption) (connStr config.DataSource, close func(ctx context.Context), err error)
PrepareQueueConnection Prepare a nats connection string for testing. Returns the connection string to use and a close function which must be called when the test finishes. Calling this function twice will return the same database, which will have data from previous tests unless close() is called.
func Reversed ¶
func Reversed(in []*types.HeaderedEvent) []*types.HeaderedEvent
Reverse a list of events
func RoomHistoryVisibility ¶
func RoomHistoryVisibility(vis gomatrixserverlib.HistoryVisibility) roomModifier
func RoomPreset ¶
func RoomPreset(p Preset) roomModifier
func RoomVersion ¶
func RoomVersion(ver gomatrixserverlib.RoomVersion) roomModifier
func SaveMatrixKey ¶
func SaveMatrixKey(matrixKeyPath string, data ed25519.PrivateKey) error
func UnsortedStringSliceEqual ¶
UnsortedStringSliceEqual returns true if the slices have same length & elements. Does not modify the given slice.
func UserIDForSender ¶
func WithAllDatabases ¶
func WithAllDatabases(t *testing.T, testFn func(t *testing.T, db DependancyOption))
WithAllDatabases Creates subtests with each known DependancyOption
func WithAuthIDs ¶
func WithAuthIDs(evs []string) eventModifier
func WithKeyID ¶
func WithKeyID(keyID gomatrixserverlib.KeyID) eventModifier
func WithOrigin ¶
func WithOrigin(origin spec.ServerName) eventModifier
func WithPrivateKey ¶
func WithPrivateKey(pkey ed25519.PrivateKey) eventModifier
func WithStateKey ¶
func WithStateKey(skey string) eventModifier
func WithTimestamp ¶
func WithUnsigned ¶
func WithUnsigned(unsigned interface{}) eventModifier
Types ¶
type DependancyOption ¶ added in v0.2.6
type DependancyOption struct {
// contains filtered or unexported fields
}
func (*DependancyOption) Cache ¶ added in v0.2.6
func (opt *DependancyOption) Cache() string
func (*DependancyOption) Database ¶ added in v0.2.6
func (opt *DependancyOption) Database() string
func (*DependancyOption) Name ¶ added in v0.2.6
func (opt *DependancyOption) Name() string
func (*DependancyOption) Queue ¶ added in v0.2.6
func (opt *DependancyOption) Queue() string
type HTTPRequestOpt ¶
func WithJSONBody ¶
func WithJSONBody(t *testing.T, body interface{}) HTTPRequestOpt
func WithQueryParams ¶
func WithQueryParams(qps map[string]string) HTTPRequestOpt
type InMemoryFederationDatabase ¶
type InMemoryFederationDatabase struct {
// contains filtered or unexported fields
}
func NewInMemoryFederationDatabase ¶
func NewInMemoryFederationDatabase() *InMemoryFederationDatabase
func (*InMemoryFederationDatabase) AddInboundPeek ¶
func (d *InMemoryFederationDatabase) AddInboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, renewalInterval int64) error
func (*InMemoryFederationDatabase) AddOutboundPeek ¶
func (d *InMemoryFederationDatabase) AddOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, renewalInterval int64) error
func (*InMemoryFederationDatabase) AddServerToBlacklist ¶
func (d *InMemoryFederationDatabase) AddServerToBlacklist( _ context.Context, serverName spec.ServerName, ) error
func (*InMemoryFederationDatabase) AssociateEDUWithDestinations ¶
func (*InMemoryFederationDatabase) AssociatePDUWithDestinations ¶
func (d *InMemoryFederationDatabase) AssociatePDUWithDestinations( ctx context.Context, destinations map[spec.ServerName]struct{}, dbReceipt *receipt.Receipt, ) error
func (*InMemoryFederationDatabase) CleanEDUs ¶
func (d *InMemoryFederationDatabase) CleanEDUs( ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt, ) error
func (*InMemoryFederationDatabase) CleanPDUs ¶
func (d *InMemoryFederationDatabase) CleanPDUs( ctx context.Context, serverName spec.ServerName, receipts []*receipt.Receipt, ) error
func (*InMemoryFederationDatabase) DeleteExpiredEDUs ¶
func (d *InMemoryFederationDatabase) DeleteExpiredEDUs(ctx context.Context) error
func (*InMemoryFederationDatabase) FetchKeys ¶
func (d *InMemoryFederationDatabase) FetchKeys(ctx context.Context, requests map[gomatrixserverlib.PublicKeyLookupRequest]spec.Timestamp) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error)
func (*InMemoryFederationDatabase) FetcherName ¶
func (d *InMemoryFederationDatabase) FetcherName() string
func (*InMemoryFederationDatabase) GetAllJoinedHosts ¶
func (d *InMemoryFederationDatabase) GetAllJoinedHosts(ctx context.Context) ([]spec.ServerName, error)
func (*InMemoryFederationDatabase) GetInboundPeek ¶
func (d *InMemoryFederationDatabase) GetInboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string) (*types.InboundPeek, error)
func (*InMemoryFederationDatabase) GetInboundPeeks ¶
func (d *InMemoryFederationDatabase) GetInboundPeeks(ctx context.Context, roomID string) ([]types.InboundPeek, error)
func (*InMemoryFederationDatabase) GetJoinedHosts ¶
func (d *InMemoryFederationDatabase) GetJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error)
func (*InMemoryFederationDatabase) GetJoinedHostsForRooms ¶
func (d *InMemoryFederationDatabase) GetJoinedHostsForRooms(ctx context.Context, roomIDs []string, excludeSelf, excludeBlacklisted bool) ([]spec.ServerName, error)
func (*InMemoryFederationDatabase) GetNotaryKeys ¶
func (d *InMemoryFederationDatabase) GetNotaryKeys(ctx context.Context, serverName spec.ServerName, optKeyIDs []gomatrixserverlib.KeyID) ([]gomatrixserverlib.ServerKeys, error)
func (*InMemoryFederationDatabase) GetOutboundPeek ¶
func (d *InMemoryFederationDatabase) GetOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string) (*types.OutboundPeek, error)
func (*InMemoryFederationDatabase) GetOutboundPeeks ¶
func (d *InMemoryFederationDatabase) GetOutboundPeeks(ctx context.Context, roomID string) ([]types.OutboundPeek, error)
func (*InMemoryFederationDatabase) GetPendingEDUCount ¶
func (d *InMemoryFederationDatabase) GetPendingEDUCount( ctx context.Context, serverName spec.ServerName, ) (int64, error)
func (*InMemoryFederationDatabase) GetPendingEDUServerNames ¶
func (d *InMemoryFederationDatabase) GetPendingEDUServerNames( ctx context.Context, ) ([]spec.ServerName, error)
func (*InMemoryFederationDatabase) GetPendingEDUs ¶
func (d *InMemoryFederationDatabase) GetPendingEDUs( ctx context.Context, serverName spec.ServerName, limit int, ) (edus map[*receipt.Receipt]*gomatrixserverlib.EDU, err error)
func (*InMemoryFederationDatabase) GetPendingPDUCount ¶
func (d *InMemoryFederationDatabase) GetPendingPDUCount( ctx context.Context, serverName spec.ServerName, ) (int64, error)
func (*InMemoryFederationDatabase) GetPendingPDUServerNames ¶
func (d *InMemoryFederationDatabase) GetPendingPDUServerNames( ctx context.Context, ) ([]spec.ServerName, error)
func (*InMemoryFederationDatabase) GetPendingPDUs ¶
func (d *InMemoryFederationDatabase) GetPendingPDUs( ctx context.Context, serverName spec.ServerName, limit int, ) (pdus map[*receipt.Receipt]*rstypes.HeaderedEvent, err error)
func (*InMemoryFederationDatabase) IsServerAssumedOffline ¶
func (d *InMemoryFederationDatabase) IsServerAssumedOffline( ctx context.Context, serverName spec.ServerName, ) (bool, error)
func (*InMemoryFederationDatabase) IsServerBlacklisted ¶
func (d *InMemoryFederationDatabase) IsServerBlacklisted( _ context.Context, serverName spec.ServerName, ) (bool, error)
func (*InMemoryFederationDatabase) P2PAddRelayServersForServer ¶
func (d *InMemoryFederationDatabase) P2PAddRelayServersForServer( ctx context.Context, serverName spec.ServerName, relayServers []spec.ServerName, ) error
func (*InMemoryFederationDatabase) P2PGetRelayServersForServer ¶
func (d *InMemoryFederationDatabase) P2PGetRelayServersForServer( ctx context.Context, serverName spec.ServerName, ) ([]spec.ServerName, error)
func (*InMemoryFederationDatabase) P2PRemoveAllRelayServersForServer ¶
func (d *InMemoryFederationDatabase) P2PRemoveAllRelayServersForServer(ctx context.Context, serverName spec.ServerName) error
func (*InMemoryFederationDatabase) P2PRemoveRelayServersForServer ¶
func (d *InMemoryFederationDatabase) P2PRemoveRelayServersForServer( ctx context.Context, serverName spec.ServerName, relayServers []spec.ServerName, ) error
func (*InMemoryFederationDatabase) PurgeRoom ¶
func (d *InMemoryFederationDatabase) PurgeRoom(ctx context.Context, roomID string) error
func (*InMemoryFederationDatabase) RemoveAllServersAssumedOffine ¶
func (d *InMemoryFederationDatabase) RemoveAllServersAssumedOffine( ctx context.Context, ) error
func (*InMemoryFederationDatabase) RemoveAllServersAssumedOffline ¶
func (d *InMemoryFederationDatabase) RemoveAllServersAssumedOffline(ctx context.Context) error
func (*InMemoryFederationDatabase) RemoveAllServersFromBlacklist ¶
func (d *InMemoryFederationDatabase) RemoveAllServersFromBlacklist(_ context.Context) error
func (*InMemoryFederationDatabase) RemoveServerAssumedOffline ¶
func (d *InMemoryFederationDatabase) RemoveServerAssumedOffline( ctx context.Context, serverName spec.ServerName, ) error
func (*InMemoryFederationDatabase) RemoveServerFromBlacklist ¶
func (d *InMemoryFederationDatabase) RemoveServerFromBlacklist( _ context.Context, serverName spec.ServerName, ) error
func (*InMemoryFederationDatabase) RenewInboundPeek ¶
func (d *InMemoryFederationDatabase) RenewInboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, renewalInterval int64) error
func (*InMemoryFederationDatabase) RenewOutboundPeek ¶
func (d *InMemoryFederationDatabase) RenewOutboundPeek(ctx context.Context, serverName spec.ServerName, roomID, peekID string, renewalInterval int64) error
func (*InMemoryFederationDatabase) SetServerAssumedOffline ¶
func (d *InMemoryFederationDatabase) SetServerAssumedOffline( ctx context.Context, serverName spec.ServerName, ) error
func (*InMemoryFederationDatabase) StoreKeys ¶
func (d *InMemoryFederationDatabase) StoreKeys(ctx context.Context, results map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult) error
func (*InMemoryFederationDatabase) UpdateNotaryKeys ¶
func (d *InMemoryFederationDatabase) UpdateNotaryKeys(ctx context.Context, serverName spec.ServerName, serverKeys gomatrixserverlib.ServerKeys) error
func (*InMemoryFederationDatabase) UpdateRoom ¶
func (d *InMemoryFederationDatabase) UpdateRoom(ctx context.Context, roomID string, addHosts []types.JoinedHost, removeHosts []string, purgeRoomFirst bool) (joinedHosts []types.JoinedHost, err error)
type InMemoryRelayDatabase ¶
type InMemoryRelayDatabase struct {
// contains filtered or unexported fields
}
func NewInMemoryRelayDatabase ¶
func NewInMemoryRelayDatabase() *InMemoryRelayDatabase
func (*InMemoryRelayDatabase) DeleteQueueEntries ¶
func (d *InMemoryRelayDatabase) DeleteQueueEntries( _ context.Context, serverName spec.ServerName, jsonNIDs []int64, ) error
func (*InMemoryRelayDatabase) DeleteQueueJSON ¶
func (d *InMemoryRelayDatabase) DeleteQueueJSON( _ context.Context, nids []int64, ) error
func (*InMemoryRelayDatabase) InsertQueueEntry ¶
func (d *InMemoryRelayDatabase) InsertQueueEntry( _ context.Context, transactionID gomatrixserverlib.TransactionID, serverName spec.ServerName, nid int64, ) error
func (*InMemoryRelayDatabase) InsertQueueJSON ¶
func (*InMemoryRelayDatabase) SelectQueueEntries ¶
func (d *InMemoryRelayDatabase) SelectQueueEntries( _ context.Context, serverName spec.ServerName, limit int, ) ([]int64, error)
func (*InMemoryRelayDatabase) SelectQueueEntryCount ¶
func (d *InMemoryRelayDatabase) SelectQueueEntryCount( _ context.Context, serverName spec.ServerName, ) (int64, error)
func (*InMemoryRelayDatabase) SelectQueueJSON ¶
type MemoryConnectionManager ¶ added in v0.6.21
type MemoryConnectionManager struct {
// contains filtered or unexported fields
}
func (MemoryConnectionManager) BeginTx ¶ added in v0.6.21
func (m MemoryConnectionManager) BeginTx(ctx context.Context, _ ...*sqlutil.WriterOption) (context.Context, sqlutil.Transaction, error)
func (MemoryConnectionManager) Collect ¶ added in v0.6.21
func (m MemoryConnectionManager) Collect(_ ...*frame.MigrationPatch) error
func (MemoryConnectionManager) Connection ¶ added in v0.6.21
func (MemoryConnectionManager) DS ¶ added in v0.6.21
func (m MemoryConnectionManager) DS() *config.DataSource
func (MemoryConnectionManager) Do ¶ added in v0.6.21
func (m MemoryConnectionManager) Do(ctx context.Context, f func(ctx context.Context) error, _ ...*sqlutil.WriterOption) error
func (MemoryConnectionManager) FromOptions ¶ added in v0.6.21
func (m MemoryConnectionManager) FromOptions(_ context.Context, _ *config.DatabaseOptions) (sqlutil.ConnectionManager, error)
type NopJSONVerifier ¶
type NopJSONVerifier struct { }
NopJSONVerifier is a JSONVerifier that verifies nothing and returns no errors.
func (*NopJSONVerifier) VerifyJSONs ¶
func (t *NopJSONVerifier) VerifyJSONs(ctx context.Context, requests []gomatrixserverlib.VerifyJSONRequest) ([]gomatrixserverlib.VerifyJSONResult, error)
type Room ¶
type Room struct { ID string Version gomatrixserverlib.RoomVersion // contains filtered or unexported fields }
func (*Room) CreateAndInsert ¶
func (*Room) CreateEvent ¶
func (r *Room) CreateEvent(t *testing.T, creator *User, eventType string, content interface{}, mods ...eventModifier) *rstypes.HeaderedEvent
CreateEvent an event in this room but do not insert it. Does not modify the room in any way (depth, fwd extremities, etc) so is thread-safe.
func (*Room) CurrentState ¶
func (r *Room) CurrentState() []*rstypes.HeaderedEvent
func (*Room) Events ¶
func (r *Room) Events() []*rstypes.HeaderedEvent
func (*Room) ForwardExtremities ¶
func (*Room) InsertEvent ¶
func (r *Room) InsertEvent(t *testing.T, he *rstypes.HeaderedEvent)
InsertEvent Add a new event to this room DAG. Not thread-safe.
func (*Room) MustGetAuthEventRefsForEvent ¶
func (r *Room) MustGetAuthEventRefsForEvent(t *testing.T, needed gomatrixserverlib.StateNeeded) []string
type User ¶
type User struct { ID string Localpart string AccountType api.AccountType // contains filtered or unexported fields }
type UserOpt ¶
type UserOpt func(*User)
func WithAccountType ¶
func WithAccountType(accountType api.AccountType) UserOpt
func WithSigningServer ¶
func WithSigningServer(srvName spec.ServerName, keyID gomatrixserverlib.KeyID, privKey ed25519.PrivateKey) UserOpt