Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
container/podman: containerhandler: use pointer-receiver
It's more idiomatic, and aligns with the docker implementation for
the same.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Dec 5, 2025
commit f36f455717de941e577cfcbdc8808ee9a5626ec1
26 changes: 13 additions & 13 deletions container/podman/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,19 @@ func determineDeviceStorage(storageDriver docker.StorageDriver, storageDir strin
}
}

func (h containerHandler) ContainerReference() (info.ContainerReference, error) {
func (h *containerHandler) ContainerReference() (info.ContainerReference, error) {
return h.reference, nil
}

func (h containerHandler) needNet() bool {
func (h *containerHandler) needNet() bool {
if h.metrics.Has(container.NetworkUsageMetrics) {
h.networkMode.IsContainer()
return !h.networkMode.IsContainer()
}
return false
}

func (h containerHandler) GetSpec() (info.ContainerSpec, error) {
func (h *containerHandler) GetSpec() (info.ContainerSpec, error) {
hasFilesystem := h.metrics.Has(container.DiskUsageMetrics)

spec, err := common.GetSpec(h.cgroupPaths, h.machineInfoFactory, h.needNet(), hasFilesystem)
Expand All @@ -240,7 +240,7 @@ func (h containerHandler) GetSpec() (info.ContainerSpec, error) {
return spec, nil
}

func (h containerHandler) GetStats() (*info.ContainerStats, error) {
func (h *containerHandler) GetStats() (*info.ContainerStats, error) {
stats, err := h.libcontainerHandler.GetStats()
if err != nil {
return stats, err
Expand All @@ -259,15 +259,15 @@ func (h containerHandler) GetStats() (*info.ContainerStats, error) {
return stats, nil
}

func (h containerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
func (h *containerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
return []info.ContainerReference{}, nil
}

func (h containerHandler) ListProcesses(listType container.ListType) ([]int, error) {
func (h *containerHandler) ListProcesses(listType container.ListType) ([]int, error) {
return h.libcontainerHandler.GetProcesses()
}

func (h containerHandler) GetCgroupPath(resource string) (string, error) {
func (h *containerHandler) GetCgroupPath(resource string) (string, error) {
var res string
if !cgroups.IsCgroup2UnifiedMode() {
res = resource
Expand All @@ -280,30 +280,30 @@ func (h containerHandler) GetCgroupPath(resource string) (string, error) {
return path, nil
}

func (h containerHandler) GetContainerLabels() map[string]string {
func (h *containerHandler) GetContainerLabels() map[string]string {
return h.labels
}

func (h containerHandler) GetContainerIPAddress() string {
func (h *containerHandler) GetContainerIPAddress() string {
return h.ipAddress
}

func (h containerHandler) Exists() bool {
func (h *containerHandler) Exists() bool {
return common.CgroupExists(h.cgroupPaths)
}

func (h containerHandler) Cleanup() {
func (h *containerHandler) Cleanup() {
if h.fsHandler != nil {
h.fsHandler.Stop()
}
}

func (h containerHandler) Start() {
func (h *containerHandler) Start() {
if h.fsHandler != nil {
h.fsHandler.Start()
}
}

func (h containerHandler) Type() container.ContainerType {
func (h *containerHandler) Type() container.ContainerType {
return container.ContainerTypePodman
}