diff --git a/pkg/mining/container.go b/pkg/mining/container.go index d238aa4..21ff380 100644 --- a/pkg/mining/container.go +++ b/pkg/mining/container.go @@ -204,54 +204,59 @@ func (c *Container) Shutdown(ctx context.Context) error { return nil } -// Manager returns the miner manager. +// miner := container.Manager() +// miner.StartMiner(ctx, "xmrig", config) func (c *Container) Manager() ManagerInterface { c.mu.RLock() defer c.mu.RUnlock() return c.manager } -// ProfileManager returns the profile manager. +// pm := container.ProfileManager() +// pm.SaveProfile("eth-main", config) func (c *Container) ProfileManager() *ProfileManager { c.mu.RLock() defer c.mu.RUnlock() return c.profileManager } -// NodeService returns the node service (may be nil if P2P is unavailable). +// ns := container.NodeService() // nil if P2P is unavailable +// ns.GetPeers() func (c *Container) NodeService() *NodeService { c.mu.RLock() defer c.mu.RUnlock() return c.nodeService } -// EventHub returns the event hub for WebSocket connections. +// hub := container.EventHub() +// hub.Broadcast(event) func (c *Container) EventHub() *EventHub { c.mu.RLock() defer c.mu.RUnlock() return c.eventHub } -// HashrateStore returns the hashrate store interface. +// store := container.HashrateStore() +// store.RecordHashrate("xmrig", 1234.5) func (c *Container) HashrateStore() database.HashrateStore { c.mu.RLock() defer c.mu.RUnlock() return c.hashrateStore } -// SetHashrateStore allows injecting a custom hashrate store (useful for testing). +// container.SetHashrateStore(database.NopStore()) // inject no-op store in tests func (c *Container) SetHashrateStore(store database.HashrateStore) { c.mu.Lock() defer c.mu.Unlock() c.hashrateStore = store } -// ShutdownCh returns a channel that's closed when shutdown is complete. +// <-container.ShutdownCh() // blocks until shutdown is complete func (c *Container) ShutdownCh() <-chan struct{} { return c.shutdownCh } -// IsInitialized returns true if the container has been initialized. +// if container.IsInitialized() { container.Start(ctx) } func (c *Container) IsInitialized() bool { c.mu.RLock() defer c.mu.RUnlock()