mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust variable names
This commit is contained in:
parent
2bfc8970d2
commit
406a80da4b
|
@ -134,12 +134,9 @@ func (v *Volume) readNeedleDataInto(n *needle.Needle, readOption *ReadOption, wr
|
||||||
|
|
||||||
// read needle data
|
// read needle data
|
||||||
crc := needle.CRC(0)
|
crc := needle.CRC(0)
|
||||||
r := v.DataBackend
|
for x := offset; x < offset+size; x += int64(len(buf)) {
|
||||||
volumeOffset := actualOffset
|
count, err := n.ReadNeedleData(v.DataBackend, actualOffset, buf, x)
|
||||||
needleOffset := offset
|
toWrite := min(count, int(offset+size-x))
|
||||||
for x := needleOffset; x < needleOffset+size; x += int64(len(buf)) {
|
|
||||||
count, err := n.ReadNeedleData(r, volumeOffset, buf, x)
|
|
||||||
toWrite := min(count, int(needleOffset+size-x))
|
|
||||||
if toWrite > 0 {
|
if toWrite > 0 {
|
||||||
crc = crc.Update(buf[0:toWrite])
|
crc = crc.Update(buf[0:toWrite])
|
||||||
if _, err = writer.Write(buf[0:toWrite]); err != nil {
|
if _, err = writer.Write(buf[0:toWrite]); err != nil {
|
||||||
|
@ -157,7 +154,7 @@ func (v *Volume) readNeedleDataInto(n *needle.Needle, readOption *ReadOption, wr
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if needleOffset == 0 && size == int64(n.DataSize) && (n.Checksum != crc && uint32(n.Checksum) != crc.Value()) {
|
if offset == 0 && size == int64(n.DataSize) && (n.Checksum != crc && uint32(n.Checksum) != crc.Value()) {
|
||||||
// the crc.Value() function is to be deprecated. this double checking is for backward compatible.
|
// the crc.Value() function is to be deprecated. this double checking is for backward compatible.
|
||||||
return fmt.Errorf("ReadNeedleData checksum %v expected %v", crc, n.Checksum)
|
return fmt.Errorf("ReadNeedleData checksum %v expected %v", crc, n.Checksum)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue