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

feat: add logic to store data by native code #130

Merged
merged 28 commits into from
Aug 27, 2023
Merged

feat: add logic to store data by native code #130

merged 28 commits into from
Aug 27, 2023

Conversation

delphinus
Copy link
Member

@delphinus delphinus commented Aug 19, 2023

ref #91

How to use

1. Change setup opts

telescope.setup {
  extensions = {
    frecency = {
      use_sqlite = false,  -- default value is `true`.
    },
  },
}

2. Run migration command

:FrecencyMigrateDB

Then it uses DB without SQLite. You can drop sqlite.lua.

TODO

  • A way to select logic between SQLite and string.dump().
  • Lock and unlock file in accessing DB.
    • This is needed because multi Neovim instances can access DB at the same time. We need a background thread for queuing jobs to save data into DB.
  • Migration script.
    • need auto converting?
  • Load sqlite lazily not to require it in bootstrap.
  • Remove healthcheck for sqlite.lua
  • In load() or save(), it should check the file is not locked and should wait for unlocking when it is locked.
  • Note in README.

Issues I solves later

  • Call save() asynchronously for performance
  • Refresh data in memory when DB has been updated.
    • It can detect DB to be updated by the file's mtime.
    • Poll the file by uv.new_fs_event is better than above.

@delphinus delphinus force-pushed the feat/native branch 3 times, most recently from fadd941 to 4b55ec1 Compare August 19, 2023 22:51
This is needed because candidates from SQLite is sorted by id, but ones
from native is sorted by path.
And disable benchmark tests (fix later)
@delphinus delphinus changed the title feat!: remove dependency for SQLite [highly experimental] feat!: remove dependency for SQLite [experimental] Aug 27, 2023
@delphinus delphinus changed the title feat!: remove dependency for SQLite [experimental] feat: add logic to store data by native code Aug 27, 2023
@delphinus delphinus marked this pull request as ready for review August 27, 2023 09:00
@delphinus delphinus merged commit 9037d69 into master Aug 27, 2023
4 checks passed
@delphinus delphinus deleted the feat/native branch August 27, 2023 09:51
uhooi added a commit to uhooi/dotfiles that referenced this pull request Aug 29, 2023
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

Successfully merging this pull request may close these issues.

1 participant