Add Session API

This commit is contained in:
Łukasz Magiera
2020-10-17 12:53:42 +02:00
parent b74a3229f8
commit 68be28ca6d
3 changed files with 20 additions and 4 deletions
+8 -2
View File
@@ -5,9 +5,9 @@ import (
"sort"
"strings"
logging "github.com/ipfs/go-log/v2"
"github.com/gbrlsnchs/jwt/v3"
"github.com/google/uuid"
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p-core/host"
metrics "github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/network"
@@ -27,6 +27,8 @@ import (
"github.com/filecoin-project/lotus/node/modules/lp2p"
)
var session = uuid.New()
type CommonAPI struct {
fx.In
@@ -202,6 +204,10 @@ func (a *CommonAPI) Shutdown(ctx context.Context) error {
return nil
}
func (a *CommonAPI) Session(ctx context.Context) (uuid.UUID, error) {
return session, nil
}
func (a *CommonAPI) Closing(ctx context.Context) (<-chan struct{}, error) {
return make(chan struct{}), nil // relies on jsonrpc closing
}