Open ttocsneb opened 8 months ago
I've worked on this for a bit and got to a point where I feel pretty stuck. There are different ways that I could implement features and I don't know how I might want to go about them. I haven't even thought about how partialItems would be written yet.
I took a break from the project for a bit, and I feel ready to get back into it. I think that if I keep working on partialItems, then I will probably build something that will come back to bite me later. Maybe it would be better for me to think about a top-down approach and figure out how we want the library to be used.
I think a top-down approach would be good, however its also important to keep in mind the data formats goals.
I invision it being a low-cost way to store data, with magic abstracted away.
pub const MBON_ENGINE = mbon::MbonEngine::new();
pub static MBON_DEFINITIONS = MBON_ENGINE.de(some_file);
fn main()
{
// -- snip! --
loop {
tcp_connections.iter().map(|conn| {
let data = MBON_ENGINE.de(conn.payload);
let result = process(data);
conn.reply(MBON_ENGINE.ser(result));
});
}
// -- snip! --
}
Obviouslt a super brief example, but you can see how the format is almost entirely transparent to the end user, though I do not know if this would work in practice (as ser/de to structs is very useful, and to just whatever structure may or may not be ideal).
Possibly, we could add methods to all supported types (implementing/deriving etc), so they can call soemthing like .to_mbon()
.
To allow for the engine to do partial reads, PartialItems need to be used. These will be able to read/write to the engine.
I want these items to be an indeterminate form of a full Item. It knows where in the mbon file it is and can make requests to the engine whenever more data is needed. When a partial item is fully read, it can be turned into a Item.