MCPcopy
hub / github.com/minio/minio-go / crcMatchesName

Function crcMatchesName

functional_tests.go:332–344  ·  view source on GitHub ↗
(r io.Reader, name string)

Source from the content-addressed store, hash-verified

330}
331
332func crcMatchesName(r io.Reader, name string) error {
333 want := dataFileCRC32[name]
334 crc := crc32.NewIEEE()
335 _, err := io.Copy(crc, r)
336 if err != nil {
337 panic(err)
338 }
339 got := crc.Sum32()
340 if got != want {
341 return fmt.Errorf("crc mismatch, want %x, got %x", want, got)
342 }
343 return nil
344}
345
346// read data from file if it exists or optionally create a buffer of particular size
347func getDataReader(fileName string) io.ReadCloser {

Callers 4

testPutObjectReadAtFunction · 0.85
testGetObjectClosedTwiceFunction · 0.85
testCopyObjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected