[CAS] Add ObjectStore::getStandaloneMemoryBuffer() (#215360)
getMemoryBuffer() is documented as returning a buffer "whose lifetime is
independent of the CAS (it can live longer)", but it is implemented with
MemoryBuffer::getMemBuffer() over whatever getData() returns. For an
on-disk CAS that is a pointer into the store's own mapping, so the buffer
dies with the store. Fix the comment to say what it does, and add
getStandaloneMemoryBuffer() for callers that need the documented
behavior.
The default implementation copies, which always satisfies the lifetime
requirement, so ObjectStore implementations are correct without changes.
An implementation that can hand out storage outliving itself overrides
getStandaloneMemoryBufferImpl() to avoid the copy.
OnDiskGraphDB does that for objects big enough to have a file of their own,
reading that file again rather than sharing the mapping it already has, so
the result stays valid even once the CAS directory is pruned and its pages
can be shared and reclaimed rather than charged to the process. Everything
else is copied, including the case where a null terminator is required but
the file has no byte to spare for it.
A plugin CAS gets the same ability through two new optional functions,
llcas_loaded_object_get_standalone_data() and its counterpart
llcas_standalone_data_dispose().