Files
godoxy-yusing/internal/docker/id_lookup.go
yusing 20105534c7 feat(api): add GetContainer endpoint and Docker host ID mapping
- Implemented GetContainer function to retrieve container details by ID.
- Introduced idDockerHostMap for mapping container IDs to Docker hosts.
- Updated Container struct to allow omitting the State field in JSON responses.
2025-09-04 06:36:02 +08:00

20 lines
376 B
Go

package docker
import (
"github.com/puzpuzpuz/xsync/v4"
)
var idDockerHostMap = xsync.NewMap[string, string]()
func GetDockerHostByContainerID(id string) (string, bool) {
return idDockerHostMap.Load(id)
}
func SetDockerHostByContainerID(id, host string) {
idDockerHostMap.Store(id, host)
}
func DeleteDockerHostByContainerID(id string) {
idDockerHostMap.Delete(id)
}