MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / GetVolume

Method GetVolume

server-source-code/internal/store/docker.go:623–640  ·  view source on GitHub ↗

GetVolume returns a volume by ID with host info.

(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

621
622// GetVolume returns a volume by ID with host info.
623func (s *DockerStore) GetVolume(ctx context.Context, id string) (*VolumeDetail, error) {
624 d := s.db.DB(ctx)
625 v, err := d.Queries.GetVolumeByID(ctx, id)
626 if err != nil {
627 return nil, err
628 }
629
630 hostRows, _ := d.Queries.GetDockerHostsByIDs(ctx, []string{v.HostID})
631 var hostPtr *HostInfo
632 if len(hostRows) > 0 {
633 hostPtr = dockerHostDetailRowToHostInfo(hostRows[0])
634 }
635
636 return &VolumeDetail{
637 Volume: dbDockerVolumeToModel(v),
638 Hosts: hostPtr,
639 }, nil
640}
641
642// VolumeDetail is volume with host.
643type VolumeDetail struct {

Callers

nothing calls this directly

Calls 5

dbDockerVolumeToModelFunction · 0.85
DBMethod · 0.65
GetVolumeByIDMethod · 0.65
GetDockerHostsByIDsMethod · 0.65

Tested by

no test coverage detected