Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
refactor: extract streaming logic to go.getarcane.app/streams (#3166)
Kyle Mendellb7c6eb956c95
diff --git a/backend/api/handlers/activities.go b/backend/api/handlers/activities.goindex 695058542..9919155ae 100644--- a/backend/api/handlers/activities.go+++ b/backend/api/handlers/activities.go@@ -16,11 +16,11 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/models""github.com/getarcaneapp/arcane/backend/v2/internal/services""github.com/getarcaneapp/arcane/backend/v2/pkg/authz"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/aggstream""github.com/getarcaneapp/arcane/backend/v2/pkg/pagination""github.com/getarcaneapp/arcane/backend/v2/pkg/utils/httpx""github.com/getarcaneapp/arcane/types/v2/activity""github.com/getarcaneapp/arcane/types/v2/base"+ "go.getarcane.app/streams/agg""gorm.io/gorm")@@ -331,17 +331,23 @@ func (h *ActivityHandler) StreamAllActivities(ctx context.Context, input *Stream// environment and every enabled remote environment over a single response so// the browser needs one connection regardless of environment count.func (h *ActivityHandler) streamAllActivitiesInternal(ctx context.Context, limit int, encoder *json.Encoder, flush func()) {- aggstream.Run(ctx, encoder, flush, activityStreamEventBuffer, activityStreamHeartbeatInterval,- func() activity.StreamEvent {+ _ = agg.Run(ctx, agg.Config[activity.StreamEvent]{+ Encoder: encoder,+ Flush: flush,+ Buffer: activityStreamEventBuffer,+ HeartbeatInterval: activityStreamHeartbeatInterval,+ MakeHeartbeat: func() activity.StreamEvent {return activity.StreamEvent{Type: "heartbeat", Timestamp: time.Now()}},- func(ctx context.Context, events chan<- activity.StreamEvent) {- h.runLocalActivityStreamProducerInternal(ctx, limit, events)+ Producers: []agg.Producer[activity.StreamEvent]{+ func(ctx context.Context, events chan<- activity.StreamEvent) {+ h.runLocalActivityStreamProducerInternal(ctx, limit, events)+ },+ func(ctx context.Context, events chan<- activity.StreamEvent) {+ h.runRemoteActivityStreamPollersInternal(ctx, limit, events)+ },},- func(ctx context.Context, events chan<- activity.StreamEvent) {- h.runRemoteActivityStreamPollersInternal(ctx, limit, events)- },- )+ })}func (h *ActivityHandler) runLocalActivityStreamProducerInternal(ctx context.Context, limit int, events chan<- activity.StreamEvent) {@@ -351,7 +357,7 @@ func (h *ActivityHandler) runLocalActivityStreamProducerInternal(ctx context.Con})if err != nil {if ctx.Err() == nil {- aggstream.Send(ctx, events, activity.StreamEvent{+ agg.Send(ctx, events, activity.StreamEvent{Type: "error",EnvironmentID: "0",Error: err.Error(),@@ -361,7 +367,7 @@ func (h *ActivityHandler) runLocalActivityStreamProducerInternal(ctx context.Conreturn false}h.applyActivitySourceLabelsInternal(ctx, "0", activities)- return aggstream.Send(ctx, events, activity.StreamEvent{+ return agg.Send(ctx, events, activity.StreamEvent{Type: "snapshot",EnvironmentID: "0",Activities: activities,@@ -387,7 +393,7 @@ func (h *ActivityHandler) runLocalActivityStreamProducerInternal(ctx context.Con}event.EnvironmentID = "0"h.applyActivityStreamEventSourceLabelInternal(ctx, "0", &event)- if !aggstream.Send(ctx, events, event) {+ if !agg.Send(ctx, events, event) {return}case <-ticker.C:@@ -402,7 +408,7 @@ func (h *ActivityHandler) runLocalActivityStreamProducerInternal(ctx context.Con// enabled remote environment, re-listing periodically so environments added// or removed while the stream is open are picked up without a reconnect.func (h *ActivityHandler) runRemoteActivityStreamPollersInternal(ctx context.Context, limit int, events chan<- activity.StreamEvent) {- aggstream.ReconcilePollersByKey(ctx,+ agg.ReconcilePollersByKey(ctx,h.environmentService.ListRemoteEnvironments,func(environment models.Environment) string {return environment.ID@@ -452,7 +458,7 @@ func (h *ActivityHandler) runRemoteActivityStreamPollerInternal(ctx context.Cont// once per distinct message and keep polling.if msg := err.Error(); msg != lastError {lastError = msg- aggstream.Send(ctx, events, activity.StreamEvent{+ agg.Send(ctx, events, activity.StreamEvent{Type: "error",EnvironmentID: environmentID,Error: msg,@@ -462,7 +468,7 @@ func (h *ActivityHandler) runRemoteActivityStreamPollerInternal(ctx context.Contreturn}lastError = ""- aggstream.Send(ctx, events, activity.StreamEvent{+ agg.Send(ctx, events, activity.StreamEvent{Type: "snapshot",EnvironmentID: environmentID,Activities: output.Body.Data,diff --git a/backend/api/handlers/dashboard.go b/backend/api/handlers/dashboard.goindex db3e4203c..5892f490f 100644--- a/backend/api/handlers/dashboard.go+++ b/backend/api/handlers/dashboard.go@@ -12,7 +12,6 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/common""github.com/getarcaneapp/arcane/backend/v2/internal/services""github.com/getarcaneapp/arcane/backend/v2/pkg/authz"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/aggstream""github.com/getarcaneapp/arcane/backend/v2/pkg/remenv""github.com/getarcaneapp/arcane/backend/v2/pkg/utils/httpx""github.com/getarcaneapp/arcane/types/v2/base"@@ -20,6 +19,7 @@ import (dashboardtypes "github.com/getarcaneapp/arcane/types/v2/dashboard"imagetypes "github.com/getarcaneapp/arcane/types/v2/image"versiontypes "github.com/getarcaneapp/arcane/types/v2/version"+ "go.getarcane.app/streams/agg")type DashboardHandler struct {@@ -136,17 +136,23 @@ func (h *DashboardHandler) StreamAllDashboards(ctx context.Context, input *Strea// environment and every enabled remote environment over a single response so// the browser needs one connection regardless of environment count.func (h *DashboardHandler) streamAllDashboardsInternal(ctx context.Context, debugAllGood bool, encoder *json.Encoder, flush func()) {- aggstream.Run(ctx, encoder, flush, dashboardStreamEventBuffer, dashboardStreamHeartbeatInterval,- func() dashboardtypes.StreamEvent {+ _ = agg.Run(ctx, agg.Config[dashboardtypes.StreamEvent]{+ Encoder: encoder,+ Flush: flush,+ Buffer: dashboardStreamEventBuffer,+ HeartbeatInterval: dashboardStreamHeartbeatInterval,+ MakeHeartbeat: func() dashboardtypes.StreamEvent {return dashboardtypes.StreamEvent{Type: "heartbeat", Timestamp: time.Now()}},- func(ctx context.Context, events chan<- dashboardtypes.StreamEvent) {- h.runLocalDashboardStreamProducerInternal(ctx, debugAllGood, events)+ Producers: []agg.Producer[dashboardtypes.StreamEvent]{+ func(ctx context.Context, events chan<- dashboardtypes.StreamEvent) {+ h.runLocalDashboardStreamProducerInternal(ctx, debugAllGood, events)+ },+ func(ctx context.Context, events chan<- dashboardtypes.StreamEvent) {+ h.runRemoteDashboardStreamPollersInternal(ctx, debugAllGood, events)+ },},- func(ctx context.Context, events chan<- dashboardtypes.StreamEvent) {- h.runRemoteDashboardStreamPollersInternal(ctx, debugAllGood, events)- },- )+ })}// trimDashboardStreamSnapshotInternal drops the first-page container/image@@ -180,7 +186,7 @@ func (h *DashboardHandler) runLocalDashboardStreamProducerInternal(ctx context.C// once per distinct message and keep polling.if msg := err.Error(); msg != lastError {lastError = msg- aggstream.Send(ctx, events, dashboardtypes.StreamEvent{+ agg.Send(ctx, events, dashboardtypes.StreamEvent{Type: "error",EnvironmentID: "0",Error: msg,@@ -190,7 +196,7 @@ func (h *DashboardHandler) runLocalDashboardStreamProducerInternal(ctx context.Creturn}lastError = ""- aggstream.Send(ctx, events, dashboardtypes.StreamEvent{+ agg.Send(ctx, events, dashboardtypes.StreamEvent{Type: "snapshot",EnvironmentID: "0",Snapshot: trimDashboardStreamSnapshotInternal(snapshot),@@ -217,7 +223,7 @@ func (h *DashboardHandler) runLocalDashboardStreamProducerInternal(ctx context.C// enabled remote environment, re-listing periodically so environments added// or removed while the stream is open are picked up without a reconnect.func (h *DashboardHandler) runRemoteDashboardStreamPollersInternal(ctx context.Context, debugAllGood bool, events chan<- dashboardtypes.StreamEvent) {- aggstream.ReconcileEnvironmentPollers(ctx, h.environmentService, dashboardStreamEnvReconcileInterval, "dashboard stream",+ agg.ReconcileEnvironmentPollers(ctx, h.environmentService, dashboardStreamEnvReconcileInterval, "dashboard stream",func(pollCtx context.Context, environmentID string) {h.runRemoteDashboardStreamPollerInternal(pollCtx, environmentID, debugAllGood, events)})@@ -226,7 +232,7 @@ func (h *DashboardHandler) runRemoteDashboardStreamPollersInternal(ctx context.Cfunc (h *DashboardHandler) runRemoteDashboardStreamPollerInternal(ctx context.Context, environmentID string, debugAllGood bool, events chan<- dashboardtypes.StreamEvent) {// Tell the client this environment is covered before the first poll// completes so it can hold skeletons instead of assuming no data exists.- if !aggstream.Send(ctx, events, dashboardtypes.StreamEvent{+ if !agg.Send(ctx, events, dashboardtypes.StreamEvent{Type: "pending",EnvironmentID: environmentID,Timestamp: time.Now(),@@ -256,7 +262,7 @@ func (h *DashboardHandler) runRemoteDashboardStreamPollerInternal(ctx context.Comessage, code := classifyDashboardStreamErrorInternal(err)if message != lastError {lastError = message- aggstream.Send(ctx, events, dashboardtypes.StreamEvent{+ agg.Send(ctx, events, dashboardtypes.StreamEvent{Type: "error",EnvironmentID: environmentID,Error: message,@@ -267,7 +273,7 @@ func (h *DashboardHandler) runRemoteDashboardStreamPollerInternal(ctx context.Coreturn}lastError = ""- aggstream.Send(ctx, events, dashboardtypes.StreamEvent{+ agg.Send(ctx, events, dashboardtypes.StreamEvent{Type: "snapshot",EnvironmentID: environmentID,Snapshot: trimDashboardStreamSnapshotInternal(snapshot),diff --git a/backend/api/handlers/diagnostics.go b/backend/api/handlers/diagnostics.goindex 4fd7c96d7..b481c56c7 100644--- a/backend/api/handlers/diagnostics.go+++ b/backend/api/handlers/diagnostics.go@@ -10,8 +10,8 @@ import ("github.com/getarcaneapp/arcane/backend/v2/api/ws""github.com/getarcaneapp/arcane/backend/v2/internal/services""github.com/getarcaneapp/arcane/backend/v2/pkg/authz"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/logstream""github.com/getarcaneapp/arcane/types/v2/system"+ "go.getarcane.app/streams/logs")// DiagnosticsHandler serves the REST diagnostics endpoints. The live WebSocket@@ -28,7 +28,7 @@ type GetDiagnosticsOutput struct {}type GetDiagnosticsLogsOutput struct {- Body []system.LogEntry+ Body []logs.Entry}// RegisterDiagnostics registers the Huma diagnostics REST endpoints.@@ -69,5 +69,5 @@ func (h *DiagnosticsHandler) GetDiagnostics(_ context.Context, _ *DiagnosticsInp}func (h *DiagnosticsHandler) GetRecentLogs(_ context.Context, _ *DiagnosticsInput) (*GetDiagnosticsLogsOutput, error) {- return &GetDiagnosticsLogsOutput{Body: logstream.Default().Recent()}, nil+ return &GetDiagnosticsLogsOutput{Body: ws.LogBroadcaster().Recent()}, nil}diff --git a/backend/api/ws/diagnostics.go b/backend/api/ws/diagnostics.goindex 181156951..3af06538c 100644--- a/backend/api/ws/diagnostics.go+++ b/backend/api/ws/diagnostics.go@@ -9,11 +9,11 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/middleware""github.com/getarcaneapp/arcane/backend/v2/internal/services""github.com/getarcaneapp/arcane/backend/v2/pkg/authz"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/logstream"wshub "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/ws"systemtypes "github.com/getarcaneapp/arcane/types/v2/system""github.com/gorilla/websocket""github.com/labstack/echo/v4"+ "go.getarcane.app/streams/logs")// diagnosticsStreamInterval is how often the live diagnostics stream pushes a snapshot.@@ -102,11 +102,11 @@ func (h *WebSocketHandler) ServerLogsStream(c echo.Context) error {// Subscribe before replaying the backlog so no entry is missed in the gap; at// worst the newest backlog entry is delivered twice, which is harmless.- ch, cancel := logstream.Default().Subscribe()+ ch, cancel := defaultLogBroadcaster.Subscribe()defer cancel()done := diagnosticsReadLoopInternal(conn)- write := func(e systemtypes.LogEntry) bool {+ write := func(e logs.Entry) bool {b, marshalErr := json.Marshal(e)if marshalErr != nil {return true@@ -114,7 +114,7 @@ func (h *WebSocketHandler) ServerLogsStream(c echo.Context) error {return conn.WriteMessage(websocket.TextMessage, b) == nil}- for _, e := range logstream.Default().Recent() {+ for _, e := range defaultLogBroadcaster.Recent() {if !write(e) {return nil}diff --git a/backend/api/ws/logs.go b/backend/api/ws/logs.gonew file mode 100644index 000000000..a8a3ec724--- /dev/null+++ b/backend/api/ws/logs.go@@ -0,0 +1,10 @@+package ws++import "go.getarcane.app/streams/logs"++var defaultLogBroadcaster = logs.New(1000)++// LogBroadcaster returns the backend-wide log broadcaster used by diagnostics.+func LogBroadcaster() *logs.Broadcaster {+ return defaultLogBroadcaster+}diff --git a/backend/go.mod b/backend/go.modindex 66d5b1f68..7cd451c25 100644--- a/backend/go.mod+++ b/backend/go.mod@@ -55,6 +55,7 @@ require (github.com/wneessen/go-mail v0.7.3go.getarcane.app/builds v0.1.0go.getarcane.app/docker/convert v0.1.0+ go.getarcane.app/streams v0.1.0go.getarcane.app/sys/atomic v0.1.0go.getarcane.app/sys/cgroup v0.1.0go.getarcane.app/sys/crypto v0.1.0diff --git a/backend/go.sum b/backend/go.sumindex 4995f05c2..2d65b5663 100644--- a/backend/go.sum+++ b/backend/go.sum@@ -537,6 +537,8 @@ go.getarcane.app/builds v0.1.0 h1:BOEFFFI35nQq/jowWs7+Uhi1XNoKIEKmNd7xnassCVg=go.getarcane.app/builds v0.1.0/go.mod h1:3g7+969+qWH33EXnA+nu5MKhs72JYDPf9Q/OtYO6CIA=go.getarcane.app/docker/convert v0.1.0 h1:prlIOs6dMx6CdnetsJFZ6ak0vcistM3DcH5lrZiFHBU=go.getarcane.app/docker/convert v0.1.0/go.mod h1:o9y4z/vah8HiHFtI+jJVFHbs8nLrkARYt88OaUlvGig=+go.getarcane.app/streams v0.1.0 h1:7ToYnGNz2/dKmmelwl/UagOkk+BjOC5JKwHMZrU/b4g=+go.getarcane.app/streams v0.1.0/go.mod h1:LHMKblQvsL1nqKh/Y+KgQbwFSMI2I7bs9u8ZwZqzjnQ=go.getarcane.app/sys/atomic v0.1.0 h1:0HhUeGXYdKAmMW24O+OaqcjDZx6twAuYPBu9T91zKsk=go.getarcane.app/sys/atomic v0.1.0/go.mod h1:QPb5eUXYKYG5acp9jJBAZ/PTbHbByDAQG6eDNAsZZ2w=go.getarcane.app/sys/cgroup v0.1.0 h1:SCAbuU+rZ/EjMU8kkVxmXZsMchiZp9eFdMQFnbU+asA=diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.goindex ce34168b9..1a1679dd1 100644--- a/backend/internal/bootstrap/bootstrap.go+++ b/backend/internal/bootstrap/bootstrap.go@@ -17,16 +17,17 @@ import ("github.com/moby/moby/client""github.com/subosito/gotenv"+ "github.com/getarcaneapp/arcane/backend/v2/api/ws""github.com/getarcaneapp/arcane/backend/v2/internal/config""github.com/getarcaneapp/arcane/backend/v2/internal/di""github.com/getarcaneapp/arcane/backend/v2/internal/services""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/edge"tunnelpb "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/edge/proto/tunnel/v1"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/logstream""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/startup""github.com/getarcaneapp/arcane/backend/v2/pkg/scheduler""github.com/getarcaneapp/arcane/backend/v2/pkg/utils"httputils "github.com/getarcaneapp/arcane/backend/v2/pkg/utils/httpx"+ "go.getarcane.app/streams/logs"libcrypto "go.getarcane.app/sys/crypto""google.golang.org/grpc")@@ -52,7 +53,7 @@ func Bootstrap(ctx context.Context) error {SetupSlogLogger(cfg)// Tee all slog output into the in-memory ring buffer that powers the// diagnostics live log tail.- slog.SetDefault(slog.New(logstream.NewSlogHandler(slog.Default().Handler(), logstream.Default())))+ slog.SetDefault(slog.New(logs.NewSlogHandler(slog.Default().Handler(), ws.LogBroadcaster())))ConfigureGormLogger(cfg)slog.InfoContext(ctx, "Arcane is starting...", "version", config.Version)slog.InfoContext(ctx, "Arcane Identity Configuration", "PUID", os.Getuid(), "PGID", os.Getgid())diff --git a/backend/internal/services/container_service.go b/backend/internal/services/container_service.goindex a1394f04d..1cff99d07 100644--- a/backend/internal/services/container_service.go+++ b/backend/internal/services/container_service.go@@ -25,7 +25,6 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/models"dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/containerstats""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts""github.com/getarcaneapp/arcane/backend/v2/pkg/pagination""github.com/getarcaneapp/arcane/backend/v2/pkg/projects"@@ -34,6 +33,8 @@ import (containertypes "github.com/getarcaneapp/arcane/types/v2/container""github.com/getarcaneapp/arcane/types/v2/containerregistry"imagetypes "github.com/getarcaneapp/arcane/types/v2/image"+ "go.getarcane.app/streams/bus"+ containerstats "go.getarcane.app/streams/stats""go.getarcane.app/sys/cgroup"libupdater "go.getarcane.app/updater/pkg/labels")@@ -83,8 +84,7 @@ func (s *ContainerService) subscribeUpdateInfoCacheInvalidationInternal(ctx contif s.dockerService == nil || s.updateInfoCache == nil || s.dockerService.EventBus() == nil {return}- ch := make(chan events.Message, 16)- unsubscribe := s.dockerService.EventBus().Subscribe(events.ImageEventType, ch)+ ch, unsubscribe := s.dockerService.EventBus().Subscribe(events.ImageEventType, bus.WithSubscriberBuffer(16))go func() {defer unsubscribe()for {@@ -919,7 +919,7 @@ func (s *ContainerService) StreamStats(ctx context.Context, containerID string,recordedAt = time.Now()}- payload := containertypes.StatsStreamPayload{+ payload := containerstats.StatsStreamPayload{StatsResponse: statsData,CurrentHistorySample: containerstats.BuildSample(statsData),}diff --git a/backend/internal/services/docker_client_service.go b/backend/internal/services/docker_client_service.goindex 2de2f8c42..6c9acb1e9 100644--- a/backend/internal/services/docker_client_service.go+++ b/backend/internal/services/docker_client_service.go@@ -15,7 +15,6 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/database"docker "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/eventbus""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts""github.com/getarcaneapp/arcane/backend/v2/pkg/utils/cache"dashboardtypes "github.com/getarcaneapp/arcane/types/v2/dashboard"@@ -26,6 +25,7 @@ import ("github.com/moby/moby/api/types/network""github.com/moby/moby/api/types/volume""github.com/moby/moby/client"+ "go.getarcane.app/streams/bus""golang.org/x/sync/errgroup")@@ -44,7 +44,7 @@ type DockerClientService struct {imageCache *cache.Cache[[]image.Summary]networkCache *cache.Cache[[]network.Summary]volumeCache *cache.Cache[*client.VolumeListResult]- eventBus *eventbus.DockerEventBus+ eventBus *bus.DockerEventBussubscriptionCtx context.ContextsubscriptionStop context.CancelFuncsubscriptionUnsub []func()@@ -60,7 +60,7 @@ func NewDockerClientService(ctx context.Context, db *database.DB, cfg *config.CoimageCache: cache.New[[]image.Summary](dockerListCacheTTL),networkCache: cache.New[[]network.Summary](dockerListCacheTTL),volumeCache: cache.New[*client.VolumeListResult](dockerListCacheTTL),- eventBus: eventbus.NewDockerEventBus(),+ eventBus: bus.NewDockerEventBus(),subscriptionCtx: subscriptionCtx,subscriptionStop: subscriptionStop,}@@ -226,11 +226,11 @@ func (s *DockerClientService) Close() {closeDockerClientInternal(oldClient, "failed to close Docker client")}-func (s *DockerClientService) EventBus() *eventbus.DockerEventBus {+func (s *DockerClientService) EventBus() *bus.DockerEventBus {s.mu.Lock()defer s.mu.Unlock()if s.eventBus == nil {- s.eventBus = eventbus.NewDockerEventBus()+ s.eventBus = bus.NewDockerEventBus()}return s.eventBus}@@ -276,8 +276,7 @@ func (s *DockerClientService) subscribeListCacheInvalidationInternal(ctx context}func (s *DockerClientService) subscribeCacheInvalidationInternal(ctx context.Context, eventType events.Type, invalidate func()) {- ch := make(chan events.Message, 16)- unsubscribe := s.EventBus().Subscribe(eventType, ch)+ ch, unsubscribe := s.EventBus().Subscribe(eventType, bus.WithSubscriberBuffer(16))s.mu.Lock()s.subscriptionUnsub = append(s.subscriptionUnsub, unsubscribe)s.mu.Unlock()diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.goindex 78a9067ec..eb9b6f098 100644--- a/backend/internal/services/environment_service.go+++ b/backend/internal/services/environment_service.go@@ -925,7 +925,7 @@ func (s *EnvironmentService) ListVisibleEnvironments(ctx context.Context) ([]env}// ListRemoteEnvironmentIDs returns the IDs of enabled remote environments; it-// satisfies aggstream.RemoteEnvironmentLister for aggregated stream handlers.+// satisfies agg.RemoteEnvironmentLister for aggregated stream handlers.func (s *EnvironmentService) ListRemoteEnvironmentIDs(ctx context.Context) ([]string, error) {envs, err := s.ListRemoteEnvironments(ctx)if err != nil {diff --git a/backend/pkg/libarcane/aggstream/aggstream.go b/backend/pkg/libarcane/aggstream/aggstream.godeleted file mode 100644index 906891267..000000000--- a/backend/pkg/libarcane/aggstream/aggstream.go+++ /dev/null@@ -1,191 +0,0 @@-// Package aggstream provides the plumbing for aggregated JSON-lines streams:-// endpoints that multiplex per-environment events from the local environment-// and every remote environment over a single HTTP response, so the browser-// needs one connection regardless of environment count.-package aggstream--import (- "context"- "encoding/json"- "log/slog"- "sync"- "time"-)--// RemoteEnvironmentLister lists the remote environment IDs an aggregated-// stream should cover; it decouples this package from the environment service.-type RemoteEnvironmentLister interface {- ListRemoteEnvironmentIDs(ctx context.Context) ([]string, error)-}--// Run drives a JSON-lines aggregated stream: it fans in events from the given-// producers over a single buffered channel and multiplexes them onto the-// response together with periodic heartbeats. It returns when the request-// context is canceled or the response writer fails.-func Run[T any](- ctx context.Context,- encoder *json.Encoder,- flush func(),- buffer int,- heartbeatInterval time.Duration,- makeHeartbeat func() T,- producers ...func(ctx context.Context, events chan<- T),-) {- streamCtx, cancel := context.WithCancel(ctx)-- events := make(chan T, buffer)- var wg sync.WaitGroup- wg.Add(len(producers))- for _, producer := range producers {- go func(producer func(context.Context, chan<- T)) {- defer wg.Done()- producer(streamCtx, events)- }(producer)- }- defer wg.Wait()- defer cancel()-- heartbeat := time.NewTicker(heartbeatInterval)- defer heartbeat.Stop()-- for {- select {- case <-streamCtx.Done():- return- case event := <-events:- if err := encoder.Encode(event); err != nil {- return- }- flush()- case <-heartbeat.C:- if err := encoder.Encode(makeHeartbeat()); err != nil {- return- }- flush()- }- }-}--// Send forwards an event to the stream's event channel, giving up when the-// stream is shutting down so producers can never block.-func Send[T any](ctx context.Context, events chan<- T, event T) bool {- select {- case events <- event:- return true- case <-ctx.Done():- return false- }-}--// ReconcileEnvironmentPollers keeps one poller goroutine per enabled remote-// environment, re-listing periodically so environments added or removed while-// the stream is open are picked up without a reconnect. It returns when the-// stream context is canceled, after every poller has exited.-func ReconcileEnvironmentPollers(- ctx context.Context,- lister RemoteEnvironmentLister,- reconcileInterval time.Duration,- streamLabel string,- runPoller func(ctx context.Context, environmentID string),-) {- ReconcilePollersByKey(ctx,- func(ctx context.Context) ([]string, error) {- return lister.ListRemoteEnvironmentIDs(ctx)- },- func(environmentID string) string {- return environmentID- },- nil,- reconcileInterval,- streamLabel,- runPoller,- )-}--// ReconcilePollersByKey keeps one poller goroutine per listed item, keyed by a-// stable item ID. If the same key is later returned with a different version,-// the old poller is replaced so callers can pass refreshed item metadata.-func ReconcilePollersByKey[T any](- ctx context.Context,- listItems func(context.Context) ([]T, error),- keyFunc func(T) string,- versionFunc func(T) string,- reconcileInterval time.Duration,- streamLabel string,- runPoller func(ctx context.Context, item T),-) {- type poller struct {- cancel context.CancelFunc- version string- }-- pollers := make(map[string]poller)- var wg sync.WaitGroup- defer wg.Wait()- defer func() {- for _, activePoller := range pollers {- activePoller.cancel()- }- }()-- reconcile := func() {- items, err := listItems(ctx)- if err != nil {- if ctx.Err() == nil {- slog.WarnContext(ctx, "failed to list environments for "+streamLabel, "error", err)- }- return- }-- current := make(map[string]struct{}, len(items))- for _, item := range items {- key := keyFunc(item)- if key == "" {- continue- }- version := ""- if versionFunc != nil {- version = versionFunc(item)- }- current[key] = struct{}{}-- if existingPoller, ok := pollers[key]; ok && existingPoller.version == version {- continue- }-- if existingPoller, ok := pollers[key]; ok {- existingPoller.cancel()- delete(pollers, key)- }-- pollCtx, cancelPoll := context.WithCancel(ctx)- pollers[key] = poller{cancel: cancelPoll, version: version}- wg.Add(1)- go func(pollCtx context.Context, item T) {- defer wg.Done()- runPoller(pollCtx, item)- }(pollCtx, item)- }-- for id, activePoller := range pollers {- if _, ok := current[id]; !ok {- activePoller.cancel()- delete(pollers, id)- }- }- }-- reconcile()-- ticker := time.NewTicker(reconcileInterval)- defer ticker.Stop()-- for {- select {- case <-ctx.Done():- return- case <-ticker.C:- reconcile()- }- }-}diff --git a/backend/pkg/libarcane/containerstats/history.go b/backend/pkg/libarcane/containerstats/history.godeleted file mode 100644index dea9f487d..000000000--- a/backend/pkg/libarcane/containerstats/history.go+++ /dev/null@@ -1,142 +0,0 @@-package containerstats--import (- "math"- "sync"- "time"-- containertypes "github.com/getarcaneapp/arcane/types/v2/container"- dockercontainer "github.com/moby/moby/api/types/container"-)--const (- HistoryCapacity = 30- historyTTL = 10 * time.Minute- historyPruneInterval = time.Minute-)--type Store struct {- mu sync.Mutex- histories map[string]*historyBuffer- lastPrune time.Time-}--type historyBuffer struct {- samples [HistoryCapacity]containertypes.StatsHistorySample- start int- count int- updatedAt time.Time-}--func BuildSample(stats dockercontainer.StatsResponse) containertypes.StatsHistorySample {- memoryUsage := calculateMemoryUsageInternal(stats)- return containertypes.StatsHistorySample{- CPUTenths: percentToTenthsInternal(calculateCPUPercentInternal(stats)),- MemoryTenths: percentToTenthsInternal(calculateMemoryPercentInternal(stats)),- MemoryUsageBytes: memoryUsage,- }-}--func (s *Store) Record(containerID string, sample containertypes.StatsHistorySample, includeHistory bool, recordedAt time.Time) []containertypes.StatsHistorySample {- s.mu.Lock()- defer s.mu.Unlock()-- if s.histories == nil {- s.histories = make(map[string]*historyBuffer)- }-- s.maybePruneLockedInternal(recordedAt)-- buffer := s.histories[containerID]- if buffer == nil {- buffer = &historyBuffer{}- s.histories[containerID] = buffer- }-- buffer.append(sample, recordedAt)-- if !includeHistory {- return nil- }-- return buffer.snapshot()-}--func (b *historyBuffer) append(sample containertypes.StatsHistorySample, recordedAt time.Time) {- if b.count < HistoryCapacity {- index := (b.start + b.count) % HistoryCapacity- b.samples[index] = sample- b.count++- } else {- b.samples[b.start] = sample- b.start = (b.start + 1) % HistoryCapacity- }-- b.updatedAt = recordedAt-}--func (b *historyBuffer) snapshot() []containertypes.StatsHistorySample {- if b.count == 0 {- return nil- }-- out := make([]containertypes.StatsHistorySample, 0, b.count)- for i := range b.count {- index := (b.start + i) % HistoryCapacity- out = append(out, b.samples[index])- }- return out-}--func (s *Store) maybePruneLockedInternal(now time.Time) {- if now.IsZero() {- now = time.Now()- }-- if !s.lastPrune.IsZero() && now.Sub(s.lastPrune) < historyPruneInterval {- return- }-- s.lastPrune = now- for containerID, buffer := range s.histories {- if buffer == nil || now.Sub(buffer.updatedAt) > historyTTL {- delete(s.histories, containerID)- }- }-}--func calculateCPUPercentInternal(stats dockercontainer.StatsResponse) float64 {- cpuDelta := float64(stats.CPUStats.CPUUsage.TotalUsage) - float64(stats.PreCPUStats.CPUUsage.TotalUsage)- systemDelta := float64(stats.CPUStats.SystemUsage) - float64(stats.PreCPUStats.SystemUsage)-- if systemDelta <= 0 || cpuDelta <= 0 {- return 0- }-- return math.Min(math.Max((cpuDelta/systemDelta)*100, 0), 100)-}--func calculateMemoryPercentInternal(stats dockercontainer.StatsResponse) float64 {- limit := stats.MemoryStats.Limit- if limit == 0 {- return 0- }-- usage := calculateMemoryUsageInternal(stats)- return math.Min(math.Max((float64(usage)/float64(limit))*100, 0), 100)-}--func calculateMemoryUsageInternal(stats dockercontainer.StatsResponse) uint64 {- usage := stats.MemoryStats.Usage- inactiveFile := stats.MemoryStats.Stats["inactive_file"]- if usage <= inactiveFile {- return 0- }-- return usage - inactiveFile-}--func percentToTenthsInternal(value float64) uint16 {- clamped := math.Min(math.Max(value, 0), 100)- return uint16(math.Round(clamped * 10))-}diff --git a/backend/pkg/libarcane/containerstats/history_test.go b/backend/pkg/libarcane/containerstats/history_test.godeleted file mode 100644index 5031491f5..000000000--- a/backend/pkg/libarcane/containerstats/history_test.go+++ /dev/null@@ -1,102 +0,0 @@-package containerstats--import (- "testing"- "time"-- containertypes "github.com/getarcaneapp/arcane/types/v2/container"- "github.com/moby/moby/api/types/container"- "github.com/stretchr/testify/require"-)--func TestBuildSample(t *testing.T) {- stats := container.StatsResponse{- CPUStats: container.CPUStats{- CPUUsage: container.CPUUsage{TotalUsage: 250},- SystemUsage: 500,- },- PreCPUStats: container.CPUStats{- CPUUsage: container.CPUUsage{TotalUsage: 50},- SystemUsage: 100,- },- MemoryStats: container.MemoryStats{- Usage: 700,- Limit: 1000,- Stats: map[string]uint64{"inactive_file": 100},- },- }-- sample := BuildSample(stats)-- require.Equal(t, uint16(500), sample.CPUTenths)- require.Equal(t, uint16(600), sample.MemoryTenths)- require.Equal(t, uint64(600), sample.MemoryUsageBytes)-}--func TestStoreRecordCapsAndPreservesOrder(t *testing.T) {- var store Store- baseTime := time.Date(2026, 3, 26, 12, 0, 0, 0, time.UTC)-- for i := range HistoryCapacity + 5 {- store.Record(- "container-1",- containertypes.StatsHistorySample{- CPUTenths: uint16(i),- MemoryTenths: uint16(i + 100),- MemoryUsageBytes: uint64(i + 1000),- },- false,- baseTime.Add(time.Duration(i)*time.Second),- )- }-- snapshot := snapshotForTest(&store, "container-1", baseTime.Add(5*time.Minute))- require.Len(t, snapshot, HistoryCapacity)-- for i, sample := range snapshot {- expected := i + 5- require.Equal(t, uint16(expected), sample.CPUTenths)- require.Equal(t, uint16(expected+100), sample.MemoryTenths)- require.Equal(t, uint64(expected+1000), sample.MemoryUsageBytes)- }-}--func TestStoreRecordPrunesExpiredContainers(t *testing.T) {- var store Store- baseTime := time.Date(2026, 3, 26, 12, 0, 0, 0, time.UTC)-- store.Record("stale-container", containertypes.StatsHistorySample{CPUTenths: 111, MemoryTenths: 222, MemoryUsageBytes: 333}, false, baseTime)- store.Record(- "fresh-container",- containertypes.StatsHistorySample{CPUTenths: 333, MemoryTenths: 444, MemoryUsageBytes: 555},- false,- baseTime.Add(historyTTL-historyPruneInterval),- )-- staleSnapshot := snapshotForTest(&store, "stale-container", baseTime.Add(historyTTL+time.Minute))- freshSnapshot := snapshotForTest(- &store,- "fresh-container",- baseTime.Add(historyTTL-historyPruneInterval+time.Minute),- )-- require.Nil(t, staleSnapshot)- require.Len(t, freshSnapshot, 1)- require.Equal(t, uint16(333), freshSnapshot[0].CPUTenths)- require.Equal(t, uint16(444), freshSnapshot[0].MemoryTenths)- require.Equal(t, uint64(555), freshSnapshot[0].MemoryUsageBytes)-}--func snapshotForTest(store *Store, containerID string, now time.Time) []containertypes.StatsHistorySample {- store.mu.Lock()- defer store.mu.Unlock()-- store.maybePruneLockedInternal(now)-- buffer := store.histories[containerID]- if buffer == nil {- return nil- }-- return buffer.snapshot()-}diff --git a/backend/pkg/libarcane/eventbus/docker_event_bus.go b/backend/pkg/libarcane/eventbus/docker_event_bus.godeleted file mode 100644index 3f5786651..000000000--- a/backend/pkg/libarcane/eventbus/docker_event_bus.go+++ /dev/null@@ -1,75 +0,0 @@-package eventbus--import (- "sync"-- "github.com/moby/moby/api/types/events"-)--// DockerEventBus is an in-process fan-out point for Docker daemon events.-//-// Publishers send the raw Docker event message once, and subscribers register by-// Docker event type. Consumers should treat messages as invalidation signals-// rather than authoritative state deltas; after receiving an event they should-// refetch the resource state they own.-type DockerEventBus struct {- mu sync.RWMutex- subs map[events.Type]map[chan<- events.Message]struct{}-}--// NewDockerEventBus creates an empty Docker event bus.-func NewDockerEventBus() *DockerEventBus {- return &DockerEventBus{- subs: make(map[events.Type]map[chan<- events.Message]struct{}),- }-}--// Subscribe registers ch for messages of eventType and returns a cancellation-// function that removes the subscription. Delivery is non-blocking, so callers-// should use a buffered channel sized for their invalidation workload.-func (b *DockerEventBus) Subscribe(eventType events.Type, ch chan<- events.Message) func() {- if b == nil || ch == nil {- return func() {}- }-- b.mu.Lock()- if b.subs[eventType] == nil {- b.subs[eventType] = make(map[chan<- events.Message]struct{})- }- b.subs[eventType][ch] = struct{}{}- b.mu.Unlock()-- return func() {- b.mu.Lock()- if subs := b.subs[eventType]; subs != nil {- delete(subs, ch)- if len(subs) == 0 {- delete(b.subs, eventType)- }- }- b.mu.Unlock()- }-}--// Publish fans out msg to subscribers of msg.Type. Slow or full subscriber-// channels are skipped so Docker event consumption cannot be blocked by one-// listener.-func (b *DockerEventBus) Publish(msg events.Message) {- if b == nil {- return- }-- b.mu.RLock()- subs := make([]chan<- events.Message, 0, len(b.subs[msg.Type]))- for ch := range b.subs[msg.Type] {- subs = append(subs, ch)- }- b.mu.RUnlock()-- for _, ch := range subs {- select {- case ch <- msg:- default:- }- }-}diff --git a/backend/pkg/libarcane/logstream/logstream.go b/backend/pkg/libarcane/logstream/logstream.godeleted file mode 100644index 1848491b8..000000000--- a/backend/pkg/libarcane/logstream/logstream.go+++ /dev/null@@ -1,217 +0,0 @@-// Package logstream captures the application's own slog output into a bounded-// in-memory ring buffer and fans it out to live subscribers. It backs the-// diagnostics endpoints' "recent logs" backlog and the live backend-log-// WebSocket stream. It deliberately depends only on the shared types package so-// both bootstrap (which installs the slog handler) and the API handlers (which-// read it) can use it without an import cycle.-package logstream--import (- "context"- "log/slog"- "sync"-- "github.com/getarcaneapp/arcane/types/v2/system"-)--// defaultRingCapacity is the number of recent log entries retained in memory.-const defaultRingCapacity = 1000--// subscriberBuffer is the per-subscriber channel buffer. Slow consumers have-// entries dropped rather than blocking the logger.-const subscriberBuffer = 256--// Entry is a single captured log record.-type Entry = system.LogEntry--// Broadcaster keeps a bounded ring buffer of recent log entries and fans new-// entries out to any active subscribers. It is safe for concurrent use.-type Broadcaster struct {- mu sync.Mutex- buf []Entry- start int- size int- capN int- subs map[chan Entry]struct{}-}--// New returns a Broadcaster retaining up to capacity recent entries.-func New(capacity int) *Broadcaster {- if capacity <= 0 {- capacity = defaultRingCapacity- }- return &Broadcaster{- buf: make([]Entry, capacity),- capN: capacity,- subs: make(map[chan Entry]struct{}),- }-}--// Append records an entry in the ring buffer and delivers it to subscribers.-// Delivery is non-blocking; a subscriber whose buffer is full drops the entry.-func (b *Broadcaster) Append(e Entry) {- b.mu.Lock()- defer b.mu.Unlock()-- if b.size < b.capN {- b.buf[(b.start+b.size)%b.capN] = e- b.size++- } else {- b.buf[b.start] = e- b.start = (b.start + 1) % b.capN- }-- // Non-blocking sends under the lock: cancel() also takes the lock before- // closing a subscriber channel, so we never send on a closed channel.- for ch := range b.subs {- select {- case ch <- e:- default:- }- }-}--// Recent returns the buffered entries in chronological order (oldest first).-func (b *Broadcaster) Recent() []Entry {- b.mu.Lock()- defer b.mu.Unlock()-- out := make([]Entry, b.size)- for i := range b.size {- out[i] = b.buf[(b.start+i)%b.capN]- }- return out-}--// Subscribe registers a new live subscriber. It returns a receive-only channel-// of subsequent entries and a cancel func that unsubscribes and closes the-// channel. cancel is idempotent.-func (b *Broadcaster) Subscribe() (<-chan Entry, func()) {- ch := make(chan Entry, subscriberBuffer)- b.mu.Lock()- b.subs[ch] = struct{}{}- b.mu.Unlock()-- var once sync.Once- cancel := func() {- once.Do(func() {- b.mu.Lock()- delete(b.subs, ch)- close(ch)- b.mu.Unlock()- })- }- return ch, cancel-}--var defaultBroadcaster = New(defaultRingCapacity)--// Default returns the package-level Broadcaster singleton.-func Default() *Broadcaster { return defaultBroadcaster }--// slogHandler wraps a base slog.Handler, forwarding every record to it while-// also appending it to a Broadcaster.-type slogHandler struct {- base slog.Handler- b *Broadcaster-}--// NewSlogHandler returns a slog.Handler that tees records to base and to b.-func NewSlogHandler(base slog.Handler, b *Broadcaster) slog.Handler {- return &slogHandler{base: base, b: b}-}--func (h *slogHandler) Enabled(ctx context.Context, level slog.Level) bool {- return h.base.Enabled(ctx, level)-}--func (h *slogHandler) Handle(ctx context.Context, r slog.Record) error {- var attrs map[string]any- if r.NumAttrs() > 0 {- attrs = make(map[string]any, r.NumAttrs())- r.Attrs(func(a slog.Attr) bool {- attrs[a.Key] = normalizeAttrValueInternal(a.Value)- return true- })- }- h.b.Append(Entry{- Time: r.Time,- Level: r.Level.String(),- Message: r.Message,- Attrs: attrs,- })- return h.base.Handle(ctx, r)-}--func (h *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler {- return &slogHandler{base: h.base.WithAttrs(attrs), b: h.b}-}--func (h *slogHandler) WithGroup(name string) slog.Handler {- return &slogHandler{base: h.base.WithGroup(name), b: h.b}-}--func normalizeAttrValueInternal(value slog.Value) any {- value = value.Resolve()-- switch value.Kind() {- case slog.KindAny:- return normalizeAnyValueInternal(value.Any())- case slog.KindBool:- return value.Bool()- case slog.KindDuration:- return value.Duration()- case slog.KindFloat64:- return value.Float64()- case slog.KindGroup:- return normalizeGroupAttrsInternal(value.Group())- case slog.KindInt64:- return value.Int64()- case slog.KindLogValuer:- return value.String()- case slog.KindString:- return value.String()- case slog.KindTime:- return value.Time()- case slog.KindUint64:- return value.Uint64()- default:- return value.String()- }-}--func normalizeAnyValueInternal(value any) any {- switch typed := value.(type) {- case slog.Attr:- return map[string]any{typed.Key: normalizeAttrValueInternal(typed.Value)}- case []slog.Attr:- return normalizeGroupAttrsInternal(typed)- case slog.Value:- return normalizeAttrValueInternal(typed)- case []any:- out := make([]any, len(typed))- for i, item := range typed {- out[i] = normalizeAnyValueInternal(item)- }- return out- case map[string]any:- out := make(map[string]any, len(typed))- for key, item := range typed {- out[key] = normalizeAnyValueInternal(item)- }- return out- default:- return value- }-}--func normalizeGroupAttrsInternal(attrs []slog.Attr) map[string]any {- out := make(map[string]any, len(attrs))- for _, attr := range attrs {- if attr.Key == "" {- continue- }- out[attr.Key] = normalizeAttrValueInternal(attr.Value)- }- return out-}diff --git a/backend/pkg/libarcane/logstream/logstream_test.go b/backend/pkg/libarcane/logstream/logstream_test.godeleted file mode 100644index 8397ae8d9..000000000--- a/backend/pkg/libarcane/logstream/logstream_test.go+++ /dev/null@@ -1,47 +0,0 @@-package logstream--import (- "context"- "io"- "log/slog"- "reflect"- "testing"- "time"-)--func TestSlogHandlerNormalizesGroupedAttrsInternal(t *testing.T) {- b := New(10)- h := NewSlogHandler(slog.NewTextHandler(io.Discard, nil), b)- record := slog.NewRecord(time.Unix(1, 0).UTC(), slog.LevelInfo, "Incoming request", 0)- record.AddAttrs(- slog.Group("request",- slog.String("method", "GET"),- slog.String("path", "/api/diagnostics/logs"),- slog.Group("headers", slog.String("accept", "application/json")),- ),- slog.Any("ids", []string{"one", "two"}),- )-- if err := h.Handle(context.Background(), record); err != nil {- t.Fatalf("Handle failed: %v", err)- }-- entries := b.Recent()- if len(entries) != 1 {- t.Fatalf("Recent returned %d entries, want 1", len(entries))- }-- wantRequest := map[string]any{- "method": "GET",- "path": "/api/diagnostics/logs",- "headers": map[string]any{- "accept": "application/json",- },- }- if !reflect.DeepEqual(entries[0].Attrs["request"], wantRequest) {- t.Fatalf("request attr = %#v, want %#v", entries[0].Attrs["request"], wantRequest)- }- if !reflect.DeepEqual(entries[0].Attrs["ids"], []string{"one", "two"}) {- t.Fatalf("ids attr = %#v, want %#v", entries[0].Attrs["ids"], []string{"one", "two"})- }-}diff --git a/go.work.sum b/go.work.sumindex 73a6583fa..ea40c64db 100644--- a/go.work.sum+++ b/go.work.sum@@ -2082,10 +2082,8 @@ go.etcd.io/gofail v0.2.0 h1:p19drv16FKK345a09a1iubchlw/vmRuksmRzgBIGjcA=go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o=go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ=go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo=-go.getarcane.app/docker/convert v0.1.0 h1:prlIOs6dMx6CdnetsJFZ6ak0vcistM3DcH5lrZiFHBU=-go.getarcane.app/docker/convert v0.1.0/go.mod h1:o9y4z/vah8HiHFtI+jJVFHbs8nLrkARYt88OaUlvGig=-go.getarcane.app/sys/crypto v0.1.0 h1:HDQ2CKHkm+wZe5xb/qR7MzW5fKi0Wq8Jcyr7qDVgRWg=-go.getarcane.app/sys/crypto v0.1.0/go.mod h1:YtoRB0TENwfdNl0ZUTWkeas/8rT7NhCbI8ENsZzCCdU=+go.getarcane.app/streams v0.1.0 h1:7ToYnGNz2/dKmmelwl/UagOkk+BjOC5JKwHMZrU/b4g=+go.getarcane.app/streams v0.1.0/go.mod h1:LHMKblQvsL1nqKh/Y+KgQbwFSMI2I7bs9u8ZwZqzjnQ=go.getarcane.app/updater v0.3.6 h1:+BqoycaRsHj+cLVSzcYQuqbHxUKbtmaozMNblz5bVSw=go.getarcane.app/updater v0.3.6/go.mod h1:2ENitZR/lA5MuBn60OZYR5wvU3ZCE+pAgfrebfOlRDA=go.getarcane.app/updater v0.3.7 h1:WqHsxudvt8gvCR7iSHdxdzwH0+hM0FAh64bSypBX9Mo=@@ -2494,6 +2492,7 @@ golang.org/x/tools/godoc v0.1.0-deprecated/go.mod h1:qM63CriJ961IHWmnWa9CjZnBndngolang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=diff --git a/types/container/history.go b/types/container/history.godeleted file mode 100644index f7d22d9b4..000000000--- a/types/container/history.go+++ /dev/null@@ -1,18 +0,0 @@-package container--import dockercontainer "github.com/moby/moby/api/types/container"--// StatsHistorySample is a compact history sample for container CPU and memory usage.-type StatsHistorySample struct {- CPUTenths uint16 `json:"cpuTenths"`- MemoryTenths uint16 `json:"memoryTenths"`- MemoryUsageBytes uint64 `json:"memoryUsageBytes"`-}--// StatsStreamPayload is the container stats websocket payload.-type StatsStreamPayload struct {- dockercontainer.StatsResponse-- StatsHistory []StatsHistorySample `json:"statsHistory,omitempty"`- CurrentHistorySample StatsHistorySample `json:"currentHistorySample"`-}diff --git a/types/system/diagnostics.go b/types/system/diagnostics.goindex e6dbce085..6e3961d21 100644--- a/types/system/diagnostics.go+++ b/types/system/diagnostics.go@@ -81,22 +81,3 @@ type WebSocketDiagnostics struct {Snapshot WebSocketMetricsSnapshot `json:"snapshot"`Connections []WebSocketConnectionInfo `json:"connections"`}--// LogEntry is a single captured backend log record, exposed via the recent-logs-// endpoint and the live log WebSocket stream.-type LogEntry struct {- // Time is when the record was emitted.- //- // Required: true- Time time.Time `json:"time"`- // Level is the slog level name (DEBUG, INFO, WARN, ERROR).- //- // Required: true- Level string `json:"level"`- // Message is the log message.- //- // Required: true- Message string `json:"message"`- // Attrs holds the record's structured attributes, if any.- Attrs map[string]any `json:"attrs,omitempty"`-}