go-car icon indicating copy to clipboard operation
go-car copied to clipboard

CAR walk: decouple logic between getting the links and processing them

Open schomatis opened this issue 4 years ago • 0 comments

https://github.com/ipld/go-car/blob/a4380ef67a191a4e50a89a3e5dabb715cb798027/car.go#L58-L61

The dag.Walk() function receives a GetLinks callback to fetch the children of the parent node r. We overload that function with the processing itself of the node (in this case writing it to the file with (*carWriter).enumGetLinks). Although the visit callback in the same dag.Walk is also undocumented it seems a more appropriate place for that logic.

schomatis avatar Feb 03 '21 00:02 schomatis