base

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 35 Imported by: 153

Documentation

Index

Constants

View Source
const HTTPServerTimeout = time.Minute * 5

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDendrite

type BaseDendrite struct {
	*process.ProcessContext

	PublicClientAPIMux     *mux.Router
	PublicFederationAPIMux *mux.Router
	PublicKeyAPIMux        *mux.Router
	PublicMediaAPIMux      *mux.Router
	PublicWellKnownAPIMux  *mux.Router
	PublicStaticMux        *mux.Router
	DendriteAdminMux       *mux.Router
	SynapseAdminMux        *mux.Router
	NATS                   *jetstream.NATSInstance
	Cfg                    *config.Dendrite
	Caches                 *caching.Caches
	DNSCache               *gomatrixserverlib.DNSCache
	Database               *sql.DB
	DatabaseWriter         sqlutil.Writer
	EnableMetrics          bool
	Fulltext               *fulltext.Search
	// 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, options ...BaseDendriteOptions) *BaseDendrite

NewBaseDendrite creates a new instance to be used by a component.

func (*BaseDendrite) Close

func (b *BaseDendrite) Close() error

Close implements io.Closer

func (*BaseDendrite) ConfigureAdminEndpoints added in v0.10.9

func (b *BaseDendrite) ConfigureAdminEndpoints()

func (*BaseDendrite) CreateClient

func (b *BaseDendrite) CreateClient() *gomatrixserverlib.Client

CreateClient creates a new client (normally used for media fetch requests). Should only be called once per component.

func (*BaseDendrite) CreateFederationClient

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

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

func (*BaseDendrite) DatabaseConnection added in v0.8.3

func (b *BaseDendrite) DatabaseConnection(dbProperties *config.DatabaseOptions, writer sqlutil.Writer) (*sql.DB, sqlutil.Writer, error)

DatabaseConnection assists in setting up a database connection. It accepts the database properties and a new writer for the given component. If we're running in monolith mode with a global connection pool configured then we will return that connection, along with the global writer, effectively ignoring the options provided. Otherwise we'll open a new database connection using the supplied options and writer. Note that it's possible for the pointer receiver to be nil here – that's deliberate as some of the unit tests don't have a BaseDendrite and just want a connection with the supplied config without any pooling stuff.

func (*BaseDendrite) PushGatewayHTTPClient added in v0.6.5

func (b *BaseDendrite) PushGatewayHTTPClient() pushgateway.Client

PushGatewayHTTPClient returns a new client for interacting with (external) Push Gateways.

func (*BaseDendrite) SetupAndServeHTTP

func (b *BaseDendrite) SetupAndServeHTTP(
	externalHTTPAddr config.ServerAddress,
	certFile, keyFile *string,
)

SetupAndServeHTTP sets up the HTTP server to serve client & federation APIs and adds a prometheus handler under /_dendrite/metrics.

func (*BaseDendrite) WaitForShutdown

func (b *BaseDendrite) WaitForShutdown()

type BaseDendriteOptions

type BaseDendriteOptions int
const (
	DisableMetrics BaseDendriteOptions = iota
)

Jump to

Keyboard shortcuts

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