Documentation
¶
Index ¶
- func NewDatabase(driver, createAddr, address, underlying, topic string, useAsync bool) (interface{}, error)
- type Database
- func (d *Database) CountEventsWithAppServiceID(ctx context.Context, appServiceID string) (int, error)
- func (d *Database) GetEncMsgEventsTotal(ctx context.Context) (count int, err error)
- func (d *Database) GetEncMsgEventsWithLimit(ctx context.Context, limit, offset int64) ([]int64, [][]byte, error)
- func (d *Database) GetEventsWithAppServiceID(ctx context.Context, appServiceID string, limit int) (int, int, []gomatrixserverlib.ClientEvent, bool, error)
- func (d *Database) GetLatestTxnID(ctx context.Context) (int, error)
- func (d *Database) GetMsgEventsTotal(ctx context.Context) (count int, minID int64, err error)
- func (d *Database) GetMsgEventsWithLimit(ctx context.Context, limit, offset int64) ([]int64, [][]byte, error)
- func (d *Database) RemoveEventsBeforeAndIncludingID(ctx context.Context, appserviceID string, eventTableID int) error
- func (d *Database) SetGauge(qryDBGauge mon.LabeledGauge)
- func (d *Database) StoreEvent(ctx context.Context, appServiceID string, event *gomatrixserverlib.ClientEvent) error
- func (d *Database) UpdateMsgEvent(ctx context.Context, id int64, NewBytes []byte) error
- func (d *Database) UpdateTxnIDForEvents(ctx context.Context, appserviceID string, maxID, txnID int) error
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 (*Database) GetEncMsgEventsWithLimit ¶
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 ¶
GetLatestTxnID returns the latest available transaction id
func (*Database) GetMsgEventsTotal ¶
func (*Database) GetMsgEventsWithLimit ¶
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 (*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.