Skip to content

Commit

Permalink
Move message api into its own folder (#239)
Browse files Browse the repository at this point in the history
## tl;dr

- Small refactor to move the GRPC services into subfolders
  • Loading branch information
neekolas authored Oct 18, 2024
1 parent 816990b commit 62effab
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package message

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api_test
package message_test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/service.go → pkg/api/message/service.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package message

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package message

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api_test
package message_test

import (
"context"
Expand All @@ -7,7 +7,7 @@ import (
"time"

"github.com/stretchr/testify/require"
"github.com/xmtp/xmtpd/pkg/api"
"github.com/xmtp/xmtpd/pkg/api/message"
"github.com/xmtp/xmtpd/pkg/db"
"github.com/xmtp/xmtpd/pkg/db/queries"
"github.com/xmtp/xmtpd/pkg/proto/xmtpv4/message_api"
Expand Down Expand Up @@ -76,7 +76,7 @@ func insertInitialRows(t *testing.T, store *sql.DB) {
testutils.InsertGatewayEnvelopes(t, store, []queries.InsertGatewayEnvelopeParams{
allRows[0], allRows[1],
})
time.Sleep(api.SubscribeWorkerPollTime + 100*time.Millisecond)
time.Sleep(message.SubscribeWorkerPollTime + 100*time.Millisecond)
}

func insertAdditionalRows(t *testing.T, store *sql.DB, notifyChan ...chan bool) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"google.golang.org/grpc/reflection"

"github.com/pires/go-proxyproto"
"github.com/xmtp/xmtpd/pkg/api/message"
"github.com/xmtp/xmtpd/pkg/blockchain"
"github.com/xmtp/xmtpd/pkg/proto/xmtpv4/message_api"
"github.com/xmtp/xmtpd/pkg/registrant"
Expand Down Expand Up @@ -86,7 +87,7 @@ func NewAPIServer(
healthcheck := health.NewServer()
healthgrpc.RegisterHealthServer(s.grpcServer, healthcheck)

replicationService, err := NewReplicationApiService(
replicationService, err := message.NewReplicationApiService(
ctx,
log,
registrant,
Expand Down
4 changes: 2 additions & 2 deletions pkg/interceptors/client/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"github.com/xmtp/xmtpd/pkg/api"
"github.com/xmtp/xmtpd/pkg/api/message"
"github.com/xmtp/xmtpd/pkg/authn"
"github.com/xmtp/xmtpd/pkg/constants"
"github.com/xmtp/xmtpd/pkg/proto/xmtpv4/message_api"
Expand All @@ -22,7 +22,7 @@ import (
// Create a mock implementation of the ReplicationApiServer interface
// but that embeds `UnimplementedReplicationApiServer` (which mockery won't do for us)
type mockReplicationApiServer struct {
api.Service
message.Service
expectedToken string
}

Expand Down

0 comments on commit 62effab

Please sign in to comment.