-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rough(sentinel): implement standalone lotus-sentinel binary
- includes cli command to start a watch that logs tipsets as they are received. closes filecoin-project/sentinel#179
- Loading branch information
Showing
11 changed files
with
666 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package api | ||
|
||
import ( | ||
"context" | ||
|
||
logging "github.com/ipfs/go-log/v2" | ||
"go.uber.org/fx" | ||
|
||
"github.com/filecoin-project/lotus/api" | ||
"github.com/filecoin-project/lotus/api/apistruct" | ||
"github.com/filecoin-project/lotus/chain/events" | ||
"github.com/filecoin-project/lotus/node/impl" | ||
"github.com/filecoin-project/lotus/sentinel" | ||
) | ||
|
||
var log = logging.Logger("sentinel") | ||
|
||
type SentinelNode interface { | ||
api.FullNode | ||
SentinelWatchStart(ctx context.Context) error | ||
} | ||
|
||
type SentinelNodeAPI struct { | ||
fx.In | ||
|
||
impl.FullNodeAPI | ||
Events *events.Events | ||
} | ||
|
||
func (m *SentinelNodeAPI) SentinelWatchStart(ctx context.Context) error { | ||
log.Info("starting sentinel watch") | ||
return m.Events.Observe(&sentinel.LoggingTipSetObserver{}) | ||
} | ||
|
||
var _ SentinelNode = &SentinelNodeAPI{} | ||
|
||
type SentinelNodeStruct struct { | ||
apistruct.FullNodeStruct | ||
|
||
Internal struct { | ||
SentinelWatchStart func(context.Context) error `perm:"read"` | ||
} | ||
} | ||
|
||
func (s *SentinelNodeStruct) SentinelWatchStart(ctx context.Context) error { | ||
return s.Internal.SentinelWatchStart(ctx) | ||
} | ||
|
||
var _ SentinelNode = &SentinelNodeStruct{} |
Oops, something went wrong.