Remove server aliases (#1154)
This commit is contained in:
parent
04d3699107
commit
cecd4b0816
@ -91,7 +91,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config Config) (*P
|
|||||||
return nil, errs.Combine(err, peer.Close())
|
return nil, errs.Combine(err, peer.Close())
|
||||||
}
|
}
|
||||||
|
|
||||||
peer.Public.Server, err = server.NewServer(publicOptions, peer.Public.Listener, nil)
|
peer.Public.Server, err = server.New(publicOptions, peer.Public.Listener, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errs.Combine(err, peer.Close())
|
return nil, errs.Combine(err, peer.Close())
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"storj.io/storj/pkg/identity"
|
"storj.io/storj/pkg/identity"
|
||||||
"storj.io/storj/pkg/pb"
|
"storj.io/storj/pkg/pb"
|
||||||
"storj.io/storj/pkg/provider"
|
"storj.io/storj/pkg/provider"
|
||||||
|
"storj.io/storj/pkg/server"
|
||||||
"storj.io/storj/pkg/transport"
|
"storj.io/storj/pkg/transport"
|
||||||
"storj.io/storj/pkg/utils"
|
"storj.io/storj/pkg/utils"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
@ -668,13 +669,13 @@ func TestCertificateSigner_Sign_E2E(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
serverConfig := provider.ServerConfig{Address: listener.Addr().String()}
|
serverConfig := server.Config{Address: listener.Addr().String()}
|
||||||
opts, err := provider.NewServerOptions(serverIdent, serverConfig)
|
opts, err := server.NewOptions(serverIdent, serverConfig)
|
||||||
if !assert.NoError(t, err) || !assert.NotNil(t, opts) {
|
if !assert.NoError(t, err) || !assert.NotNil(t, opts) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
service, err := provider.NewProvider(opts, listener, nil, config)
|
service, err := server.New(opts, listener, nil, config)
|
||||||
if !assert.NoError(t, err) || !assert.NotNil(t, service) {
|
if !assert.NoError(t, err) || !assert.NotNil(t, service) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"storj.io/storj/pkg/identity"
|
"storj.io/storj/pkg/identity"
|
||||||
"storj.io/storj/pkg/pb"
|
"storj.io/storj/pkg/pb"
|
||||||
"storj.io/storj/pkg/peertls"
|
"storj.io/storj/pkg/peertls"
|
||||||
"storj.io/storj/pkg/provider"
|
"storj.io/storj/pkg/server"
|
||||||
"storj.io/storj/pkg/utils"
|
"storj.io/storj/pkg/utils"
|
||||||
"storj.io/storj/storage/boltdb"
|
"storj.io/storj/storage/boltdb"
|
||||||
"storj.io/storj/storage/redis"
|
"storj.io/storj/storage/redis"
|
||||||
@ -85,7 +85,7 @@ func (c CertServerConfig) NewAuthDB() (*AuthorizationDB, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run implements the responsibility interface, starting a certificate signing server.
|
// Run implements the responsibility interface, starting a certificate signing server.
|
||||||
func (c CertServerConfig) Run(ctx context.Context, server *provider.Provider) (err error) {
|
func (c CertServerConfig) Run(ctx context.Context, server *server.Server) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
authDB, err := c.NewAuthDB()
|
authDB, err := c.NewAuthDB()
|
||||||
|
@ -597,7 +597,7 @@ func NewTest(ctx context.Context, t *testing.T, snID, upID *identity.FullIdentit
|
|||||||
publicConfig := server.Config{Address: "127.0.0.1:0"}
|
publicConfig := server.Config{Address: "127.0.0.1:0"}
|
||||||
publicOptions, err := server.NewOptions(snID, publicConfig)
|
publicOptions, err := server.NewOptions(snID, publicConfig)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
grpcServer, err := server.NewServer(publicOptions, listener, nil)
|
grpcServer, err := server.New(publicOptions, listener, nil)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
pb.RegisterPieceStoreRoutesServer(grpcServer.GRPC(), psServer)
|
pb.RegisterPieceStoreRoutesServer(grpcServer.GRPC(), psServer)
|
||||||
go func() { assert.NoError(t, grpcServer.Run(ctx)) }()
|
go func() { assert.NoError(t, grpcServer.Run(ctx)) }()
|
||||||
|
@ -5,14 +5,9 @@ package provider
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"storj.io/storj/pkg/identity"
|
"storj.io/storj/pkg/identity"
|
||||||
"storj.io/storj/pkg/server"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// Provider Transition: pkg/provider is going away.
|
|
||||||
Provider = server.Server
|
|
||||||
// ServerConfig Transition: pkg/provider is going away.
|
|
||||||
ServerConfig = server.Config
|
|
||||||
// FullIdentity Transition: pkg/provider is going away.
|
// FullIdentity Transition: pkg/provider is going away.
|
||||||
FullIdentity = identity.FullIdentity
|
FullIdentity = identity.FullIdentity
|
||||||
// PeerIdentity Transition: pkg/provider is going away.
|
// PeerIdentity Transition: pkg/provider is going away.
|
||||||
@ -34,10 +29,6 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// NewServerOptions Transition: pkg/provider is going away.
|
|
||||||
NewServerOptions = server.NewOptions
|
|
||||||
// NewProvider Transition: pkg/provider is going away.
|
|
||||||
NewProvider = server.NewServer
|
|
||||||
// PeerIdentityFromContext Transition: pkg/provider is going away.
|
// PeerIdentityFromContext Transition: pkg/provider is going away.
|
||||||
PeerIdentityFromContext = identity.PeerIdentityFromContext
|
PeerIdentityFromContext = identity.PeerIdentityFromContext
|
||||||
// NewFullIdentity Transition: pkg/provider is going away.
|
// NewFullIdentity Transition: pkg/provider is going away.
|
||||||
|
@ -40,18 +40,18 @@ func (sc Config) Run(ctx context.Context, identity *identity.FullIdentity, inter
|
|||||||
}
|
}
|
||||||
defer func() { err = utils.CombineErrors(err, opts.RevDB.Close()) }()
|
defer func() { err = utils.CombineErrors(err, opts.RevDB.Close()) }()
|
||||||
|
|
||||||
s, err := NewServer(opts, lis, interceptor, services...)
|
server, err := New(opts, lis, interceptor, services...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
if closeErr := s.Close(); closeErr != nil {
|
if closeErr := server.Close(); closeErr != nil {
|
||||||
zap.S().Errorf("Failed to close server: %s", closeErr)
|
zap.S().Errorf("Failed to close server: %s", closeErr)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
zap.S().Infof("Node %s started on %s", s.Identity().ID, sc.Address)
|
zap.S().Infof("Node %s started on %s", server.Identity().ID, sc.Address)
|
||||||
return s.Run(ctx)
|
return server.Run(ctx)
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,9 @@ type Server struct {
|
|||||||
identity *identity.FullIdentity
|
identity *identity.FullIdentity
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServer creates a Server out of an Identity, a net.Listener,
|
// New creates a Server out of an Identity, a net.Listener,
|
||||||
// a UnaryServerInterceptor, and a set of services.
|
// a UnaryServerInterceptor, and a set of services.
|
||||||
func NewServer(opts *Options, lis net.Listener,
|
func New(opts *Options, lis net.Listener,
|
||||||
interceptor grpc.UnaryServerInterceptor, services ...Service) (
|
interceptor grpc.UnaryServerInterceptor, services ...Service) (
|
||||||
*Server, error) {
|
*Server, error) {
|
||||||
grpcOpts, err := opts.grpcOpts()
|
grpcOpts, err := opts.grpcOpts()
|
||||||
|
@ -182,7 +182,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config *Config) (*
|
|||||||
return nil, errs.Combine(err, peer.Close())
|
return nil, errs.Combine(err, peer.Close())
|
||||||
}
|
}
|
||||||
|
|
||||||
peer.Public.Server, err = server.NewServer(publicOptions, peer.Public.Listener, grpcauth.NewAPIKeyInterceptor())
|
peer.Public.Server, err = server.New(publicOptions, peer.Public.Listener, grpcauth.NewAPIKeyInterceptor())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errs.Combine(err, peer.Close())
|
return nil, errs.Combine(err, peer.Close())
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config Config) (*P
|
|||||||
return nil, errs.Combine(err, peer.Close())
|
return nil, errs.Combine(err, peer.Close())
|
||||||
}
|
}
|
||||||
|
|
||||||
peer.Public.Server, err = server.NewServer(publicOptions, peer.Public.Listener, nil)
|
peer.Public.Server, err = server.New(publicOptions, peer.Public.Listener, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errs.Combine(err, peer.Close())
|
return nil, errs.Combine(err, peer.Close())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user