Skip to content
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

Prevent existing IDs from changing when adding new todos #10

Open
kkga opened this issue Nov 14, 2021 · 2 comments
Open

Prevent existing IDs from changing when adding new todos #10

kkga opened this issue Nov 14, 2021 · 2 comments

Comments

@kkga
Copy link
Owner

kkga commented Nov 14, 2021

More details: #9 (comment)

@WhyNotHugo
Copy link
Contributor

I'm thinking of an implementation using gob to serialise the in-memory representation of the todos, along with their id, and save that to a file.

When tdx runs the next time, it'll de-serialise all of them, and only read (1) files that have a modification date later than the dump (2) new files.

This should provide some minor performance improvements while not really increasing complexity, and keep consistent ids.

I can try giving this a shot if this sounds good.

@kkga
Copy link
Owner Author

kkga commented Jan 29, 2022

This sounds great.

I started initial work on persistent IDs using a bolt database a while ago, but I only spent a few hours on it to get familiar with how bolt works: 8a8124c

My idea was to store the representation of vidir in a key-value store with id-filepath entries and then on each consecutive read, tdx will: (1) get the list of entries from the database, (2) walk the vidir path and remove/add any missing and new entries, (3) write the updates to database. This way the IDs will be stored in the database and should not change unless the user decides to rebuild the database by issuing some command. This is probably what todoman does?

I'm not sure of the benefits/downsides between using gob or a database, so feel free to use any approach you're comfortable benefits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants