-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to update a existing item in a binn obj? #9
Comments
Hi Matt! Unfortunately the current code does not support updating values inside a binn. The library is focused on creating serialized data. Do you plan to save the binn data? Where? Or do you plan to send over some connection? Or just keep the values on memory? |
Hi Bernardo,
I am currently using it to log failure events to my flash file system
and dump at a later time. It works wonderful for that. I was just
hoping to extend it to being able to save and restore my runtime data -
something like you would do in a video game with save and restore. The
project I am on is on a pretty tight schedule, so I am not sure I have
time to update binn to do what I need - and risk causing problems. Oh,
yeah if binn allowed updating then what I would do is keep updating the
live - binn created data object on the heap to reflect the runtime state
and then every so often write the state data out to the file system - or
if i get a indication that power is going away I would dump it out also
so it could be restored next power up or after a watchdog reset.
To work around binn not supporting updating - I was thinking of creating
a working database that is a reflection of what binn would want - an
array of structures that mirror what binn needs, key, data, and type.
On startup restore would pull from a binn object and then fill in found
entries in the working database. When the state needs to be saved - I
would just write the working database out to a bin object to the file
system. Updates would be done on the working - mirror like binn data
base - which would get me what I need without modifying binn.
In the past saving and restoring state has been a hardcoded type of
affair on embedded systems - based on compile time structures. I liked
how binn works, and it seemed the next step to try to use it for saving
and restoring the embedded system runtime data to a single binn object
and to a single file system file.
Thank you for getting back to me so fast ;)
Matt
…On 2017-04-27 17:29, Bernardo Ramos wrote:
Hi Matt!
Unfortunately the current code does not support updating values inside
a binn.
The library is focused on creating serialized data.
Do you plan to save the binn data? Where? Or do you plan to send over
some connection? Or just keep the values on memory?
--
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub [1], or mute the
thread [2].
*
Links:
------
[1] #9 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AYtVHEMEBJGq3rOsdB62CLxHUOvNqdtEks5r0TLygaJpZM4NKxsF
|
I agree. Modifying binn will not be so easy, mainly when we have a container inside another, ie, when we want to update an object that is inside a list (or the opposite). In your case it would be better to load the data to some structure on memory and modify it when needed. At the time to save the data it can be serialized again and saved to the file. For objects you can use a hash table (check uthash). If I had enough time I could implement something on top of binn. |
Oh, your idea of using an array of structures is good. You can also take a look at SQLite, if it fits on your device. |
Ok great I'll take a look. Thank you very much for getting back to me I very much appreciate it ;) |
Hello binn developers ;)
I am really liking the work you have done on this project. I have been using your binn for logging purposes. I now would like to use it to keep track of, update, and record system variables used in my project. The issue I have hit upon is that I would like to update items that already exist in a binn object. Replace a binn value within a object with a new value, or free the value within the object that has the same key I am using and drop the new one into the object. Is this possible with the current state of binn - it didn't look like it is from looking at the source but I could be wrong? Has anyone else developed an addition of this nature to binn that I could use? Or should I look into doing this myself?
Thank you,
Matt
The text was updated successfully, but these errors were encountered: