aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage/shared
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-12 14:55:57 +0100
committerGitHub <noreply@github.com>2020-06-12 14:55:57 +0100
commitecd7accbad724f26248498a9035a1fbc69e2f08d (patch)
treede2c795b209c4527bc907570dfd1308cfa19be6f /syncapi/storage/shared
parent4675e1ddb6a48fe1425032dc4f3cef56cbde7243 (diff)
Rehuffle where things are in the internal package (#1122)
renamed: internal/eventcontent.go -> internal/eventutil/eventcontent.go renamed: internal/events.go -> internal/eventutil/events.go renamed: internal/types.go -> internal/eventutil/types.go renamed: internal/http/http.go -> internal/httputil/http.go renamed: internal/httpapi.go -> internal/httputil/httpapi.go renamed: internal/httpapi_test.go -> internal/httputil/httpapi_test.go renamed: internal/httpapis/paths.go -> internal/httputil/paths.go renamed: internal/routing.go -> internal/httputil/routing.go renamed: internal/basecomponent/base.go -> internal/setup/base.go renamed: internal/basecomponent/flags.go -> internal/setup/flags.go renamed: internal/partition_offset_table.go -> internal/sqlutil/partition_offset_table.go renamed: internal/postgres.go -> internal/sqlutil/postgres.go renamed: internal/postgres_wasm.go -> internal/sqlutil/postgres_wasm.go renamed: internal/sql.go -> internal/sqlutil/sql.go
Diffstat (limited to 'syncapi/storage/shared')
-rw-r--r--syncapi/storage/shared/syncserver.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go
index 497c043a..21d8df37 100644
--- a/syncapi/storage/shared/syncserver.go
+++ b/syncapi/storage/shared/syncserver.go
@@ -23,7 +23,7 @@ import (
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
"github.com/matrix-org/dendrite/eduserver/cache"
- "github.com/matrix-org/dendrite/internal"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
@@ -42,7 +42,7 @@ type Database struct {
CurrentRoomState tables.CurrentRoomState
BackwardExtremities tables.BackwardsExtremities
SendToDevice tables.SendToDevice
- SendToDeviceWriter *internal.TransactionWriter
+ SendToDeviceWriter *sqlutil.TransactionWriter
EDUCache *cache.EDUCache
}
@@ -126,7 +126,7 @@ func (d *Database) GetStateEvent(
func (d *Database) GetStateEventsForRoom(
ctx context.Context, roomID string, stateFilter *gomatrixserverlib.StateFilter,
) (stateEvents []gomatrixserverlib.HeaderedEvent, err error) {
- err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
stateEvents, err = d.CurrentRoomState.SelectCurrentState(ctx, txn, roomID, stateFilter)
return err
})
@@ -136,7 +136,7 @@ func (d *Database) GetStateEventsForRoom(
func (d *Database) SyncStreamPosition(ctx context.Context) (types.StreamPosition, error) {
var maxID int64
var err error
- err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
maxID, err = d.OutputEvents.SelectMaxEventID(ctx, txn)
if err != nil {
return err
@@ -168,7 +168,7 @@ func (d *Database) SyncStreamPosition(ctx context.Context) (types.StreamPosition
func (d *Database) AddInviteEvent(
ctx context.Context, inviteEvent gomatrixserverlib.HeaderedEvent,
) (sp types.StreamPosition, err error) {
- err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
sp, err = d.Invites.InsertInviteEvent(ctx, txn, inviteEvent)
return err
})
@@ -207,7 +207,7 @@ func (d *Database) GetAccountDataInRange(
func (d *Database) UpsertAccountData(
ctx context.Context, userID, roomID, dataType string,
) (sp types.StreamPosition, err error) {
- err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
sp, err = d.AccountData.InsertAccountData(ctx, txn, userID, roomID, dataType)
return err
})
@@ -275,7 +275,7 @@ func (d *Database) WriteEvent(
addStateEventIDs, removeStateEventIDs []string,
transactionID *api.TransactionID, excludeFromSync bool,
) (pduPosition types.StreamPosition, returnErr error) {
- returnErr = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ returnErr = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
var err error
pos, err := d.OutputEvents.InsertEvent(
ctx, txn, ev, addStateEventIDs, removeStateEventIDs, transactionID, excludeFromSync,
@@ -375,7 +375,7 @@ func (d *Database) GetEventsInTopologicalRange(
}
func (d *Database) SyncPosition(ctx context.Context) (tok types.StreamingToken, err error) {
- err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = sqlutil.WithTransaction(d.DB, func(txn *sql.Tx) error {
pos, err := d.syncPositionTx(ctx, txn)
if err != nil {
return err
@@ -454,7 +454,7 @@ func (d *Database) addPDUDeltaToResponse(
}
var succeeded bool
defer func() {
- txerr := internal.EndTransaction(txn, &succeeded)
+ txerr := sqlutil.EndTransaction(txn, &succeeded)
if err == nil && txerr != nil {
err = txerr
}
@@ -608,7 +608,7 @@ func (d *Database) getResponseWithPDUsForCompleteSync(
}
var succeeded bool
defer func() {
- txerr := internal.EndTransaction(txn, &succeeded)
+ txerr := sqlutil.EndTransaction(txn, &succeeded)
if err == nil && txerr != nil {
err = txerr
}