feat(lns): add ipc handler lifecycle hook
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
3847888518
commit
417619dcd3
2 changed files with 19 additions and 0 deletions
11
lns.go
11
lns.go
|
|
@ -37,6 +37,9 @@ type Service struct {
|
|||
var (
|
||||
_ core.Startable = (*Service)(nil)
|
||||
_ core.Stoppable = (*Service)(nil)
|
||||
_ interface {
|
||||
HandleIPCEvents(*core.Core, core.Message) core.Result
|
||||
} = (*Service)(nil)
|
||||
)
|
||||
|
||||
// serviceOptions holds configuration for the LNS service.
|
||||
|
|
@ -112,6 +115,14 @@ func (s *Service) OnShutdown(context.Context) core.Result {
|
|||
return core.Result{OK: true}
|
||||
}
|
||||
|
||||
// HandleIPCEvents satisfies Core's IPC handler discovery.
|
||||
//
|
||||
// core.New(core.WithService(lns.Register))
|
||||
// // LNS registers a no-op IPC handler so it can join the bus cleanly.
|
||||
func (s *Service) HandleIPCEvents(*core.Core, core.Message) core.Result {
|
||||
return core.Result{OK: true}
|
||||
}
|
||||
|
||||
func canonicalizeName(name any) (string, bool) {
|
||||
switch v := name.(type) {
|
||||
case string:
|
||||
|
|
|
|||
|
|
@ -26,6 +26,14 @@ func TestServiceLifecycleHooks(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestServiceHandleIPCEvents(t *testing.T) {
|
||||
svc := &Service{}
|
||||
|
||||
if got := svc.HandleIPCEvents(nil, nil); !got.OK {
|
||||
t.Fatalf("HandleIPCEvents returned %#v, want OK", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceResolve(t *testing.T) {
|
||||
svc := &Service{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue