Phew... that would be an interesting task for a PLC...
One big problem that I see, is that BTrees generally rely heavily on pointers and dynamic allocations. That can be rough on a PLC, but could be gotten around perhaps just by allocating some huge data tables to begin with.
Second problem would still be traversal, you will have to deal with non-contiguous iterators... Possible, maybe.
I'd offer that if you really want to try this, your best bet is to do the programming in structured text, but even so.... the potential for errors would be huge.
If you really really really want to do this integral to the PLC, I'd suggest getting one of the Prosoft Module's, and programming the app within that, and use the CIP Backplane interface to send data to the module, query it back, etc.