mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
refactor(watcher): rename events package to watcherEvents
- Updated import paths and references from events to watcherEvents across multiple files
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/yusing/godoxy/internal/proxmox"
|
||||
"github.com/yusing/godoxy/internal/types"
|
||||
"github.com/yusing/godoxy/internal/watcher"
|
||||
"github.com/yusing/godoxy/internal/watcher/events"
|
||||
watcherEvents "github.com/yusing/godoxy/internal/watcher/events"
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
)
|
||||
|
||||
@@ -101,7 +101,7 @@ func (p *ProxmoxProvider) Watch(ctx context.Context) (<-chan watcher.Event, <-ch
|
||||
defer ticker.Stop()
|
||||
|
||||
event := watcher.Event{
|
||||
Type: events.EventTypeDocker,
|
||||
Type: watcherEvents.EventTypeDocker,
|
||||
ActorID: strconv.FormatUint(p.vmid, 10),
|
||||
ActorName: p.lxcName,
|
||||
}
|
||||
@@ -119,9 +119,9 @@ func (p *ProxmoxProvider) Watch(ctx context.Context) (<-chan watcher.Event, <-ch
|
||||
if p.running != running {
|
||||
p.running = running
|
||||
if running {
|
||||
event.Action = events.ActionContainerStart
|
||||
event.Action = watcherEvents.ActionContainerStart
|
||||
} else {
|
||||
event.Action = events.ActionContainerStop
|
||||
event.Action = watcherEvents.ActionContainerStop
|
||||
}
|
||||
eventCh <- event
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/yusing/godoxy/internal/types"
|
||||
"github.com/yusing/godoxy/internal/watcher/events"
|
||||
watcherEvents "github.com/yusing/godoxy/internal/watcher/events"
|
||||
)
|
||||
|
||||
type Provider interface {
|
||||
@@ -14,6 +14,6 @@ type Provider interface {
|
||||
ContainerStop(ctx context.Context, signal types.ContainerSignal, timeout int) error
|
||||
ContainerKill(ctx context.Context, signal types.ContainerSignal) error
|
||||
ContainerStatus(ctx context.Context) (ContainerStatus, error)
|
||||
Watch(ctx context.Context) (eventCh <-chan events.Event, errCh <-chan error)
|
||||
Watch(ctx context.Context) (eventCh <-chan watcherEvents.Event, errCh <-chan error)
|
||||
Close()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
idlewatcher "github.com/yusing/godoxy/internal/idlewatcher/types"
|
||||
nettypes "github.com/yusing/godoxy/internal/net/types"
|
||||
"github.com/yusing/godoxy/internal/types"
|
||||
"github.com/yusing/godoxy/internal/watcher/events"
|
||||
watcherEvents "github.com/yusing/godoxy/internal/watcher/events"
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
gevents "github.com/yusing/goutils/events"
|
||||
"github.com/yusing/goutils/http/reverseproxy"
|
||||
@@ -577,9 +577,9 @@ func (w *Watcher) watchUntilDestroy() (returnCause error) {
|
||||
case e := <-eventCh:
|
||||
w.l.Debug().Stringer("action", e.Action).Msg("state changed")
|
||||
switch e.Action {
|
||||
case events.ActionContainerDestroy:
|
||||
case watcherEvents.ActionContainerDestroy:
|
||||
return errCauseContainerDestroy
|
||||
case events.ActionForceReload:
|
||||
case watcherEvents.ActionForceReload:
|
||||
continue
|
||||
}
|
||||
w.resetIdleTimer()
|
||||
|
||||
Reference in New Issue
Block a user