prepare code skeleton to develop remaining managers

This commit is contained in:
Jay
2026-06-03 15:04:08 -04:00
parent 29f6966ae0
commit e360f35ee5
7 changed files with 506 additions and 27 deletions
+52
View File
@@ -0,0 +1,52 @@
package prism
import (
"context"
"sync"
"time"
)
type NoticeReceived struct {
Message string
At time.Time
}
type Notice struct {
PeerID string
Message string
Timestamp time.Time
}
type NoticeHandler struct {
envoy *Envoy
inbox <-chan InboxMessage
notices chan Notice
ctx context.Context
cancel context.CancelFunc
wg sync.WaitGroup
}
func NewNoticeHandler(e *Envoy) *NoticeHandler {
// SubscribeInbox([]string{"NOTICE"})
// make(chan Notice, 16)
// context.WithCancel from e.Context()
// wg.Add(1); go h.route()
return nil
}
func (h *NoticeHandler) Notices() <-chan Notice { return h.notices }
func (h *NoticeHandler) Close() {
// h.cancel()
// h.wg.Wait()
// close(h.notices)
}
func (h *NoticeHandler) route() {
defer h.wg.Done()
// select ctx.Done | inbox msg
// msg: envelope.FindNotice → on err continue
// push Notice{PeerID, Message, time.Now()} to h.notices (blocking)
// e.Observer().Record(e.PeerID(), NoticeReceived{...})
}