appservice

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)

NewDatabase opens a new database base.Cfg.Database.ApplicationService

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func (*Database) CountEventsWithAppServiceID

func (d *Database) CountEventsWithAppServiceID(
	ctx context.Context,
	appServiceID string,
) (int, error)

CountEventsWithAppServiceID returns the number of events destined for an application service given its ID.

func (*Database) GetEncMsgEventsTotal

func (d *Database) GetEncMsgEventsTotal(
	ctx context.Context,
) (count int, err error)

func (*Database) GetEncMsgEventsWithLimit

func (d *Database) GetEncMsgEventsWithLimit(
	ctx context.Context, limit, offset int64,
) ([]int64, [][]byte, error)

func (*Database) GetEventsWithAppServiceID

func (d *Database) GetEventsWithAppServiceID(
	ctx context.Context,
	appServiceID string,
	limit int,
) (int, int, []gomatrixserverlib.ClientEvent, bool, error)

GetEventsWithAppServiceID returns a slice of events and their IDs intended to be sent to an application service given its ID.

func (*Database) GetLatestTxnID

func (d *Database) GetLatestTxnID(
	ctx context.Context,
) (int, error)

GetLatestTxnID returns the latest available transaction id

func (*Database) GetMsgEventsTotal

func (d *Database) GetMsgEventsTotal(
	ctx context.Context,
) (count int, minID int64, err error)

func (*Database) GetMsgEventsWithLimit

func (d *Database) GetMsgEventsWithLimit(
	ctx context.Context, limit, offset int64,
) ([]int64, [][]byte, error)

func (*Database) RemoveEventsBeforeAndIncludingID

func (d *Database) RemoveEventsBeforeAndIncludingID(
	ctx context.Context,
	appserviceID string,
	eventTableID int,
) error

RemoveEventsBeforeAndIncludingID removes all events from the database that are less than or equal to a given maximum ID. IDs here are implemented as a serial, thus this should always delete events in chronological order.

func (*Database) SetGauge

func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)

func (*Database) StoreEvent

func (d *Database) StoreEvent(
	ctx context.Context,
	appServiceID string,
	event *gomatrixserverlib.ClientEvent,
) error

StoreEvent takes in a gomatrixserverlib.ClientEvent and stores it in the database for a transaction worker to pull and later send to an application service.

func (*Database) UpdateMsgEvent

func (d *Database) UpdateMsgEvent(
	ctx context.Context, id int64, NewBytes []byte,
) error

func (*Database) UpdateTxnIDForEvents

func (d *Database) UpdateTxnIDForEvents(
	ctx context.Context,
	appserviceID string,
	maxID, txnID int,
) error

UpdateTxnIDForEvents takes in an application service ID and a and stores them in the DB, unless the pair already exists, in which case it updates them.

Jump to

Keyboard shortcuts

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