Closed DXist closed 1 year ago
We need the ownership of the buffer. A reference is not enough, except a static reference. If you insist using a short lifetime, you can implement it yourself.
We can own buffer, allocated from not 'static arena allocator, like
let io_page_aligned_arena_alloc = ...;
let buf = Vec::with_capacity_in(IO_PAGE_SIZE * 4, &io_page_aligned_arena_alloc);
That needs nightly feature. Open a PR if you would like.
'static lifetime bound for IOBuf is too restrictive and doesn't play nicely with buffers allocated from an arena allocator.
Is it possible to relax it to driver's lifetime? The expectation is that buffer pool lifetime is larger than driver's lifetime.