add chunk accounting functionality

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
test: cover chunk accoounting functionality

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>