rpc/server: move to services/rpcsrv

`server` is not a good package name and it's an internal service, so it can be
just about anywhere.
This commit is contained in:
Roman Khimov 2022-07-21 16:21:44 +03:00
parent 7118b4f4ea
commit 43a59adbd0
24 changed files with 25 additions and 25 deletions

2
.gitignore vendored
View file

@ -50,7 +50,7 @@ testdata/
!pkg/compiler/testdata
!pkg/config/testdata
!pkg/consensus/testdata
!pkg/rpc/server/testdata
!pkg/services/rpcsrv/testdata
!pkg/services/notary/testdata
!pkg/services/oracle/testdata
!pkg/smartcontract/testdata

View file

@ -20,7 +20,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
"github.com/nspcc-dev/neo-go/pkg/network"
"github.com/nspcc-dev/neo-go/pkg/rpc/server"
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/vmstate"
@ -56,7 +56,7 @@ type executor struct {
// Chain is a blockchain instance (can be empty).
Chain *core.Blockchain
// RPC is an RPC server to query (can be empty).
RPC *server.Server
RPC *rpcsrv.Server
// NetSrv is a network server (can be empty).
NetSrv *network.Server
// Out contains command output.
@ -120,7 +120,7 @@ func (w *ConcurrentBuffer) Reset() {
w.buf.Reset()
}
func newTestChain(t *testing.T, f func(*config.Config), run bool) (*core.Blockchain, *server.Server, *network.Server) {
func newTestChain(t *testing.T, f func(*config.Config), run bool) (*core.Blockchain, *rpcsrv.Server, *network.Server) {
configPath := "../config/protocol.unit_testnet.single.yml"
cfg, err := config.LoadFile(configPath)
require.NoError(t, err, "could not load config")
@ -154,7 +154,7 @@ func newTestChain(t *testing.T, f func(*config.Config), run bool) (*core.Blockch
netSrv.AddExtensibleHPService(cons, consensus.Category, cons.OnPayload, cons.OnTransaction)
go netSrv.Start(make(chan error, 1))
errCh := make(chan error, 2)
rpcServer := server.New(chain, cfg.ApplicationConfiguration.RPC, netSrv, nil, logger, errCh)
rpcServer := rpcsrv.New(chain, cfg.ApplicationConfiguration.RPC, netSrv, nil, logger, errCh)
rpcServer.Start()
return chain, &rpcServer, netSrv

View file

@ -22,7 +22,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/network"
"github.com/nspcc-dev/neo-go/pkg/network/metrics"
"github.com/nspcc-dev/neo-go/pkg/rpc/server"
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv"
"github.com/nspcc-dev/neo-go/pkg/services/notary"
"github.com/nspcc-dev/neo-go/pkg/services/oracle"
"github.com/nspcc-dev/neo-go/pkg/services/stateroot"
@ -505,7 +505,7 @@ func startServer(ctx *cli.Context) error {
return cli.NewExitError(err, 1)
}
errChan := make(chan error)
rpcServer := server.New(chain, cfg.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
rpcServer := rpcsrv.New(chain, cfg.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
serv.AddService(&rpcServer)
go serv.Start(errChan)
@ -532,7 +532,7 @@ Main:
case syscall.SIGHUP:
log.Info("SIGHUP received, restarting rpc-server")
rpcServer.Shutdown()
rpcServer = server.New(chain, cfg.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
rpcServer = rpcsrv.New(chain, cfg.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
serv.AddService(&rpcServer) // Replaces old one by service name.
if !cfg.ApplicationConfiguration.RPC.StartWhenSynchronized || serv.IsInSync() {
rpcServer.Start()

View file

@ -19,7 +19,7 @@ const (
// basicChainPrefix is a prefix used to store Basic chain .acc file for tests.
// It is also used to retrieve smart contracts that should be deployed to
// Basic chain.
basicChainPrefix = "../rpc/server/testdata/"
basicChainPrefix = "../services/rpcsrv/testdata/"
// bcPersistInterval is the time period Blockchain persists changes to the
// underlying storage.
bcPersistInterval = time.Second

View file

@ -28,7 +28,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result"
"github.com/nspcc-dev/neo-go/pkg/rpc/server/params"
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv/params"
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/nef"

View file

@ -18,7 +18,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/network/payload"
"github.com/nspcc-dev/neo-go/pkg/rpc/request"
"github.com/nspcc-dev/neo-go/pkg/rpc/server/params"
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv/params"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/stretchr/testify/require"
"go.uber.org/atomic"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"bytes"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"net/http"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"fmt"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"bytes"
@ -45,7 +45,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/rpc/response"
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result"
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions"
"github.com/nspcc-dev/neo-go/pkg/rpc/server/params"
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv/params"
"github.com/nspcc-dev/neo-go/pkg/services/oracle"
"github.com/nspcc-dev/neo-go/pkg/services/oracle/broadcaster"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"fmt"
@ -25,7 +25,7 @@ import (
)
const (
notaryPath = "../../services/notary/testdata/notary1.json"
notaryPath = "../notary/testdata/notary1.json"
notaryPass = "one"
)
@ -50,7 +50,7 @@ func getUnitTestChain(t testing.TB, enableOracle bool, enableNotary bool, disabl
if enableOracle {
cfg.ApplicationConfiguration.Oracle.Enabled = true
cfg.ApplicationConfiguration.Oracle.UnlockWallet = config.Wallet{
Path: "../../services/oracle/testdata/oracle1.json",
Path: "../oracle/testdata/oracle1.json",
Password: "one",
}
}

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"bytes"
@ -37,7 +37,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/network/payload"
"github.com/nspcc-dev/neo-go/pkg/rpc/response"
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result"
"github.com/nspcc-dev/neo-go/pkg/rpc/server/params"
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv/params"
rpc2 "github.com/nspcc-dev/neo-go/pkg/services/oracle/broadcaster"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
"github.com/nspcc-dev/neo-go/pkg/util"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"github.com/gorilla/websocket"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result"

View file

@ -1,4 +1,4 @@
package server
package rpcsrv
import (
"errors"