deven96 / ahnlich

Suite of tools containing an in-memory vector datastore and AI proxy
MIT License
74 stars 4 forks source link

Fallible collections #100

Open deven96 opened 2 months ago

deven96 commented 2 months ago

Vectors, Hashmaps, e.t.c all implicitly fail whenever allocations fail. We are already capping the global allocations using cap, fallible collections would then ensure we don't panic but rather surface the allocation errors

deven96 commented 2 months ago

It wouldn't be practical or possible to make every datastructure we use fallible, so how about we wrap critical client parts in an std::panic::catch_unwind to ensure that if we ever do massive allocations, we are able to report errors from there back to the client