basecomponent

package
v0.0.0-...-9835270 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFlags

func ParseFlags()

ParseFlags parses the commandline flags and uses them to create a config. If running as a monolith use `ParseMonolithFlags` instead.

func ParseMonolithFlags

func ParseMonolithFlags()

ParseMonolithFlags parses the commandline flags and uses them to create a config. Should only be used if running a monolith. See `ParseFlags`.

Types

type BaseDendrite

type BaseDendrite struct {
	ComponentName string

	// APIMux should be used to register new public matrix api endpoints
	APIMux     *mux.Router
	Cfg        *config.Dendrite
	RedisCache service.Cache
	// contains filtered or unexported fields
}

BaseDendrite is a base for creating new instances of dendrite. It parses command line flags and config, and exposes methods for creating various resources. All errors are handled by logging then exiting, so all methods should only be used during start up. Must be closed when shutting down.

func NewBaseDendrite

func NewBaseDendrite(cfg *config.Dendrite, componentName string) *BaseDendrite

NewBaseDendrite creates a new instance to be used by a component. The componentName is used for logging purposes, and should be a friendly name of the compontent running, e.g. "SyncAPI"

func (*BaseDendrite) CheckDomainCfg

func (b *BaseDendrite) CheckDomainCfg()

func (*BaseDendrite) Close

func (b *BaseDendrite) Close() error

Close implements io.Closer

func (*BaseDendrite) CreateAccountsDB

func (b *BaseDendrite) CreateAccountsDB() model.AccountsDatabase

CreateAccountsDB creates a new instance of the accounts database. Should only be called once per component.

func (*BaseDendrite) CreateApplicationServiceDB

func (b *BaseDendrite) CreateApplicationServiceDB() model.AppServiceDatabase

func (*BaseDendrite) CreateDeviceDB

func (b *BaseDendrite) CreateDeviceDB() model.DeviceDatabase

CreateDeviceDB creates a new instance of the device database. Should only be called once per component.

func (*BaseDendrite) CreateEncryptApiDB

func (b *BaseDendrite) CreateEncryptApiDB() model.EncryptorAPIDatabase

func (*BaseDendrite) CreateFederationClient

func (b *BaseDendrite) CreateFederationClient() *gomatrixserverlib.FederationClient

CreateFederationClient creates a new federation client. Should only be called once per component.

func (*BaseDendrite) CreateKeyDB

func (b *BaseDendrite) CreateKeyDB() model.KeyDatabase

CreateKeyDB creates a new instance of the key database. Should only be called once per component.

func (b *BaseDendrite) CreateKeyDB() *keydb.Database {
	db, err := keydb.NewDatabase(b.Cfg.Database.ServerKey.Driver, b.Cfg.Database.ServerKey.Addresses)
	if err != nil {
		log.Panicf("failed to connect to keys db err:%v", err)
	}

	return db
}

func (*BaseDendrite) CreatePresenceDB

func (b *BaseDendrite) CreatePresenceDB() model.PresenceDatabase

func (*BaseDendrite) CreatePublicRoomApiDB

func (b *BaseDendrite) CreatePublicRoomApiDB() model.PublicRoomAPIDatabase

func (*BaseDendrite) CreatePushApiDB

func (b *BaseDendrite) CreatePushApiDB() model.PushAPIDatabase

func (*BaseDendrite) CreateRoomDB

func (b *BaseDendrite) CreateRoomDB() model.RoomServerDatabase

func (*BaseDendrite) CreateRsRPCCli

func (b *BaseDendrite) CreateRsRPCCli(rpcCli *common.RpcClient) roomserverapi.RoomserverRPCAPI

CreateRsRPCCli returns the AliasAPI and QueryAPI to hit the roomserver over tcp.

func (*BaseDendrite) CreateServerConfDB

func (b *BaseDendrite) CreateServerConfDB() model.ConfigDatabase

func (*BaseDendrite) CreateSyncDB

func (b *BaseDendrite) CreateSyncDB() model.SyncAPIDatabase

func (*BaseDendrite) PrepareCache

func (b *BaseDendrite) PrepareCache() service.Cache

func (*BaseDendrite) SetupAndServeHTTP

func (b *BaseDendrite) SetupAndServeHTTP(addr string)

SetupAndServeHTTP sets up the HTTP server to serve endpoints registered on ApiMux under /api/ and adds a prometheus handler under /metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL