aboutsummaryrefslogtreecommitdiff
path: root/syncapi
diff options
context:
space:
mode:
Diffstat (limited to 'syncapi')
-rw-r--r--syncapi/api/query.go10
-rw-r--r--syncapi/consumers/clientapi.go10
-rw-r--r--syncapi/consumers/eduserver.go8
-rw-r--r--syncapi/consumers/roomserver.go8
-rw-r--r--syncapi/routing/messages.go2
-rw-r--r--syncapi/routing/routing.go10
-rw-r--r--syncapi/storage/interface.go4
-rw-r--r--syncapi/storage/postgres/account_data_table.go6
-rw-r--r--syncapi/storage/postgres/backwards_extremities_table.go4
-rw-r--r--syncapi/storage/postgres/current_room_state_table.go20
-rw-r--r--syncapi/storage/postgres/invites_table.go8
-rw-r--r--syncapi/storage/postgres/output_room_events_table.go24
-rw-r--r--syncapi/storage/postgres/output_room_events_topology_table.go4
-rw-r--r--syncapi/storage/postgres/syncserver.go6
-rw-r--r--syncapi/storage/shared/syncserver.go18
-rw-r--r--syncapi/storage/sqlite3/account_data_table.go4
-rw-r--r--syncapi/storage/sqlite3/backwards_extremities_table.go4
-rw-r--r--syncapi/storage/sqlite3/current_room_state_table.go20
-rw-r--r--syncapi/storage/sqlite3/invites_table.go8
-rw-r--r--syncapi/storage/sqlite3/output_room_events_table.go22
-rw-r--r--syncapi/storage/sqlite3/output_room_events_topology_table.go12
-rw-r--r--syncapi/storage/sqlite3/stream_id_table.go6
-rw-r--r--syncapi/storage/sqlite3/syncserver.go6
-rw-r--r--syncapi/storage/storage.go4
-rw-r--r--syncapi/storage/storage_wasm.go4
-rw-r--r--syncapi/syncapi.go4
26 files changed, 118 insertions, 118 deletions
diff --git a/syncapi/api/query.go b/syncapi/api/query.go
index 2993829e..6585bc09 100644
--- a/syncapi/api/query.go
+++ b/syncapi/api/query.go
@@ -18,7 +18,7 @@ import (
"context"
"net/http"
- commonHTTP "github.com/matrix-org/dendrite/common/http"
+ internalHTTP "github.com/matrix-org/dendrite/internal/http"
"github.com/matrix-org/util"
opentracing "github.com/opentracing/opentracing-go"
)
@@ -80,7 +80,7 @@ func (h *httpSyncQueryAPI) QuerySync(
defer span.Finish()
apiURL := h.syncapiURL + SyncAPIQuerySyncPath
- return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
+ return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
// QueryStateAfterEvents implements SyncQueryAPI
@@ -93,7 +93,7 @@ func (h *httpSyncQueryAPI) QueryState(
defer span.Finish()
apiURL := h.syncapiURL + SyncAPIQueryStatePath
- return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
+ return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
// QueryEventsByID implements SyncQueryAPI
@@ -106,7 +106,7 @@ func (h *httpSyncQueryAPI) QueryStateType(
defer span.Finish()
apiURL := h.syncapiURL + SyncAPIQueryStateTypePath
- return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
+ return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
// QueryMembershipForUser implements SyncQueryAPI
@@ -119,5 +119,5 @@ func (h *httpSyncQueryAPI) QueryMessages(
defer span.Finish()
apiURL := h.syncapiURL + SyncAPIQueryMessagesPath
- return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
+ return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
diff --git a/syncapi/consumers/clientapi.go b/syncapi/consumers/clientapi.go
index b65d01a0..4d43e811 100644
--- a/syncapi/consumers/clientapi.go
+++ b/syncapi/consumers/clientapi.go
@@ -19,8 +19,8 @@ import (
"encoding/json"
"github.com/Shopify/sarama"
- "github.com/matrix-org/dendrite/common"
- "github.com/matrix-org/dendrite/common/config"
+ "github.com/matrix-org/dendrite/internal"
+ "github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/sync"
"github.com/matrix-org/dendrite/syncapi/types"
@@ -29,7 +29,7 @@ import (
// OutputClientDataConsumer consumes events that originated in the client API server.
type OutputClientDataConsumer struct {
- clientAPIConsumer *common.ContinualConsumer
+ clientAPIConsumer *internal.ContinualConsumer
db storage.Database
notifier *sync.Notifier
}
@@ -42,7 +42,7 @@ func NewOutputClientDataConsumer(
store storage.Database,
) *OutputClientDataConsumer {
- consumer := common.ContinualConsumer{
+ consumer := internal.ContinualConsumer{
Topic: string(cfg.Kafka.Topics.OutputClientData),
Consumer: kafkaConsumer,
PartitionStore: store,
@@ -67,7 +67,7 @@ func (s *OutputClientDataConsumer) Start() error {
// sync stream position may race and be incorrectly calculated.
func (s *OutputClientDataConsumer) onMessage(msg *sarama.ConsumerMessage) error {
// Parse out the event JSON
- var output common.AccountData
+ var output internal.AccountData
if err := json.Unmarshal(msg.Value, &output); err != nil {
// If the message was invalid, log it and move on to the next message in the stream
log.WithError(err).Errorf("client API server output log: message parse failure")
diff --git a/syncapi/consumers/eduserver.go b/syncapi/consumers/eduserver.go
index ece999d5..12b1efbc 100644
--- a/syncapi/consumers/eduserver.go
+++ b/syncapi/consumers/eduserver.go
@@ -18,9 +18,9 @@ import (
"encoding/json"
"github.com/Shopify/sarama"
- "github.com/matrix-org/dendrite/common"
- "github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/eduserver/api"
+ "github.com/matrix-org/dendrite/internal"
+ "github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/sync"
"github.com/matrix-org/dendrite/syncapi/types"
@@ -29,7 +29,7 @@ import (
// OutputTypingEventConsumer consumes events that originated in the EDU server.
type OutputTypingEventConsumer struct {
- typingConsumer *common.ContinualConsumer
+ typingConsumer *internal.ContinualConsumer
db storage.Database
notifier *sync.Notifier
}
@@ -43,7 +43,7 @@ func NewOutputTypingEventConsumer(
store storage.Database,
) *OutputTypingEventConsumer {
- consumer := common.ContinualConsumer{
+ consumer := internal.ContinualConsumer{
Topic: string(cfg.Kafka.Topics.OutputTypingEvent),
Consumer: kafkaConsumer,
PartitionStore: store,
diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go
index 368420a6..055f7660 100644
--- a/syncapi/consumers/roomserver.go
+++ b/syncapi/consumers/roomserver.go
@@ -20,8 +20,8 @@ import (
"fmt"
"github.com/Shopify/sarama"
- "github.com/matrix-org/dendrite/common"
- "github.com/matrix-org/dendrite/common/config"
+ "github.com/matrix-org/dendrite/internal"
+ "github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/sync"
@@ -33,7 +33,7 @@ import (
// OutputRoomEventConsumer consumes events that originated in the room server.
type OutputRoomEventConsumer struct {
rsAPI api.RoomserverInternalAPI
- rsConsumer *common.ContinualConsumer
+ rsConsumer *internal.ContinualConsumer
db storage.Database
notifier *sync.Notifier
}
@@ -47,7 +47,7 @@ func NewOutputRoomEventConsumer(
rsAPI api.RoomserverInternalAPI,
) *OutputRoomEventConsumer {
- consumer := common.ContinualConsumer{
+ consumer := internal.ContinualConsumer{
Topic: string(cfg.Kafka.Topics.OutputRoomEvent),
Consumer: kafkaConsumer,
PartitionStore: store,
diff --git a/syncapi/routing/messages.go b/syncapi/routing/messages.go
index 88e16fe5..8c897634 100644
--- a/syncapi/routing/messages.go
+++ b/syncapi/routing/messages.go
@@ -22,7 +22,7 @@ import (
"strconv"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
- "github.com/matrix-org/dendrite/common/config"
+ "github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/types"
diff --git a/syncapi/routing/routing.go b/syncapi/routing/routing.go
index 5a36a279..6300b17b 100644
--- a/syncapi/routing/routing.go
+++ b/syncapi/routing/routing.go
@@ -21,8 +21,8 @@ import (
"github.com/matrix-org/dendrite/clientapi/auth"
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
- "github.com/matrix-org/dendrite/common"
- "github.com/matrix-org/dendrite/common/config"
+ "github.com/matrix-org/dendrite/internal"
+ "github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/sync"
@@ -52,12 +52,12 @@ func Setup(
}
// TODO: Add AS support for all handlers below.
- r0mux.Handle("/sync", common.MakeAuthAPI("sync", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
+ r0mux.Handle("/sync", internal.MakeAuthAPI("sync", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return srp.OnIncomingSyncRequest(req, device)
})).Methods(http.MethodGet, http.MethodOptions)
- r0mux.Handle("/rooms/{roomID}/messages", common.MakeAuthAPI("room_messages", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
- vars, err := common.URLDecodeMapValues(mux.Vars(req))
+ r0mux.Handle("/rooms/{roomID}/messages", internal.MakeAuthAPI("room_messages", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
+ vars, err := internal.URLDecodeMapValues(mux.Vars(req))
if err != nil {
return util.ErrorResponse(err)
}
diff --git a/syncapi/storage/interface.go b/syncapi/storage/interface.go
index 121e94c7..3e9ff053 100644
--- a/syncapi/storage/interface.go
+++ b/syncapi/storage/interface.go
@@ -19,15 +19,15 @@ import (
"time"
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/eduserver/cache"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
)
type Database interface {
- common.PartitionStorer
+ internal.PartitionStorer
// AllJoinedUsersInRooms returns a map of room ID to a list of all joined user IDs.
AllJoinedUsersInRooms(ctx context.Context) (map[string][]string, error)
// Events lookups a list of event by their event ID.
diff --git a/syncapi/storage/postgres/account_data_table.go b/syncapi/storage/postgres/account_data_table.go
index a5e0c121..e0b87bd6 100644
--- a/syncapi/storage/postgres/account_data_table.go
+++ b/syncapi/storage/postgres/account_data_table.go
@@ -20,7 +20,7 @@ import (
"database/sql"
"github.com/lib/pq"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
@@ -113,7 +113,7 @@ func (s *accountDataStatements) SelectAccountDataInRange(
if err != nil {
return
}
- defer common.CloseAndLogIfError(ctx, rows, "selectAccountDataInRange: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectAccountDataInRange: rows.close() failed")
for rows.Next() {
var dataType string
@@ -136,7 +136,7 @@ func (s *accountDataStatements) SelectMaxAccountDataID(
ctx context.Context, txn *sql.Tx,
) (id int64, err error) {
var nullableID sql.NullInt64
- stmt := common.TxStmt(txn, s.selectMaxAccountDataIDStmt)
+ stmt := internal.TxStmt(txn, s.selectMaxAccountDataIDStmt)
err = stmt.QueryRowContext(ctx).Scan(&nullableID)
if nullableID.Valid {
id = nullableID.Int64
diff --git a/syncapi/storage/postgres/backwards_extremities_table.go b/syncapi/storage/postgres/backwards_extremities_table.go
index fa498a40..71569a10 100644
--- a/syncapi/storage/postgres/backwards_extremities_table.go
+++ b/syncapi/storage/postgres/backwards_extremities_table.go
@@ -18,7 +18,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
)
@@ -84,7 +84,7 @@ func (s *backwardExtremitiesStatements) SelectBackwardExtremitiesForRoom(
if err != nil {
return
}
- defer common.CloseAndLogIfError(ctx, rows, "selectBackwardExtremitiesForRoom: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectBackwardExtremitiesForRoom: rows.close() failed")
bwExtrems = make(map[string][]string)
for rows.Next() {
diff --git a/syncapi/storage/postgres/current_room_state_table.go b/syncapi/storage/postgres/current_room_state_table.go
index b6ab7221..cc0fb6b1 100644
--- a/syncapi/storage/postgres/current_room_state_table.go
+++ b/syncapi/storage/postgres/current_room_state_table.go
@@ -21,7 +21,7 @@ import (
"encoding/json"
"github.com/lib/pq"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
@@ -142,7 +142,7 @@ func (s *currentRoomStateStatements) SelectJoinedUsers(
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectJoinedUsers: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectJoinedUsers: rows.close() failed")
result := make(map[string][]string)
for rows.Next() {
@@ -165,12 +165,12 @@ func (s *currentRoomStateStatements) SelectRoomIDsWithMembership(
userID string,
membership string, // nolint: unparam
) ([]string, error) {
- stmt := common.TxStmt(txn, s.selectRoomIDsWithMembershipStmt)
+ stmt := internal.TxStmt(txn, s.selectRoomIDsWithMembershipStmt)
rows, err := stmt.QueryContext(ctx, userID, membership)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectRoomIDsWithMembership: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectRoomIDsWithMembership: rows.close() failed")
var result []string
for rows.Next() {
@@ -188,7 +188,7 @@ func (s *currentRoomStateStatements) SelectCurrentState(
ctx context.Context, txn *sql.Tx, roomID string,
stateFilter *gomatrixserverlib.StateFilter,
) ([]gomatrixserverlib.HeaderedEvent, error) {
- stmt := common.TxStmt(txn, s.selectCurrentStateStmt)
+ stmt := internal.TxStmt(txn, s.selectCurrentStateStmt)
rows, err := stmt.QueryContext(ctx, roomID,
pq.StringArray(stateFilter.Senders),
pq.StringArray(stateFilter.NotSenders),
@@ -200,7 +200,7 @@ func (s *currentRoomStateStatements) SelectCurrentState(
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectCurrentState: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectCurrentState: rows.close() failed")
return rowsToEvents(rows)
}
@@ -208,7 +208,7 @@ func (s *currentRoomStateStatements) SelectCurrentState(
func (s *currentRoomStateStatements) DeleteRoomStateByEventID(
ctx context.Context, txn *sql.Tx, eventID string,
) error {
- stmt := common.TxStmt(txn, s.deleteRoomStateByEventIDStmt)
+ stmt := internal.TxStmt(txn, s.deleteRoomStateByEventIDStmt)
_, err := stmt.ExecContext(ctx, eventID)
return err
}
@@ -231,7 +231,7 @@ func (s *currentRoomStateStatements) UpsertRoomState(
}
// upsert state event
- stmt := common.TxStmt(txn, s.upsertRoomStateStmt)
+ stmt := internal.TxStmt(txn, s.upsertRoomStateStmt)
_, err = stmt.ExecContext(
ctx,
event.RoomID(),
@@ -250,12 +250,12 @@ func (s *currentRoomStateStatements) UpsertRoomState(
func (s *currentRoomStateStatements) SelectEventsWithEventIDs(
ctx context.Context, txn *sql.Tx, eventIDs []string,
) ([]types.StreamEvent, error) {
- stmt := common.TxStmt(txn, s.selectEventsWithEventIDsStmt)
+ stmt := internal.TxStmt(txn, s.selectEventsWithEventIDsStmt)
rows, err := stmt.QueryContext(ctx, pq.StringArray(eventIDs))
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectEventsWithEventIDs: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectEventsWithEventIDs: rows.close() failed")
return rowsToStreamEvents(rows)
}
diff --git a/syncapi/storage/postgres/invites_table.go b/syncapi/storage/postgres/invites_table.go
index 01f2e7f4..caa12d2f 100644
--- a/syncapi/storage/postgres/invites_table.go
+++ b/syncapi/storage/postgres/invites_table.go
@@ -20,7 +20,7 @@ import (
"database/sql"
"encoding/json"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
@@ -119,12 +119,12 @@ func (s *inviteEventsStatements) DeleteInviteEvent(
func (s *inviteEventsStatements) SelectInviteEventsInRange(
ctx context.Context, txn *sql.Tx, targetUserID string, r types.Range,
) (map[string]gomatrixserverlib.HeaderedEvent, error) {
- stmt := common.TxStmt(txn, s.selectInviteEventsInRangeStmt)
+ stmt := internal.TxStmt(txn, s.selectInviteEventsInRangeStmt)
rows, err := stmt.QueryContext(ctx, targetUserID, r.Low(), r.High())
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectInviteEventsInRange: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectInviteEventsInRange: rows.close() failed")
result := map[string]gomatrixserverlib.HeaderedEvent{}
for rows.Next() {
var (
@@ -149,7 +149,7 @@ func (s *inviteEventsStatements) SelectMaxInviteID(
ctx context.Context, txn *sql.Tx,
) (id int64, err error) {
var nullableID sql.NullInt64
- stmt := common.TxStmt(txn, s.selectMaxInviteIDStmt)
+ stmt := internal.TxStmt(txn, s.selectMaxInviteIDStmt)
err = stmt.QueryRowContext(ctx).Scan(&nullableID)
if nullableID.Valid {
id = nullableID.Int64
diff --git a/syncapi/storage/postgres/output_room_events_table.go b/syncapi/storage/postgres/output_room_events_table.go
index 5020d1e7..ae6dfb38 100644
--- a/syncapi/storage/postgres/output_room_events_table.go
+++ b/syncapi/storage/postgres/output_room_events_table.go
@@ -26,7 +26,7 @@ import (
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/lib/pq"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/gomatrixserverlib"
log "github.com/sirupsen/logrus"
)
@@ -158,7 +158,7 @@ func (s *outputRoomEventsStatements) SelectStateInRange(
ctx context.Context, txn *sql.Tx, r types.Range,
stateFilter *gomatrixserverlib.StateFilter,
) (map[string]map[string]bool, map[string]types.StreamEvent, error) {
- stmt := common.TxStmt(txn, s.selectStateInRangeStmt)
+ stmt := internal.TxStmt(txn, s.selectStateInRangeStmt)
rows, err := stmt.QueryContext(
ctx, r.Low(), r.High(),
@@ -172,7 +172,7 @@ func (s *outputRoomEventsStatements) SelectStateInRange(
if err != nil {
return nil, nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectStateInRange: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectStateInRange: rows.close() failed")
// Fetch all the state change events for all rooms between the two positions then loop each event and:
// - Keep a cache of the event by ID (99% of state change events are for the event itself)
// - For each room ID, build up an array of event IDs which represents cumulative adds/removes
@@ -239,7 +239,7 @@ func (s *outputRoomEventsStatements) SelectMaxEventID(
ctx context.Context, txn *sql.Tx,
) (id int64, err error) {
var nullableID sql.NullInt64
- stmt := common.TxStmt(txn, s.selectMaxEventIDStmt)
+ stmt := internal.TxStmt(txn, s.selectMaxEventIDStmt)
err = stmt.QueryRowContext(ctx).Scan(&nullableID)
if nullableID.Valid {
id = nullableID.Int64
@@ -275,7 +275,7 @@ func (s *outputRoomEventsStatements) InsertEvent(
return
}
- stmt := common.TxStmt(txn, s.insertEventStmt)
+ stmt := internal.TxStmt(txn, s.insertEventStmt)
err = stmt.QueryRowContext(
ctx,
event.RoomID(),
@@ -303,15 +303,15 @@ func (s *outputRoomEventsStatements) SelectRecentEvents(
) ([]types.StreamEvent, error) {
var stmt *sql.Stmt
if onlySyncEvents {
- stmt = common.TxStmt(txn, s.selectRecentEventsForSyncStmt)
+ stmt = internal.TxStmt(txn, s.selectRecentEventsForSyncStmt)
} else {
- stmt = common.TxStmt(txn, s.selectRecentEventsStmt)
+ stmt = internal.TxStmt(txn, s.selectRecentEventsStmt)
}
rows, err := stmt.QueryContext(ctx, roomID, r.Low(), r.High(), limit)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectRecentEvents: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectRecentEvents: rows.close() failed")
events, err := rowsToStreamEvents(rows)
if err != nil {
return nil, err
@@ -333,12 +333,12 @@ func (s *outputRoomEventsStatements) SelectEarlyEvents(
ctx context.Context, txn *sql.Tx,
roomID string, r types.Range, limit int,
) ([]types.StreamEvent, error) {
- stmt := common.TxStmt(txn, s.selectEarlyEventsStmt)
+ stmt := internal.TxStmt(txn, s.selectEarlyEventsStmt)
rows, err := stmt.QueryContext(ctx, roomID, r.Low(), r.High(), limit)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectEarlyEvents: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectEarlyEvents: rows.close() failed")
events, err := rowsToStreamEvents(rows)
if err != nil {
return nil, err
@@ -357,12 +357,12 @@ func (s *outputRoomEventsStatements) SelectEarlyEvents(
func (s *outputRoomEventsStatements) SelectEvents(
ctx context.Context, txn *sql.Tx, eventIDs []string,
) ([]types.StreamEvent, error) {
- stmt := common.TxStmt(txn, s.selectEventsStmt)
+ stmt := internal.TxStmt(txn, s.selectEventsStmt)
rows, err := stmt.QueryContext(ctx, pq.StringArray(eventIDs))
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectEvents: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectEvents: rows.close() failed")
return rowsToStreamEvents(rows)
}
diff --git a/syncapi/storage/postgres/output_room_events_topology_table.go b/syncapi/storage/postgres/output_room_events_topology_table.go
index 9fc5f519..ffbeece3 100644
--- a/syncapi/storage/postgres/output_room_events_topology_table.go
+++ b/syncapi/storage/postgres/output_room_events_topology_table.go
@@ -18,7 +18,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
@@ -139,7 +139,7 @@ func (s *outputRoomEventsTopologyStatements) SelectEventIDsInRange(
} else if err != nil {
return
}
- defer common.CloseAndLogIfError(ctx, rows, "selectEventIDsInRange: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectEventIDsInRange: rows.close() failed")
// Return the IDs.
var eventID string
diff --git a/syncapi/storage/postgres/syncserver.go b/syncapi/storage/postgres/syncserver.go
index d44f8b7e..dc73350a 100644
--- a/syncapi/storage/postgres/syncserver.go
+++ b/syncapi/storage/postgres/syncserver.go
@@ -22,8 +22,8 @@ import (
// Import the postgres database driver.
_ "github.com/lib/pq"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/eduserver/cache"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/shared"
)
@@ -32,11 +32,11 @@ import (
type SyncServerDatasource struct {
shared.Database
db *sql.DB
- common.PartitionOffsetStatements
+ internal.PartitionOffsetStatements
}
// NewDatabase creates a new sync server database
-func NewDatabase(dbDataSourceName string, dbProperties common.DbProperties) (*SyncServerDatasource, error) {
+func NewDatabase(dbDataSourceName string, dbProperties internal.DbProperties) (*SyncServerDatasource, error) {
var d SyncServerDatasource
var err error
if d.db, err = sqlutil.Open("postgres", dbDataSourceName, dbProperties); err != nil {
diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go
index 543e5b4a..145a3dbf 100644
--- a/syncapi/storage/shared/syncserver.go
+++ b/syncapi/storage/shared/syncserver.go
@@ -8,8 +8,8 @@ import (
"time"
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/eduserver/cache"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
@@ -106,7 +106,7 @@ func (d *Database) GetStateEvent(
func (d *Database) GetStateEventsForRoom(
ctx context.Context, roomID string, stateFilter *gomatrixserverlib.StateFilter,
) (stateEvents []gomatrixserverlib.HeaderedEvent, err error) {
- err = common.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
stateEvents, err = d.CurrentRoomState.SelectCurrentState(ctx, txn, roomID, stateFilter)
return err
})
@@ -116,7 +116,7 @@ func (d *Database) GetStateEventsForRoom(
func (d *Database) SyncStreamPosition(ctx context.Context) (types.StreamPosition, error) {
var maxID int64
var err error
- err = common.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
maxID, err = d.OutputEvents.SelectMaxEventID(ctx, txn)
if err != nil {
return err
@@ -148,7 +148,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 = common.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
sp, err = d.Invites.InsertInviteEvent(ctx, txn, inviteEvent)
return err
})
@@ -187,7 +187,7 @@ func (d *Database) GetAccountDataInRange(
func (d *Database) UpsertAccountData(
ctx context.Context, userID, roomID, dataType string,
) (sp types.StreamPosition, err error) {
- err = common.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
sp, err = d.AccountData.InsertAccountData(ctx, txn, userID, roomID, dataType)
return err
})
@@ -255,7 +255,7 @@ func (d *Database) WriteEvent(
addStateEventIDs, removeStateEventIDs []string,
transactionID *api.TransactionID, excludeFromSync bool,
) (pduPosition types.StreamPosition, returnErr error) {
- returnErr = common.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ returnErr = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
var err error
pos, err := d.OutputEvents.InsertEvent(
ctx, txn, ev, addStateEventIDs, removeStateEventIDs, transactionID, excludeFromSync,
@@ -355,7 +355,7 @@ func (d *Database) GetEventsInTopologicalRange(
}
func (d *Database) SyncPosition(ctx context.Context) (tok types.StreamingToken, err error) {
- err = common.WithTransaction(d.DB, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.DB, func(txn *sql.Tx) error {
pos, err := d.syncPositionTx(ctx, txn)
if err != nil {
return err
@@ -434,7 +434,7 @@ func (d *Database) addPDUDeltaToResponse(
}
var succeeded bool
defer func() {
- txerr := common.EndTransaction(txn, &succeeded)
+ txerr := internal.EndTransaction(txn, &succeeded)
if err == nil && txerr != nil {
err = txerr
}
@@ -588,7 +588,7 @@ func (d *Database) getResponseWithPDUsForCompleteSync(
}
var succeeded bool
defer func() {
- txerr := common.EndTransaction(txn, &succeeded)
+ txerr := internal.EndTransaction(txn, &succeeded)
if err == nil && txerr != nil {
err = txerr
}
diff --git a/syncapi/storage/sqlite3/account_data_table.go b/syncapi/storage/sqlite3/account_data_table.go
index 435a399c..a3c79734 100644
--- a/syncapi/storage/sqlite3/account_data_table.go
+++ b/syncapi/storage/sqlite3/account_data_table.go
@@ -19,7 +19,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
@@ -100,7 +100,7 @@ func (s *accountDataStatements) SelectAccountDataInRange(
if err != nil {
return
}
- defer common.CloseAndLogIfError(ctx, rows, "selectAccountDataInRange: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectAccountDataInRange: rows.close() failed")
var entries int
diff --git a/syncapi/storage/sqlite3/backwards_extremities_table.go b/syncapi/storage/sqlite3/backwards_extremities_table.go
index c5d9cae5..e16e54a6 100644
--- a/syncapi/storage/sqlite3/backwards_extremities_table.go
+++ b/syncapi/storage/sqlite3/backwards_extremities_table.go
@@ -18,7 +18,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
)
@@ -84,7 +84,7 @@ func (s *backwardExtremitiesStatements) SelectBackwardExtremitiesForRoom(
if err != nil {
return
}
- defer common.CloseAndLogIfError(ctx, rows, "selectBackwardExtremitiesForRoom: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectBackwardExtremitiesForRoom: rows.close() failed")
bwExtrems = make(map[string][]string)
for rows.Next() {
diff --git a/syncapi/storage/sqlite3/current_room_state_table.go b/syncapi/storage/sqlite3/current_room_state_table.go
index b540fbc6..b0cf1297 100644
--- a/syncapi/storage/sqlite3/current_room_state_table.go
+++ b/syncapi/storage/sqlite3/current_room_state_table.go
@@ -21,7 +21,7 @@ import (
"encoding/json"
"strings"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
@@ -129,7 +129,7 @@ func (s *currentRoomStateStatements) SelectJoinedUsers(
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectJoinedUsers: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectJoinedUsers: rows.close() failed")
result := make(map[string][]string)
for rows.Next() {
@@ -152,12 +152,12 @@ func (s *currentRoomStateStatements) SelectRoomIDsWithMembership(
userID string,
membership string, // nolint: unparam
) ([]string, error) {
- stmt := common.TxStmt(txn, s.selectRoomIDsWithMembershipStmt)
+ stmt := internal.TxStmt(txn, s.selectRoomIDsWithMembershipStmt)
rows, err := stmt.QueryContext(ctx, userID, membership)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectRoomIDsWithMembership: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectRoomIDsWithMembership: rows.close() failed")
var result []string
for rows.Next() {
@@ -175,7 +175,7 @@ func (s *currentRoomStateStatements) SelectCurrentState(
ctx context.Context, txn *sql.Tx, roomID string,
stateFilterPart *gomatrixserverlib.StateFilter,
) ([]gomatrixserverlib.HeaderedEvent, error) {
- stmt := common.TxStmt(txn, s.selectCurrentStateStmt)
+ stmt := internal.TxStmt(txn, s.selectCurrentStateStmt)
rows, err := stmt.QueryContext(ctx, roomID,
nil, // FIXME: pq.StringArray(stateFilterPart.Senders),
nil, // FIXME: pq.StringArray(stateFilterPart.NotSenders),
@@ -187,7 +187,7 @@ func (s *currentRoomStateStatements) SelectCurrentState(
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectCurrentState: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectCurrentState: rows.close() failed")
return rowsToEvents(rows)
}
@@ -195,7 +195,7 @@ func (s *currentRoomStateStatements) SelectCurrentState(
func (s *currentRoomStateStatements) DeleteRoomStateByEventID(
ctx context.Context, txn *sql.Tx, eventID string,
) error {
- stmt := common.TxStmt(txn, s.deleteRoomStateByEventIDStmt)
+ stmt := internal.TxStmt(txn, s.deleteRoomStateByEventIDStmt)
_, err := stmt.ExecContext(ctx, eventID)
return err
}
@@ -218,7 +218,7 @@ func (s *currentRoomStateStatements) UpsertRoomState(
}
// upsert state event
- stmt := common.TxStmt(txn, s.upsertRoomStateStmt)
+ stmt := internal.TxStmt(txn, s.upsertRoomStateStmt)
_, err = stmt.ExecContext(
ctx,
event.RoomID(),
@@ -241,12 +241,12 @@ func (s *currentRoomStateStatements) SelectEventsWithEventIDs(
for k, v := range eventIDs {
iEventIDs[k] = v
}
- query := strings.Replace(selectEventsWithEventIDsSQL, "($1)", common.QueryVariadic(len(iEventIDs)), 1)
+ query := strings.Replace(selectEventsWithEventIDsSQL, "($1)", internal.QueryVariadic(len(iEventIDs)), 1)
rows, err := txn.QueryContext(ctx, query, iEventIDs...)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectEventsWithEventIDs: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectEventsWithEventIDs: rows.close() failed")
return rowsToStreamEvents(rows)
}
diff --git a/syncapi/storage/sqlite3/invites_table.go b/syncapi/storage/sqlite3/invites_table.go
index 9cb184f2..64b52339 100644
--- a/syncapi/storage/sqlite3/invites_table.go
+++ b/syncapi/storage/sqlite3/invites_table.go
@@ -20,7 +20,7 @@ import (
"database/sql"
"encoding/json"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
@@ -123,12 +123,12 @@ func (s *inviteEventsStatements) DeleteInviteEvent(
func (s *inviteEventsStatements) SelectInviteEventsInRange(
ctx context.Context, txn *sql.Tx, targetUserID string, r types.Range,
) (map[string]gomatrixserverlib.HeaderedEvent, error) {
- stmt := common.TxStmt(txn, s.selectInviteEventsInRangeStmt)
+ stmt := internal.TxStmt(txn, s.selectInviteEventsInRangeStmt)
rows, err := stmt.QueryContext(ctx, targetUserID, r.Low(), r.High())
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectInviteEventsInRange: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectInviteEventsInRange: rows.close() failed")
result := map[string]gomatrixserverlib.HeaderedEvent{}
for rows.Next() {
var (
@@ -153,7 +153,7 @@ func (s *inviteEventsStatements) SelectMaxInviteID(
ctx context.Context, txn *sql.Tx,
) (id int64, err error) {
var nullableID sql.NullInt64
- stmt := common.TxStmt(txn, s.selectMaxInviteIDStmt)
+ stmt := internal.TxStmt(txn, s.selectMaxInviteIDStmt)
err = stmt.QueryRowContext(ctx).Scan(&nullableID)
if nullableID.Valid {
id = nullableID.Int64
diff --git a/syncapi/storage/sqlite3/output_room_events_table.go b/syncapi/storage/sqlite3/output_room_events_table.go
index c89e007e..4a84ecc6 100644
--- a/syncapi/storage/sqlite3/output_room_events_table.go
+++ b/syncapi/storage/sqlite3/output_room_events_table.go
@@ -25,7 +25,7 @@ import (
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/gomatrixserverlib"
log "github.com/sirupsen/logrus"
)
@@ -149,7 +149,7 @@ func (s *outputRoomEventsStatements) SelectStateInRange(
ctx context.Context, txn *sql.Tx, r types.Range,
stateFilterPart *gomatrixserverlib.StateFilter,
) (map[string]map[string]bool, map[string]types.StreamEvent, error) {
- stmt := common.TxStmt(txn, s.selectStateInRangeStmt)
+ stmt := internal.TxStmt(txn, s.selectStateInRangeStmt)
rows, err := stmt.QueryContext(
ctx, r.Low(), r.High(),
@@ -236,7 +236,7 @@ func (s *outputRoomEventsStatements) SelectMaxEventID(
ctx context.Context, txn *sql.Tx,
) (id int64, err error) {
var nullableID sql.NullInt64
- stmt := common.TxStmt(txn, s.selectMaxEventIDStmt)
+ stmt := internal.TxStmt(txn, s.selectMaxEventIDStmt)
err = stmt.QueryRowContext(ctx).Scan(&nullableID)
if nullableID.Valid {
id = nullableID.Int64
@@ -286,7 +286,7 @@ func (s *outputRoomEventsStatements) InsertEvent(
return
}
- insertStmt := common.TxStmt(txn, s.insertEventStmt)
+ insertStmt := internal.TxStmt(txn, s.insertEventStmt)
_, err = insertStmt.ExecContext(
ctx,
streamPos,
@@ -313,16 +313,16 @@ func (s *outputRoomEventsStatements) SelectRecentEvents(
) ([]types.StreamEvent, error) {
var stmt *sql.Stmt
if onlySyncEvents {
- stmt = common.TxStmt(txn, s.selectRecentEventsForSyncStmt)
+ stmt = internal.TxStmt(txn, s.selectRecentEventsForSyncStmt)
} else {
- stmt = common.TxStmt(txn, s.selectRecentEventsStmt)
+ stmt = internal.TxStmt(txn, s.selectRecentEventsStmt)
}
rows, err := stmt.QueryContext(ctx, roomID, r.Low(), r.High(), limit)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectRecentEvents: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectRecentEvents: rows.close() failed")
events, err := rowsToStreamEvents(rows)
if err != nil {
return nil, err
@@ -342,12 +342,12 @@ func (s *outputRoomEventsStatements) SelectEarlyEvents(
ctx context.Context, txn *sql.Tx,
roomID string, r types.Range, limit int,
) ([]types.StreamEvent, error) {
- stmt := common.TxStmt(txn, s.selectEarlyEventsStmt)
+ stmt := internal.TxStmt(txn, s.selectEarlyEventsStmt)
rows, err := stmt.QueryContext(ctx, roomID, r.Low(), r.High(), limit)
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "selectEarlyEvents: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "selectEarlyEvents: rows.close() failed")
events, err := rowsToStreamEvents(rows)
if err != nil {
return nil, err
@@ -367,7 +367,7 @@ func (s *outputRoomEventsStatements) SelectEvents(
ctx context.Context, txn *sql.Tx, eventIDs []string,
) ([]types.StreamEvent, error) {
var returnEvents []types.StreamEvent
- stmt := common.TxStmt(txn, s.selectEventsStmt)
+ stmt := internal.TxStmt(txn, s.selectEventsStmt)
for _, eventID := range eventIDs {
rows, err := stmt.QueryContext(ctx, eventID)
if err != nil {
@@ -376,7 +376,7 @@ func (s *outputRoomEventsStatements) SelectEvents(
if streamEvents, err := rowsToStreamEvents(rows); err == nil {
returnEvents = append(returnEvents, streamEvents...)
}
- common.CloseAndLogIfError(ctx, rows, "selectEvents: rows.close() failed")
+ internal.CloseAndLogIfError(ctx, rows, "selectEvents: rows.close() failed")
}
return returnEvents, nil
}
diff --git a/syncapi/storage/sqlite3/output_room_events_topology_table.go b/syncapi/storage/sqlite3/output_room_events_topology_table.go
index 22779238..0d727cb1 100644
--- a/syncapi/storage/sqlite3/output_room_events_topology_table.go
+++ b/syncapi/storage/sqlite3/output_room_events_topology_table.go
@@ -18,7 +18,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/tables"
"github.com/matrix-org/dendrite/syncapi/types"
"github.com/matrix-org/gomatrixserverlib"
@@ -102,7 +102,7 @@ func NewSqliteTopologyTable(db *sql.DB) (tables.Topology, error) {
func (s *outputRoomEventsTopologyStatements) InsertEventInTopology(
ctx context.Context, txn *sql.Tx, event *gomatrixserverlib.HeaderedEvent, pos types.StreamPosition,
) (err error) {
- stmt := common.TxStmt(txn, s.insertEventInTopologyStmt)
+ stmt := internal.TxStmt(txn, s.insertEventInTopologyStmt)
_, err = stmt.ExecContext(
ctx, event.EventID(), event.Depth(), event.RoomID(), pos,
)
@@ -118,9 +118,9 @@ func (s *outputRoomEventsTopologyStatements) SelectEventIDsInRange(
// is requested or not.
var stmt *sql.Stmt
if chronologicalOrder {
- stmt = common.TxStmt(txn, s.selectEventIDsInRangeASCStmt)
+ stmt = internal.TxStmt(txn, s.selectEventIDsInRangeASCStmt)
} else {
- stmt = common.TxStmt(txn, s.selectEventIDsInRangeDESCStmt)
+ stmt = internal.TxStmt(txn, s.selectEventIDsInRangeDESCStmt)
}
// Query the event IDs.
@@ -149,7 +149,7 @@ func (s *outputRoomEventsTopologyStatements) SelectEventIDsInRange(
func (s *outputRoomEventsTopologyStatements) SelectPositionInTopology(
ctx context.Context, txn *sql.Tx, eventID string,
) (pos types.StreamPosition, spos types.StreamPosition, err error) {
- stmt := common.TxStmt(txn, s.selectPositionInTopologyStmt)
+ stmt := internal.TxStmt(txn, s.selectPositionInTopologyStmt)
err = stmt.QueryRowContext(ctx, eventID).Scan(&pos, &spos)
return
}
@@ -157,7 +157,7 @@ func (s *outputRoomEventsTopologyStatements) SelectPositionInTopology(
func (s *outputRoomEventsTopologyStatements) SelectMaxPositionInTopology(
ctx context.Context, txn *sql.Tx, roomID string,
) (pos types.StreamPosition, spos types.StreamPosition, err error) {
- stmt := common.TxStmt(txn, s.selectMaxPositionInTopologyStmt)
+ stmt := internal.TxStmt(txn, s.selectMaxPositionInTopologyStmt)
err = stmt.QueryRowContext(ctx, roomID).Scan(&pos, &spos)
return
}
diff --git a/syncapi/storage/sqlite3/stream_id_table.go b/syncapi/storage/sqlite3/stream_id_table.go
index 260f7a95..3bfe22dd 100644
--- a/syncapi/storage/sqlite3/stream_id_table.go
+++ b/syncapi/storage/sqlite3/stream_id_table.go
@@ -4,7 +4,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/types"
)
@@ -46,8 +46,8 @@ func (s *streamIDStatements) prepare(db *sql.DB) (err error) {
}
func (s *streamIDStatements) nextStreamID(ctx context.Context, txn *sql.Tx) (pos types.StreamPosition, err error) {
- increaseStmt := common.TxStmt(txn, s.increaseStreamIDStmt)
- selectStmt := common.TxStmt(txn, s.selectStreamIDStmt)
+ increaseStmt := internal.TxStmt(txn, s.increaseStreamIDStmt)
+ selectStmt := internal.TxStmt(txn, s.selectStreamIDStmt)
if _, err = increaseStmt.ExecContext(ctx, "global"); err != nil {
return
}
diff --git a/syncapi/storage/sqlite3/syncserver.go b/syncapi/storage/sqlite3/syncserver.go
index e23aeca4..8ab1d404 100644
--- a/syncapi/storage/sqlite3/syncserver.go
+++ b/syncapi/storage/sqlite3/syncserver.go
@@ -25,8 +25,8 @@ import (
// Import the sqlite3 package
_ "github.com/mattn/go-sqlite3"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/eduserver/cache"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/shared"
)
@@ -35,7 +35,7 @@ import (
type SyncServerDatasource struct {
shared.Database
db *sql.DB
- common.PartitionOffsetStatements
+ internal.PartitionOffsetStatements
streamID streamIDStatements
}
@@ -55,7 +55,7 @@ func NewDatabase(dataSourceName string) (*SyncServerDatasource, error) {
} else {
return nil, errors.New("no filename or path in connect string")
}
- if d.db, err = sqlutil.Open(common.SQLiteDriverName(), cs, nil); err != nil {
+ if d.db, err = sqlutil.Open(internal.SQLiteDriverName(), cs, nil); err != nil {
return nil, err
}
if err = d.prepare(); err != nil {
diff --git a/syncapi/storage/storage.go b/syncapi/storage/storage.go
index 76a4b7a4..a4275da0 100644
--- a/syncapi/storage/storage.go
+++ b/syncapi/storage/storage.go
@@ -19,13 +19,13 @@ package storage
import (
"net/url"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/postgres"
"github.com/matrix-org/dendrite/syncapi/storage/sqlite3"
)
// NewSyncServerDatasource opens a database connection.
-func NewSyncServerDatasource(dataSourceName string, dbProperties common.DbProperties) (Database, error) {
+func NewSyncServerDatasource(dataSourceName string, dbProperties internal.DbProperties) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {
return postgres.NewDatabase(dataSourceName, dbProperties)
diff --git a/syncapi/storage/storage_wasm.go b/syncapi/storage/storage_wasm.go
index 666179af..a2b269a1 100644
--- a/syncapi/storage/storage_wasm.go
+++ b/syncapi/storage/storage_wasm.go
@@ -18,14 +18,14 @@ import (
"fmt"
"net/url"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/syncapi/storage/sqlite3"
)
// NewPublicRoomsServerDatabase opens a database connection.
func NewSyncServerDatasource(
dataSourceName string,
- dbProperties common.DbProperties, // nolint:unparam
+ dbProperties internal.DbProperties, // nolint:unparam
) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {
diff --git a/syncapi/syncapi.go b/syncapi/syncapi.go
index 4219d560..022ed7ba 100644
--- a/syncapi/syncapi.go
+++ b/syncapi/syncapi.go
@@ -20,8 +20,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/matrix-org/dendrite/clientapi/auth/storage/accounts"
- "github.com/matrix-org/dendrite/common/basecomponent"
- "github.com/matrix-org/dendrite/common/config"
+ "github.com/matrix-org/dendrite/internal/basecomponent"
+ "github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/gomatrixserverlib"