Documentation ¶
Index ¶
- Constants
- type Cache
- type Caches
- func (c Caches) EvictFederationSenderQueuedEDU(eventNID int64)
- func (c Caches) EvictFederationSenderQueuedPDU(eventNID int64)
- func (c Caches) GetFederationSenderQueuedEDU(eventNID int64) (*gomatrixserverlib.EDU, bool)
- func (c Caches) GetFederationSenderQueuedPDU(eventNID int64) (*gomatrixserverlib.HeaderedEvent, bool)
- func (c Caches) GetRoomInfo(roomID string) (types.RoomInfo, bool)
- func (c Caches) GetRoomServerEventTypeNID(eventType string) (types.EventTypeNID, bool)
- func (c Caches) GetRoomServerRoomID(roomNID types.RoomNID) (string, bool)
- func (c Caches) GetRoomServerStateKeyNID(stateKey string) (types.EventStateKeyNID, bool)
- func (c Caches) GetRoomVersion(roomID string) (gomatrixserverlib.RoomVersion, bool)
- func (c Caches) GetServerKey(request gomatrixserverlib.PublicKeyLookupRequest, ...) (gomatrixserverlib.PublicKeyLookupResult, bool)
- func (c Caches) StoreFederationSenderQueuedEDU(eventNID int64, event *gomatrixserverlib.EDU)
- func (c Caches) StoreFederationSenderQueuedPDU(eventNID int64, event *gomatrixserverlib.HeaderedEvent)
- func (c Caches) StoreRoomInfo(roomID string, roomInfo types.RoomInfo)
- func (c Caches) StoreRoomServerEventTypeNID(eventType string, nid types.EventTypeNID)
- func (c Caches) StoreRoomServerRoomID(roomNID types.RoomNID, roomID string)
- func (c Caches) StoreRoomServerStateKeyNID(stateKey string, nid types.EventStateKeyNID)
- func (c Caches) StoreRoomVersion(roomID string, roomVersion gomatrixserverlib.RoomVersion)
- func (c Caches) StoreServerKey(request gomatrixserverlib.PublicKeyLookupRequest, ...)
- type FederationSenderCache
- type InMemoryLRUCachePartition
- type RoomInfoCache
- type RoomServerCaches
- type RoomServerNIDsCache
- type RoomVersionCache
- type ServerKeyCache
Constants ¶
const ( FederationEventCacheName = "federation_event" FederationEventCacheMaxEntries = 256 FederationEventCacheMutable = true // to allow use of Unset only )
const ( RoomInfoCacheName = "roominfo" RoomInfoCacheMaxEntries = 1024 RoomInfoCacheMutable = true )
const ( RoomServerStateKeyNIDsCacheName = "roomserver_statekey_nids" RoomServerStateKeyNIDsCacheMaxEntries = 1024 RoomServerStateKeyNIDsCacheMutable = false RoomServerEventTypeNIDsCacheName = "roomserver_eventtype_nids" RoomServerEventTypeNIDsCacheMaxEntries = 64 RoomServerEventTypeNIDsCacheMutable = false RoomServerRoomIDsCacheName = "roomserver_room_ids" RoomServerRoomIDsCacheMaxEntries = 1024 RoomServerRoomIDsCacheMutable = false )
const ( RoomVersionCacheName = "room_versions" RoomVersionCacheMaxEntries = 1024 RoomVersionCacheMutable = false )
const ( ServerKeyCacheName = "server_key" ServerKeyCacheMaxEntries = 4096 ServerKeyCacheMutable = true )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(key string) (value interface{}, ok bool) Set(key string, value interface{}) Unset(key string) }
Cache is the interface that an implementation must satisfy.
type Caches ¶
type Caches struct { RoomVersions Cache // RoomVersionCache ServerKeys Cache // ServerKeyCache RoomServerStateKeyNIDs Cache // RoomServerNIDsCache RoomServerEventTypeNIDs Cache // RoomServerNIDsCache RoomServerRoomNIDs Cache // RoomServerNIDsCache RoomServerRoomIDs Cache // RoomServerNIDsCache RoomInfos Cache // RoomInfoCache FederationEvents Cache // FederationEventsCache }
Caches contains a set of references to caches. They may be different implementations as long as they satisfy the Cache interface.
func NewInMemoryLRUCache ¶
func (Caches) EvictFederationSenderQueuedEDU ¶ added in v0.3.3
func (Caches) EvictFederationSenderQueuedPDU ¶ added in v0.3.3
func (Caches) GetFederationSenderQueuedEDU ¶ added in v0.3.3
func (c Caches) GetFederationSenderQueuedEDU(eventNID int64) (*gomatrixserverlib.EDU, bool)
func (Caches) GetFederationSenderQueuedPDU ¶ added in v0.3.3
func (c Caches) GetFederationSenderQueuedPDU(eventNID int64) (*gomatrixserverlib.HeaderedEvent, bool)
func (Caches) GetRoomInfo ¶ added in v0.3.4
GetRoomInfo must only be called from the roomserver only. It is not safe for use from other components.
func (Caches) GetRoomServerEventTypeNID ¶
func (c Caches) GetRoomServerEventTypeNID(eventType string) (types.EventTypeNID, bool)
func (Caches) GetRoomServerRoomID ¶
func (Caches) GetRoomServerStateKeyNID ¶
func (c Caches) GetRoomServerStateKeyNID(stateKey string) (types.EventStateKeyNID, bool)
func (Caches) GetRoomVersion ¶
func (c Caches) GetRoomVersion(roomID string) (gomatrixserverlib.RoomVersion, bool)
func (Caches) GetServerKey ¶
func (c Caches) GetServerKey( request gomatrixserverlib.PublicKeyLookupRequest, timestamp gomatrixserverlib.Timestamp, ) (gomatrixserverlib.PublicKeyLookupResult, bool)
func (Caches) StoreFederationSenderQueuedEDU ¶ added in v0.3.3
func (c Caches) StoreFederationSenderQueuedEDU(eventNID int64, event *gomatrixserverlib.EDU)
func (Caches) StoreFederationSenderQueuedPDU ¶ added in v0.3.3
func (c Caches) StoreFederationSenderQueuedPDU(eventNID int64, event *gomatrixserverlib.HeaderedEvent)
func (Caches) StoreRoomInfo ¶ added in v0.3.4
StoreRoomInfo must only be called from the roomserver only. It is not safe for use from other components.
func (Caches) StoreRoomServerEventTypeNID ¶
func (c Caches) StoreRoomServerEventTypeNID(eventType string, nid types.EventTypeNID)
func (Caches) StoreRoomServerRoomID ¶
func (Caches) StoreRoomServerStateKeyNID ¶
func (c Caches) StoreRoomServerStateKeyNID(stateKey string, nid types.EventStateKeyNID)
func (Caches) StoreRoomVersion ¶
func (c Caches) StoreRoomVersion(roomID string, roomVersion gomatrixserverlib.RoomVersion)
func (Caches) StoreServerKey ¶
func (c Caches) StoreServerKey( request gomatrixserverlib.PublicKeyLookupRequest, response gomatrixserverlib.PublicKeyLookupResult, )
type FederationSenderCache ¶ added in v0.3.3
type FederationSenderCache interface { GetFederationSenderQueuedPDU(eventNID int64) (event *gomatrixserverlib.HeaderedEvent, ok bool) StoreFederationSenderQueuedPDU(eventNID int64, event *gomatrixserverlib.HeaderedEvent) EvictFederationSenderQueuedPDU(eventNID int64) GetFederationSenderQueuedEDU(eventNID int64) (event *gomatrixserverlib.EDU, ok bool) StoreFederationSenderQueuedEDU(eventNID int64, event *gomatrixserverlib.EDU) EvictFederationSenderQueuedEDU(eventNID int64) }
FederationSenderCache contains the subset of functions needed for a federation event cache.
type InMemoryLRUCachePartition ¶
type InMemoryLRUCachePartition struct {
// contains filtered or unexported fields
}
func (*InMemoryLRUCachePartition) Get ¶
func (c *InMemoryLRUCachePartition) Get(key string) (value interface{}, ok bool)
func (*InMemoryLRUCachePartition) Set ¶
func (c *InMemoryLRUCachePartition) Set(key string, value interface{})
func (*InMemoryLRUCachePartition) Unset ¶
func (c *InMemoryLRUCachePartition) Unset(key string)
type RoomInfoCache ¶ added in v0.3.4
type RoomInfoCache interface { GetRoomInfo(roomID string) (roomInfo types.RoomInfo, ok bool) StoreRoomInfo(roomID string, roomInfo types.RoomInfo) }
RoomInfosCache contains the subset of functions needed for a room Info cache. It must only be used from the roomserver only It is not safe for use from other components.
type RoomServerCaches ¶
type RoomServerCaches interface { RoomServerNIDsCache RoomVersionCache RoomInfoCache }
type RoomServerNIDsCache ¶
type RoomServerNIDsCache interface { GetRoomServerStateKeyNID(stateKey string) (types.EventStateKeyNID, bool) StoreRoomServerStateKeyNID(stateKey string, nid types.EventStateKeyNID) GetRoomServerEventTypeNID(eventType string) (types.EventTypeNID, bool) StoreRoomServerEventTypeNID(eventType string, nid types.EventTypeNID) GetRoomServerRoomID(roomNID types.RoomNID) (string, bool) StoreRoomServerRoomID(roomNID types.RoomNID, roomID string) }
RoomServerNIDsCache contains the subset of functions needed for a roomserver NID cache.
type RoomVersionCache ¶
type RoomVersionCache interface { GetRoomVersion(roomID string) (roomVersion gomatrixserverlib.RoomVersion, ok bool) StoreRoomVersion(roomID string, roomVersion gomatrixserverlib.RoomVersion) }
RoomVersionsCache contains the subset of functions needed for a room version cache.
type ServerKeyCache ¶
type ServerKeyCache interface { // request -> timestamp is emulating gomatrixserverlib.FetchKeys: // https://github.com/matrix-org/gomatrixserverlib/blob/f69539c86ea55d1e2cc76fd8e944e2d82d30397c/keyring.go#L95 // The timestamp should be the timestamp of the event that is being // verified. We will not return keys from the cache that are not valid // at this timestamp. GetServerKey(request gomatrixserverlib.PublicKeyLookupRequest, timestamp gomatrixserverlib.Timestamp) (response gomatrixserverlib.PublicKeyLookupResult, ok bool) // request -> result is emulating gomatrixserverlib.StoreKeys: // https://github.com/matrix-org/gomatrixserverlib/blob/f69539c86ea55d1e2cc76fd8e944e2d82d30397c/keyring.go#L112 StoreServerKey(request gomatrixserverlib.PublicKeyLookupRequest, response gomatrixserverlib.PublicKeyLookupResult) }
ServerKeyCache contains the subset of functions needed for a server key cache.