Use new gmsl to use new String() API

This commit is contained in:
Devon Hudson 2023-04-28 13:31:21 -06:00
parent 9e9617ff84
commit b00e272e6f
No known key found for this signature in database
GPG Key ID: CD06B18E77F6A628
7 changed files with 11 additions and 13 deletions

2
go.mod
View File

@ -22,7 +22,7 @@ require (
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
github.com/matrix-org/gomatrixserverlib v0.0.0-20230428142634-a4fa967eac17 github.com/matrix-org/gomatrixserverlib v0.0.0-20230428192809-ff52c27efdce
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
github.com/mattn/go-sqlite3 v1.14.16 github.com/mattn/go-sqlite3 v1.14.16

6
go.sum
View File

@ -323,10 +323,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo= github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U= github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s= github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230428003202-267b4e79f138 h1:zqMuO/4ye8QnSPLhruxTC4cQcXfrvpPwdtT+4kqEgF4= github.com/matrix-org/gomatrixserverlib v0.0.0-20230428192809-ff52c27efdce h1:ZdNs5Qj1Cf42GfwUE01oPIZccSiaPJ/HcZP9qxHte8k=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230428003202-267b4e79f138/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU= github.com/matrix-org/gomatrixserverlib v0.0.0-20230428192809-ff52c27efdce/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230428142634-a4fa967eac17 h1:So8d7SZZdKB7+vWFXwmAQ3C+tUkkegMlcGk8n60w2og=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230428142634-a4fa967eac17/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A= github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ= github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y= github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=

View File

@ -101,11 +101,11 @@ func (r *RelayInternalAPI) QueryTransactions(
userID spec.UserID, userID spec.UserID,
previousEntry fclient.RelayEntry, previousEntry fclient.RelayEntry,
) (api.QueryRelayTransactionsResponse, error) { ) (api.QueryRelayTransactionsResponse, error) {
logrus.Infof("QueryTransactions for %s", userID.Raw()) logrus.Infof("QueryTransactions for %s", userID.String())
if previousEntry.EntryID > 0 { if previousEntry.EntryID > 0 {
logrus.Infof("Cleaning previous entry (%v) from db for %s", logrus.Infof("Cleaning previous entry (%v) from db for %s",
previousEntry.EntryID, previousEntry.EntryID,
userID.Raw(), userID.String(),
) )
prevReceipt := receipt.NewReceipt(previousEntry.EntryID) prevReceipt := receipt.NewReceipt(previousEntry.EntryID)
err := r.db.CleanTransactions(ctx, userID, []*receipt.Receipt{&prevReceipt}) err := r.db.CleanTransactions(ctx, userID, []*receipt.Receipt{&prevReceipt})
@ -123,12 +123,12 @@ func (r *RelayInternalAPI) QueryTransactions(
response := api.QueryRelayTransactionsResponse{} response := api.QueryRelayTransactionsResponse{}
if transaction != nil && receipt != nil { if transaction != nil && receipt != nil {
logrus.Infof("Obtained transaction (%v) for %s", transaction.TransactionID, userID.Raw()) logrus.Infof("Obtained transaction (%v) for %s", transaction.TransactionID, userID.String())
response.Transaction = *transaction response.Transaction = *transaction
response.EntryID = receipt.GetNID() response.EntryID = receipt.GetNID()
response.EntriesQueued = true response.EntriesQueued = true
} else { } else {
logrus.Infof("No more entries in the queue for %s", userID.Raw()) logrus.Infof("No more entries in the queue for %s", userID.String())
response.EntryID = 0 response.EntryID = 0
response.EntriesQueued = false response.EntriesQueued = false
} }

View File

@ -34,7 +34,7 @@ func GetTransactionFromRelay(
relayAPI api.RelayInternalAPI, relayAPI api.RelayInternalAPI,
userID spec.UserID, userID spec.UserID,
) util.JSONResponse { ) util.JSONResponse {
logrus.Infof("Processing relay_txn for %s", userID.Raw()) logrus.Infof("Processing relay_txn for %s", userID.String())
var previousEntry fclient.RelayEntry var previousEntry fclient.RelayEntry
if err := json.Unmarshal(fedReq.Content(), &previousEntry); err != nil { if err := json.Unmarshal(fedReq.Content(), &previousEntry); err != nil {

View File

@ -35,7 +35,7 @@ func createQuery(
prevEntry fclient.RelayEntry, prevEntry fclient.RelayEntry,
) fclient.FederationRequest { ) fclient.FederationRequest {
var federationPathPrefixV1 = "/_matrix/federation/v1" var federationPathPrefixV1 = "/_matrix/federation/v1"
path := federationPathPrefixV1 + "/relay_txn/" + userID.Raw() path := federationPathPrefixV1 + "/relay_txn/" + userID.String()
request := fclient.NewFederationRequest("GET", userID.Domain(), "relay", path) request := fclient.NewFederationRequest("GET", userID.Domain(), "relay", path)
request.SetContent(prevEntry) request.SetContent(prevEntry)

View File

@ -36,7 +36,7 @@ func SendTransactionToRelay(
txnID gomatrixserverlib.TransactionID, txnID gomatrixserverlib.TransactionID,
userID spec.UserID, userID spec.UserID,
) util.JSONResponse { ) util.JSONResponse {
logrus.Infof("Processing send_relay for %s", userID.Raw()) logrus.Infof("Processing send_relay for %s", userID.String())
var txnEvents fclient.RelayEvents var txnEvents fclient.RelayEvents
if err := json.Unmarshal(fedReq.Content(), &txnEvents); err != nil { if err := json.Unmarshal(fedReq.Content(), &txnEvents); err != nil {

View File

@ -52,7 +52,7 @@ func createFederationRequest(
content interface{}, content interface{},
) fclient.FederationRequest { ) fclient.FederationRequest {
var federationPathPrefixV1 = "/_matrix/federation/v1" var federationPathPrefixV1 = "/_matrix/federation/v1"
path := federationPathPrefixV1 + "/send_relay/" + string(txnID) + "/" + userID.Raw() path := federationPathPrefixV1 + "/send_relay/" + string(txnID) + "/" + userID.String()
request := fclient.NewFederationRequest("PUT", origin, destination, path) request := fclient.NewFederationRequest("PUT", origin, destination, path)
request.SetContent(content) request.SetContent(content)