Hello, now when you try to load the database from the disk, the code borrows structures from HnswIo. It produces a very uncomfortable use condition, either requiring a singleton or, as I recently did - a thread or async with a loop, so the borrow checker can ensure the correctness. Both variants are very constraining.
I propose changing this behavior to "move" behavior when Hnsw consumes HnswIo rather than borrows its properties. As a result, its use will be significantly simplified. However, I still do not understand the role of this borrowing design because, from my perspective, HnswIo is just a loader, not a holder of loaded data.
If particular data must be used by the Hnsw index, it needs to be moved there. We can use various approaches like:
enum Data {
DataWithoutSideEffect(bla),
DataWithSideEffect(blabla)
}
Hello, now when you try to load the database from the disk, the code borrows structures from HnswIo. It produces a very uncomfortable use condition, either requiring a singleton or, as I recently did - a thread or async with a loop, so the borrow checker can ensure the correctness. Both variants are very constraining.
I propose changing this behavior to "move" behavior when Hnsw consumes HnswIo rather than borrows its properties. As a result, its use will be significantly simplified. However, I still do not understand the role of this
borrowingdesign because, from my perspective, HnswIo is just a loader, not a holder of loaded data.If particular data must be used by the Hnsw index, it needs to be moved there. We can use various approaches like: