pkg/rpc: remove drpc aliases
We need to split up pb package, which means we cannot have a core package that depends on them. Change-Id: I7f4f6fd82f89a51a9b2ad08bf2b1207253b8a215
This commit is contained in:
parent
6f1eaef8d4
commit
006baa9ca6
@ -24,10 +24,10 @@ type Config struct {
|
||||
TLS tlsopts.Config
|
||||
}
|
||||
|
||||
// Client implements rpc.CertificatesClient
|
||||
// Client implements pb.DRPCCertificatesClient
|
||||
type Client struct {
|
||||
conn *rpc.Conn
|
||||
client rpc.CertificatesClient
|
||||
client pb.DRPCCertificatesClient
|
||||
}
|
||||
|
||||
// New creates a new certificate signing rpc client.
|
||||
@ -47,7 +47,7 @@ func New(ctx context.Context, dialer rpc.Dialer, address string) (_ *Client, err
|
||||
|
||||
// NewClientFrom creates a new certificate signing gRPC client from an existing
|
||||
// grpc cert signing client.
|
||||
func NewClientFrom(client rpc.CertificatesClient) *Client {
|
||||
func NewClientFrom(client pb.DRPCCertificatesClient) *Client {
|
||||
return &Client{
|
||||
client: client,
|
||||
}
|
||||
|
@ -106,10 +106,10 @@ var (
|
||||
type Inspector struct {
|
||||
conn *rpc.Conn
|
||||
identity *identity.FullIdentity
|
||||
overlayclient rpc.OverlayInspectorClient
|
||||
irrdbclient rpc.IrreparableInspectorClient
|
||||
healthclient rpc.HealthInspectorClient
|
||||
paymentsClient rpc.PaymentsClient
|
||||
overlayclient pb.DRPCOverlayInspectorClient
|
||||
irrdbclient pb.DRPCIrreparableInspectorClient
|
||||
healthclient pb.DRPCHealthInspectorClient
|
||||
paymentsClient pb.DRPCPaymentsClient
|
||||
}
|
||||
|
||||
// NewInspector creates a new gRPC inspector client for access to overlay.
|
||||
|
194
pkg/rpc/alias.go
194
pkg/rpc/alias.go
@ -11,212 +11,82 @@ import (
|
||||
// RawConn is a type alias to a drpc client connection
|
||||
type RawConn = rpcpool.Conn
|
||||
|
||||
type (
|
||||
// CertificatesClient is an alias to the drpc client interface
|
||||
CertificatesClient = pb.DRPCCertificatesClient
|
||||
|
||||
// ContactClient is an alias to the drpc client interface
|
||||
ContactClient = pb.DRPCContactClient
|
||||
|
||||
// HealthInspectorClient is an alias to the drpc client interface
|
||||
HealthInspectorClient = pb.DRPCHealthInspectorClient
|
||||
|
||||
// IrreparableInspectorClient is an alias to the drpc client interface
|
||||
IrreparableInspectorClient = pb.DRPCIrreparableInspectorClient
|
||||
|
||||
// MetainfoClient is an alias to the drpc client interface
|
||||
MetainfoClient = pb.DRPCMetainfoClient
|
||||
|
||||
// NodeClient is an alias to the drpc client interface
|
||||
NodeClient = pb.DRPCNodeClient
|
||||
|
||||
// NodeGracefulExitClient is an alias to the drpc client interface
|
||||
NodeGracefulExitClient = pb.DRPCNodeGracefulExitClient
|
||||
|
||||
// NodeStatsClient is an alias to the drpc client interface
|
||||
NodeStatsClient = pb.DRPCNodeStatsClient
|
||||
|
||||
// OrdersClient is an alias to the drpc client interface
|
||||
OrdersClient = pb.DRPCOrdersClient
|
||||
|
||||
// OverlayInspectorClient is an alias to the drpc client interface
|
||||
OverlayInspectorClient = pb.DRPCOverlayInspectorClient
|
||||
|
||||
// PaymentsClient is an alias to the drpc client interface
|
||||
PaymentsClient = pb.DRPCPaymentsClient
|
||||
|
||||
// PieceStoreInspectorClient is an alias to the drpc client interface
|
||||
PieceStoreInspectorClient = pb.DRPCPieceStoreInspectorClient
|
||||
|
||||
// PiecestoreClient is an alias to the drpc client interface
|
||||
PiecestoreClient = pb.DRPCPiecestoreClient
|
||||
|
||||
// ReferralManagerClient is an alias to the drpc client interface
|
||||
ReferralManagerClient = pb.DRPCReferralManagerClient
|
||||
|
||||
// SatelliteGracefulExitClient is an alias to the drpc client interface
|
||||
SatelliteGracefulExitClient = pb.DRPCSatelliteGracefulExitClient
|
||||
|
||||
// VouchersClient is an alias to the drpc client interface
|
||||
VouchersClient = pb.DRPCVouchersClient
|
||||
)
|
||||
|
||||
// NewCertificatesClient returns the drpc version of a CertificatesClient
|
||||
func NewCertificatesClient(rc *RawConn) CertificatesClient {
|
||||
return pb.NewDRPCCertificatesClient(rc)
|
||||
}
|
||||
|
||||
// CertificatesClient returns a CertificatesClient for this connection
|
||||
func (c *Conn) CertificatesClient() CertificatesClient {
|
||||
return NewCertificatesClient(c.raw)
|
||||
}
|
||||
|
||||
// NewContactClient returns the drpc version of a ContactClient
|
||||
func NewContactClient(rc *RawConn) ContactClient {
|
||||
return pb.NewDRPCContactClient(rc)
|
||||
func (c *Conn) CertificatesClient() pb.DRPCCertificatesClient {
|
||||
return pb.NewDRPCCertificatesClient(c.raw)
|
||||
}
|
||||
|
||||
// ContactClient returns a ContactClient for this connection
|
||||
func (c *Conn) ContactClient() ContactClient {
|
||||
return NewContactClient(c.raw)
|
||||
}
|
||||
|
||||
// NewHealthInspectorClient returns the drpc version of a HealthInspectorClient
|
||||
func NewHealthInspectorClient(rc *RawConn) HealthInspectorClient {
|
||||
return pb.NewDRPCHealthInspectorClient(rc)
|
||||
func (c *Conn) ContactClient() pb.DRPCContactClient {
|
||||
return pb.NewDRPCContactClient(c.raw)
|
||||
}
|
||||
|
||||
// HealthInspectorClient returns a HealthInspectorClient for this connection
|
||||
func (c *Conn) HealthInspectorClient() HealthInspectorClient {
|
||||
return NewHealthInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// NewIrreparableInspectorClient returns the drpc version of a IrreparableInspectorClient
|
||||
func NewIrreparableInspectorClient(rc *RawConn) IrreparableInspectorClient {
|
||||
return pb.NewDRPCIrreparableInspectorClient(rc)
|
||||
func (c *Conn) HealthInspectorClient() pb.DRPCHealthInspectorClient {
|
||||
return pb.NewDRPCHealthInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// IrreparableInspectorClient returns a IrreparableInspectorClient for this connection
|
||||
func (c *Conn) IrreparableInspectorClient() IrreparableInspectorClient {
|
||||
return NewIrreparableInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// NewMetainfoClient returns the drpc version of a MetainfoClient
|
||||
func NewMetainfoClient(rc *RawConn) MetainfoClient {
|
||||
return pb.NewDRPCMetainfoClient(rc)
|
||||
func (c *Conn) IrreparableInspectorClient() pb.DRPCIrreparableInspectorClient {
|
||||
return pb.NewDRPCIrreparableInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// MetainfoClient returns a MetainfoClient for this connection
|
||||
func (c *Conn) MetainfoClient() MetainfoClient {
|
||||
return NewMetainfoClient(c.raw)
|
||||
}
|
||||
|
||||
// NewNodeClient returns the drpc version of a NodeClient
|
||||
func NewNodeClient(rc *RawConn) NodeClient {
|
||||
return pb.NewDRPCNodeClient(rc)
|
||||
func (c *Conn) MetainfoClient() pb.DRPCMetainfoClient {
|
||||
return pb.NewDRPCMetainfoClient(c.raw)
|
||||
}
|
||||
|
||||
// NodeClient returns a NodeClient for this connection
|
||||
func (c *Conn) NodeClient() NodeClient {
|
||||
return NewNodeClient(c.raw)
|
||||
}
|
||||
|
||||
// NewNodeGracefulExitClient returns the drpc version of a NodeGracefulExitClient
|
||||
func NewNodeGracefulExitClient(rc *RawConn) NodeGracefulExitClient {
|
||||
return pb.NewDRPCNodeGracefulExitClient(rc)
|
||||
func (c *Conn) NodeClient() pb.DRPCNodeClient {
|
||||
return pb.NewDRPCNodeClient(c.raw)
|
||||
}
|
||||
|
||||
// NodeGracefulExitClient returns a NodeGracefulExitClient for this connection
|
||||
func (c *Conn) NodeGracefulExitClient() NodeGracefulExitClient {
|
||||
return NewNodeGracefulExitClient(c.raw)
|
||||
}
|
||||
|
||||
// NewNodeStatsClient returns the drpc version of a NodeStatsClient
|
||||
func NewNodeStatsClient(rc *RawConn) NodeStatsClient {
|
||||
return pb.NewDRPCNodeStatsClient(rc)
|
||||
func (c *Conn) NodeGracefulExitClient() pb.DRPCNodeGracefulExitClient {
|
||||
return pb.NewDRPCNodeGracefulExitClient(c.raw)
|
||||
}
|
||||
|
||||
// NodeStatsClient returns a NodeStatsClient for this connection
|
||||
func (c *Conn) NodeStatsClient() NodeStatsClient {
|
||||
return NewNodeStatsClient(c.raw)
|
||||
}
|
||||
|
||||
// NewOrdersClient returns the drpc version of a OrdersClient
|
||||
func NewOrdersClient(rc *RawConn) OrdersClient {
|
||||
return pb.NewDRPCOrdersClient(rc)
|
||||
func (c *Conn) NodeStatsClient() pb.DRPCNodeStatsClient {
|
||||
return pb.NewDRPCNodeStatsClient(c.raw)
|
||||
}
|
||||
|
||||
// OrdersClient returns a OrdersClient for this connection
|
||||
func (c *Conn) OrdersClient() OrdersClient {
|
||||
return NewOrdersClient(c.raw)
|
||||
}
|
||||
|
||||
// NewOverlayInspectorClient returns the drpc version of a OverlayInspectorClient
|
||||
func NewOverlayInspectorClient(rc *RawConn) OverlayInspectorClient {
|
||||
return pb.NewDRPCOverlayInspectorClient(rc)
|
||||
func (c *Conn) OrdersClient() pb.DRPCOrdersClient {
|
||||
return pb.NewDRPCOrdersClient(c.raw)
|
||||
}
|
||||
|
||||
// OverlayInspectorClient returns a OverlayInspectorClient for this connection
|
||||
func (c *Conn) OverlayInspectorClient() OverlayInspectorClient {
|
||||
return NewOverlayInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// NewPaymentsClient returns the drpc version of a PaymentsClient
|
||||
func NewPaymentsClient(rc *RawConn) PaymentsClient {
|
||||
return pb.NewDRPCPaymentsClient(rc)
|
||||
func (c *Conn) OverlayInspectorClient() pb.DRPCOverlayInspectorClient {
|
||||
return pb.NewDRPCOverlayInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// PaymentsClient returns a PaymentsClient for this connection
|
||||
func (c *Conn) PaymentsClient() PaymentsClient {
|
||||
return NewPaymentsClient(c.raw)
|
||||
}
|
||||
|
||||
// NewPieceStoreInspectorClient returns the drpc version of a PieceStoreInspectorClient
|
||||
func NewPieceStoreInspectorClient(rc *RawConn) PieceStoreInspectorClient {
|
||||
return pb.NewDRPCPieceStoreInspectorClient(rc)
|
||||
func (c *Conn) PaymentsClient() pb.DRPCPaymentsClient {
|
||||
return pb.NewDRPCPaymentsClient(c.raw)
|
||||
}
|
||||
|
||||
// PieceStoreInspectorClient returns a PieceStoreInspectorClient for this connection
|
||||
func (c *Conn) PieceStoreInspectorClient() PieceStoreInspectorClient {
|
||||
return NewPieceStoreInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// NewPiecestoreClient returns the drpc version of a PiecestoreClient
|
||||
func NewPiecestoreClient(rc *RawConn) PiecestoreClient {
|
||||
return pb.NewDRPCPiecestoreClient(rc)
|
||||
func (c *Conn) PieceStoreInspectorClient() pb.DRPCPieceStoreInspectorClient {
|
||||
return pb.NewDRPCPieceStoreInspectorClient(c.raw)
|
||||
}
|
||||
|
||||
// PiecestoreClient returns a PiecestoreClient for this connection
|
||||
func (c *Conn) PiecestoreClient() PiecestoreClient {
|
||||
return NewPiecestoreClient(c.raw)
|
||||
}
|
||||
|
||||
// NewReferralManagerClient returns the drpc version of a ReferralManagerClient
|
||||
func NewReferralManagerClient(rc *RawConn) ReferralManagerClient {
|
||||
return pb.NewDRPCReferralManagerClient(rc)
|
||||
func (c *Conn) PiecestoreClient() pb.DRPCPiecestoreClient {
|
||||
return pb.NewDRPCPiecestoreClient(c.raw)
|
||||
}
|
||||
|
||||
// ReferralManagerClient returns a ReferralManagerClient for this connection
|
||||
func (c *Conn) ReferralManagerClient() ReferralManagerClient {
|
||||
return NewReferralManagerClient(c.raw)
|
||||
}
|
||||
|
||||
// NewSatelliteGracefulExitClient returns the drpc version of a SatelliteGracefulExitClient
|
||||
func NewSatelliteGracefulExitClient(rc *RawConn) SatelliteGracefulExitClient {
|
||||
return pb.NewDRPCSatelliteGracefulExitClient(rc)
|
||||
func (c *Conn) ReferralManagerClient() pb.DRPCReferralManagerClient {
|
||||
return pb.NewDRPCReferralManagerClient(c.raw)
|
||||
}
|
||||
|
||||
// SatelliteGracefulExitClient returns a SatelliteGracefulExitClient for this connection
|
||||
func (c *Conn) SatelliteGracefulExitClient() SatelliteGracefulExitClient {
|
||||
return NewSatelliteGracefulExitClient(c.raw)
|
||||
}
|
||||
|
||||
// NewVouchersClient returns the drpc version of a VouchersClient
|
||||
func NewVouchersClient(rc *RawConn) VouchersClient {
|
||||
return pb.NewDRPCVouchersClient(rc)
|
||||
func (c *Conn) SatelliteGracefulExitClient() pb.DRPCSatelliteGracefulExitClient {
|
||||
return pb.NewDRPCSatelliteGracefulExitClient(c.raw)
|
||||
}
|
||||
|
||||
// VouchersClient returns a VouchersClient for this connection
|
||||
func (c *Conn) VouchersClient() VouchersClient {
|
||||
return NewVouchersClient(c.raw)
|
||||
func (c *Conn) VouchersClient() pb.DRPCVouchersClient {
|
||||
return pb.NewDRPCVouchersClient(c.raw)
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
type client struct {
|
||||
conn *rpc.Conn
|
||||
client rpc.ContactClient
|
||||
client pb.DRPCContactClient
|
||||
}
|
||||
|
||||
// newClient dials the target contact endpoint
|
||||
|
@ -31,7 +31,7 @@ var (
|
||||
// architecture: Client
|
||||
type Client struct {
|
||||
conn *rpc.Conn
|
||||
rpc.NodeStatsClient
|
||||
pb.DRPCNodeStatsClient
|
||||
}
|
||||
|
||||
// Close closes underlying client connection
|
||||
@ -130,8 +130,8 @@ func (s *Service) dial(ctx context.Context, satelliteID storj.NodeID) (_ *Client
|
||||
}
|
||||
|
||||
return &Client{
|
||||
conn: conn,
|
||||
NodeStatsClient: conn.NodeStatsClient(),
|
||||
conn: conn,
|
||||
DRPCNodeStatsClient: conn.NodeStatsClient(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ var (
|
||||
// Client creates a grpcClient.
|
||||
type Client struct {
|
||||
conn *rpc.Conn
|
||||
client rpc.MetainfoClient
|
||||
client pb.DRPCMetainfoClient
|
||||
apiKeyRaw []byte
|
||||
|
||||
userAgent string
|
||||
@ -44,7 +44,7 @@ type ListItem struct {
|
||||
}
|
||||
|
||||
// New used as a public function.
|
||||
func New(client rpc.MetainfoClient, apiKey *macaroon.APIKey, userAgent string) *Client {
|
||||
func New(client pb.DRPCMetainfoClient, apiKey *macaroon.APIKey, userAgent string) *Client {
|
||||
return &Client{
|
||||
client: client,
|
||||
apiKeyRaw: apiKey.SerializeRaw(),
|
||||
|
@ -41,7 +41,7 @@ var DefaultConfig = Config{
|
||||
// Client implements uploading, downloading and deleting content from a piecestore.
|
||||
type Client struct {
|
||||
log *zap.Logger
|
||||
client rpc.PiecestoreClient
|
||||
client pb.DRPCPiecestoreClient
|
||||
conn *rpc.Conn
|
||||
config Config
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user