cli: rename readBlock to readBytes

It reads only byte slice.
This commit is contained in:
Evgenii Stratonikov 2020-08-13 10:10:56 +03:00
parent a1357789cf
commit 5703c4859b

View file

@ -287,7 +287,7 @@ func restoreDB(ctx *cli.Context) error {
} }
i := dumpStart i := dumpStart
for ; i < start; i++ { for ; i < start; i++ {
_, err := readBlock(reader) _, err := readBytes(reader)
if err != nil { if err != nil {
return cli.NewExitError(err, 1) return cli.NewExitError(err, 1)
} }
@ -306,7 +306,7 @@ func restoreDB(ctx *cli.Context) error {
return cli.NewExitError("cancelled", 1) return cli.NewExitError("cancelled", 1)
default: default:
} }
bytes, err := readBlock(reader) bytes, err := readBytes(reader)
if err != nil { if err != nil {
return cli.NewExitError(err, 1) return cli.NewExitError(err, 1)
} }
@ -342,8 +342,8 @@ func restoreDB(ctx *cli.Context) error {
return nil return nil
} }
// readBlock performs reading of block size and then bytes with the length equal to that size. // readBytes performs reading of block size and then bytes with the length equal to that size.
func readBlock(reader *io.BinReader) ([]byte, error) { func readBytes(reader *io.BinReader) ([]byte, error) {
var size = reader.ReadU32LE() var size = reader.ReadU32LE()
bytes := make([]byte, size) bytes := make([]byte, size)
reader.ReadBytes(bytes) reader.ReadBytes(bytes)