mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00
44 lines
895 B
Go
44 lines
895 B
Go
package idlewatcher
|
|
|
|
import idlewatcher "github.com/yusing/go-proxy/internal/idlewatcher/types"
|
|
|
|
func (w *Watcher) running() bool {
|
|
return w.state.Load().status == idlewatcher.ContainerStatusRunning
|
|
}
|
|
|
|
func (w *Watcher) ready() bool {
|
|
return w.state.Load().ready
|
|
}
|
|
|
|
func (w *Watcher) error() error {
|
|
return w.state.Load().err
|
|
}
|
|
|
|
func (w *Watcher) setReady() {
|
|
w.state.Store(&containerState{
|
|
status: idlewatcher.ContainerStatusRunning,
|
|
ready: true,
|
|
})
|
|
}
|
|
|
|
func (w *Watcher) setStarting() {
|
|
w.state.Store(&containerState{
|
|
status: idlewatcher.ContainerStatusRunning,
|
|
ready: false,
|
|
})
|
|
}
|
|
|
|
func (w *Watcher) setNapping(status idlewatcher.ContainerStatus) {
|
|
w.state.Store(&containerState{
|
|
status: status,
|
|
ready: false,
|
|
})
|
|
}
|
|
|
|
func (w *Watcher) setError(err error) {
|
|
w.state.Store(&containerState{
|
|
status: idlewatcher.ContainerStatusError,
|
|
ready: false,
|
|
err: err,
|
|
})
|
|
}
|