MCPcopy
hub / github.com/containerd/containerd / Unmarshal

Method Unmarshal

internal/userns/idmap.go:97–119  ·  view source on GitHub ↗

Unmarshal deserialize the passed uidmap and gidmap strings into a IDMap object. Error is returned in case of failure

(uidMap, gidMap string)

Source from the content-addressed store, hash-verified

95// Unmarshal deserialize the passed uidmap and gidmap strings
96// into a IDMap object. Error is returned in case of failure
97func (i *IDMap) Unmarshal(uidMap, gidMap string) error {
98 unmarshal := func(str string, fn func(m specs.LinuxIDMapping)) error {
99 if len(str) == 0 {
100 return nil
101 }
102 for mapping := range strings.SplitSeq(str, ",") {
103 m, err := deserializeLinuxIDMapping(mapping)
104 if err != nil {
105 return err
106 }
107 fn(m)
108 }
109 return nil
110 }
111 if err := unmarshal(uidMap, func(m specs.LinuxIDMapping) {
112 i.UidMap = append(i.UidMap, m)
113 }); err != nil {
114 return err
115 }
116 return unmarshal(gidMap, func(m specs.LinuxIDMapping) {
117 i.GidMap = append(i.GidMap, m)
118 })
119}
120
121// toHost takes an id mapping and a remapped ID, and translates the
122// ID to the mapped host ID. If no map is provided, then the translation

Callers 15

TestUnmarshalFunction · 0.95
createSnapshotMethod · 0.95
createSnapshotMethod · 0.95
GetOCIStopSignalFunction · 0.80
SpecMethod · 0.80
resolveSnapshotOptionsFunction · 0.80
WithImageConfigLabelsFunction · 0.80
SpecMethod · 0.80
decodeIndexFunction · 0.80
WithProfileFunction · 0.80
getContainerBindVolumesFunction · 0.80

Calls 1

Tested by 15

TestUnmarshalFunction · 0.76
getContainerBindVolumesFunction · 0.64
criRuntimeInfoFunction · 0.64
sbserverSandboxInfoFunction · 0.64
CRIConfigFunction · 0.64
SandboxInfoFunction · 0.64
withImageFunction · 0.64
testocimanifestFunction · 0.64