Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move v1 GRPC API into its own package #6729

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions activation/e2e/activation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/spacemeshos/go-spacemesh/activation"
"github.com/spacemeshos/go-spacemesh/activation/wire"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/atxsdata"
"github.com/spacemeshos/go-spacemesh/codec"
"github.com/spacemeshos/go-spacemesh/common/types"
Expand Down Expand Up @@ -64,7 +64,7 @@ func Test_BuilderWithMultipleClients(t *testing.T) {
db := statesql.InMemoryTest(t)
localDB := localsql.InMemoryTest(t)

svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)

grpcCfg, cleanup := launchServer(t, svc)
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/atx_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/spacemeshos/go-spacemesh/activation"
ae2e "github.com/spacemeshos/go-spacemesh/activation/e2e"
"github.com/spacemeshos/go-spacemesh/activation/wire"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/atxsdata"
"github.com/spacemeshos/go-spacemesh/codec"
"github.com/spacemeshos/go-spacemesh/common/types"
Expand Down Expand Up @@ -214,7 +214,7 @@ func Test_MarryAndMerge(t *testing.T) {
t.Cleanup(func() { assert.NoError(t, cdb.Close()) })
localDB := localsql.InMemoryTest(t)

svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)

grpcCfg, cleanup := launchServer(t, svc)
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/builds_atx_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/spacemeshos/go-spacemesh/activation"
ae2e "github.com/spacemeshos/go-spacemesh/activation/e2e"
"github.com/spacemeshos/go-spacemesh/activation/wire"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/atxsdata"
"github.com/spacemeshos/go-spacemesh/codec"
"github.com/spacemeshos/go-spacemesh/common/types"
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestBuilder_SwitchesToBuildV2(t *testing.T) {
t.Cleanup(func() { assert.NoError(t, cdb.Close()) })

opts := testPostSetupOpts(t)
svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)

grpcCfg, cleanup := launchServer(t, svc)
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/certifier_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"golang.org/x/sync/errgroup"

"github.com/spacemeshos/go-spacemesh/activation"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/signing"
"github.com/spacemeshos/go-spacemesh/sql/localsql"
Expand All @@ -39,7 +39,7 @@ func TestCertification(t *testing.T) {

opts := testPostSetupOpts(t)
logger := zaptest.NewLogger(t)
svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)

grpcCfg, cleanup := launchServer(t, svc)
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/checkpoint_merged_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/spacemeshos/go-spacemesh/activation"
ae2e "github.com/spacemeshos/go-spacemesh/activation/e2e"
"github.com/spacemeshos/go-spacemesh/activation/wire"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/atxsdata"
"github.com/spacemeshos/go-spacemesh/checkpoint"
"github.com/spacemeshos/go-spacemesh/codec"
Expand Down Expand Up @@ -48,7 +48,7 @@ func Test_CheckpointAfterMerge(t *testing.T) {
t.Cleanup(func() { assert.NoError(t, cdb.Close()) })
localDB := localsql.InMemoryTest(t)

svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)
grpcCfg, cleanup := launchServer(t, svc)
t.Cleanup(cleanup)
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/spacemeshos/go-spacemesh/activation"
ae2e "github.com/spacemeshos/go-spacemesh/activation/e2e"
"github.com/spacemeshos/go-spacemesh/activation/wire"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/atxsdata"
"github.com/spacemeshos/go-spacemesh/checkpoint"
"github.com/spacemeshos/go-spacemesh/codec"
Expand Down Expand Up @@ -51,7 +51,7 @@ func TestCheckpoint_PublishingSoloATXs(t *testing.T) {
t.Cleanup(func() { assert.NoError(t, cdb.Close()) })

opts := testPostSetupOpts(t)
svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)
grpcCfg, cleanup := launchServer(t, svc)
t.Cleanup(cleanup)
Expand Down
7 changes: 4 additions & 3 deletions activation/e2e/nipost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/spacemeshos/go-spacemesh/activation"
ae2e "github.com/spacemeshos/go-spacemesh/activation/e2e"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/atxsdata"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/signing"
Expand Down Expand Up @@ -130,7 +131,7 @@ func initPost(
sig *signing.EdSigner,
golden types.ATXID,
grpcCfg grpcserver.Config,
svc *grpcserver.PostService,
svc *v1.PostService,
) {
tb.Helper()

Expand Down Expand Up @@ -161,7 +162,7 @@ func TestNIPostBuilderWithClients(t *testing.T) {
localDb := localsql.InMemoryTest(t)

opts := testPostSetupOpts(t)
svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)
grpcCfg, cleanup := launchServer(t, svc)
t.Cleanup(cleanup)
Expand Down Expand Up @@ -247,7 +248,7 @@ func Test_NIPostBuilderWithMultipleClients(t *testing.T) {
db := statesql.InMemoryTest(t)

opts := testPostSetupOpts(t)
svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)
grpcCfg, cleanup := launchServer(t, svc)
t.Cleanup(cleanup)
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/spacemeshos/go-spacemesh/activation"
ae2e "github.com/spacemeshos/go-spacemesh/activation/e2e"
"github.com/spacemeshos/go-spacemesh/api/grpcserver"
v1 "github.com/spacemeshos/go-spacemesh/api/grpcserver/v1"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/signing"
"github.com/spacemeshos/go-spacemesh/sql/localsql"
Expand All @@ -34,7 +34,7 @@ func TestValidator_Validate(t *testing.T) {
validator := activation.NewMocknipostValidator(gomock.NewController(t))

opts := testPostSetupOpts(t)
svc := grpcserver.NewPostService(logger, grpcserver.PostServiceQueryInterval(100*time.Millisecond))
svc := v1.NewPostService(logger, v1.PostServiceQueryInterval(100*time.Millisecond))
svc.AllowConnections(true)
grpcCfg, cleanup := launchServer(t, svc)
t.Cleanup(cleanup)
Expand Down
23 changes: 13 additions & 10 deletions api/grpcserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ type Config struct {
type Service = string

const (
Admin Service = "admin"
Debug Service = "debug"
GlobalState Service = "global"
Mesh Service = "mesh"
Transaction Service = "transaction"
Activation Service = "activation"
Smesher Service = "smesher"
Post Service = "post"
PostInfo Service = "postInfo"
Node Service = "node"
// v1.
Admin Service = "admin"
Debug Service = "debug"
GlobalState Service = "global"
Mesh Service = "mesh"
Transaction Service = "transaction"
Activation Service = "activation"
Smesher Service = "smesher"
Post Service = "post"
PostInfo Service = "postInfo"
Node Service = "node"

// v1alpha1.
ActivationV2Alpha1 Service = "activation_v2alpha1"
ActivationStreamV2Alpha1 Service = "activation_stream_v2alpha1"
RewardV2Alpha1 Service = "reward_v2alpha1"
Expand Down
Loading
Loading