MCPcopy Create free account
hub / github.com/Merovius/nbd / decodeInfo

Function decodeInfo

types.go:270–291  ·  view source on GitHub ↗
(e *encoder, l uint32)

Source from the content-addressed store, hash-verified

268)
269
270func decodeInfo(e *encoder, l uint32) optionReply {
271 if l < 2 {
272 e.check(errors.New("invalid length for info reply"))
273 }
274 code := e.uint16()
275 var rep optionReply
276 switch code {
277 case cInfoExport:
278 rep = new(infoExport)
279 case cInfoName:
280 rep = new(infoName)
281 case cInfoDescription:
282 rep = new(infoDescription)
283 case cInfoBlockSize:
284 rep = new(infoBlockSize)
285 default:
286 e.discard(l - 2)
287 return nil
288 }
289 rep.decode(e, l-2)
290 return rep
291}
292
293type infoExport struct {
294 size uint64

Callers 1

recvMethod · 0.85

Calls 3

decodeMethod · 0.95
uint16Method · 0.80
discardMethod · 0.80

Tested by

no test coverage detected