Skip to content

Commit

Permalink
[WIP] remove store blocks (temporarily)
Browse files Browse the repository at this point in the history
  • Loading branch information
agebhar1 committed Feb 10, 2024
1 parent 5eeaf73 commit c26e2ba
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions cmd/chunks-inspect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ var timezone = time.UTC
func main() {
blocks := flag.Bool("b", false, "print block details")
lines := flag.Bool("l", false, "print log lines")
storeBlocks := flag.Bool("s", false, "store blocks, using input filename, and appending block index to it")
flag.Parse()

for _, f := range flag.Args() {
printFile(f, *blocks, *lines, *storeBlocks)
printFile(f, *blocks, *lines)
}
}

func printFile(filename string, blockDetails, printLines, storeBlocks bool) {
func printFile(filename string, blockDetails, printLines bool) {
f, err := os.Open(filename)
if err != nil {
log.Printf("%s: %v", filename, err)
Expand Down Expand Up @@ -95,19 +94,5 @@ func printFile(filename string, blockDetails, printLines, storeBlocks bool) {
}
}
}

//if storeBlocks {
// writeBlockToFile(b.rawData, ix, fmt.Sprintf("%s.block.%d", filename, ix))
// writeBlockToFile(b.originalData, ix, fmt.Sprintf("%s.original.%d", filename, ix))
//}
}
}

func writeBlockToFile(data []byte, blockIndex int, filename string) {
err := os.WriteFile(filename, data, 0644)
if err != nil {
log.Println("Failed to store block", blockIndex, "to file", filename, "due to error:", err)
} else {
log.Println("Stored block", blockIndex, "to file", filename)
}
}

0 comments on commit c26e2ba

Please sign in to comment.