Refactor 1: Achieve deadlock-free lock ordering by subclassing BlockGenerator and taking receiver lock first in BlockGenerator.updateCurrentBuffer

- Subclassed BlockGenerator to make sure that the receiver lock is taken first before taking the block generator lock. So both threads (data insertion thread, and block generation thread) take locks in the same order. 
- Changed offset check to distinguish between offset not existing and offset being 0
- Added a lot of docs on the callback's semantics
- Increased timeouts