forked from TrueCloudLab/frostfs-node
[#425] services: Define service interfaces that was removed from API lib
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e6f945e61d
commit
718a2fad26
29 changed files with 107 additions and 42 deletions
|
@ -30,7 +30,7 @@ type NetworkInfo interface {
|
|||
Dump() (*netmap.NetworkInfo, error)
|
||||
}
|
||||
|
||||
func NewExecutionService(s NodeState, v *pkg.Version, netInfo NetworkInfo) netmap.Service {
|
||||
func NewExecutionService(s NodeState, v *pkg.Version, netInfo NetworkInfo) Server {
|
||||
if s == nil || v == nil || netInfo == nil {
|
||||
// this should never happen, otherwise it programmers bug
|
||||
panic("can't create netmap execution service")
|
||||
|
|
|
@ -11,12 +11,12 @@ import (
|
|||
type responseService struct {
|
||||
respSvc *response.Service
|
||||
|
||||
svc netmap.Service
|
||||
svc Server
|
||||
}
|
||||
|
||||
// NewResponseService returns netmap service instance that passes internal service
|
||||
// call to response service.
|
||||
func NewResponseService(nmSvc netmap.Service, respSvc *response.Service) netmap.Service {
|
||||
func NewResponseService(nmSvc Server, respSvc *response.Service) Server {
|
||||
return &responseService{
|
||||
respSvc: respSvc,
|
||||
svc: nmSvc,
|
||||
|
|
13
pkg/services/netmap/server.go
Normal file
13
pkg/services/netmap/server.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
||||
)
|
||||
|
||||
// Server is an interface of the NeoFS API Netmap service server
|
||||
type Server interface {
|
||||
LocalNodeInfo(context.Context, *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error)
|
||||
NetworkInfo(context.Context, *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error)
|
||||
}
|
|
@ -11,10 +11,10 @@ import (
|
|||
type signService struct {
|
||||
sigSvc *util.SignService
|
||||
|
||||
svc netmap.Service
|
||||
svc Server
|
||||
}
|
||||
|
||||
func NewSignService(key *ecdsa.PrivateKey, svc netmap.Service) netmap.Service {
|
||||
func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
|
||||
return &signService{
|
||||
sigSvc: util.NewUnarySignService(key),
|
||||
svc: svc,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue