package monitor import ( "context" "fmt" "github.com/google/uuid" "micro_layout/internal/runtime" ) type monitor struct { options *runtime.Options exit context.CancelFunc } func NewMonitor() runtime.Runtime { ctx, cancel := context.WithCancel(context.Background()) opts := &runtime.Options{ ID: uuid.NewString(), Type: "monitor", Context: ctx, } return &monitor{ options: opts, exit: cancel, } } func (m *monitor) Init(opts ...runtime.Option) error { for _, o := range opts { o(m.options) } return nil } func (m *monitor) Start() error { select { case <-m.options.Context.Done(): return nil } } func (m *monitor) Stop() error { m.exit() return nil } func (m *monitor) String() string { return fmt.Sprintf("%s://%s", m.options.Type, m.options.ID) }