2020-08-24 15:51:42 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
|
2022-02-03 11:43:05 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
|
2020-08-24 15:51:42 +00:00
|
|
|
sessionTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/session/grpc"
|
|
|
|
sessionSvc "github.com/nspcc-dev/neofs-node/pkg/services/session"
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/session/storage"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initSessionService(c *cfg) {
|
|
|
|
c.privateTokenStore = storage.New()
|
2022-02-03 11:43:05 +00:00
|
|
|
addNewEpochNotificationHandler(c, func(ev event.Event) {
|
|
|
|
c.privateTokenStore.RemoveOld(ev.(netmap.NewEpoch).EpochNumber())
|
|
|
|
})
|
2020-08-24 15:51:42 +00:00
|
|
|
|
2021-06-22 17:25:18 +00:00
|
|
|
server := sessionTransportGRPC.New(
|
|
|
|
sessionSvc.NewSignService(
|
|
|
|
&c.key.PrivateKey,
|
|
|
|
sessionSvc.NewResponseService(
|
|
|
|
sessionSvc.NewExecutionService(
|
|
|
|
c.privateTokenStore,
|
2020-08-24 15:51:42 +00:00
|
|
|
),
|
2021-06-22 17:25:18 +00:00
|
|
|
c.respSvc,
|
2020-08-24 15:51:42 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
2021-06-22 17:25:18 +00:00
|
|
|
|
|
|
|
for _, srv := range c.cfgGRPC.servers {
|
|
|
|
sessionGRPC.RegisterSessionServiceServer(srv, server)
|
|
|
|
}
|
2020-08-24 15:51:42 +00:00
|
|
|
}
|