use size_t for all ringbuf related indexing