-
Notifications
You must be signed in to change notification settings - Fork 140
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
[Feature] new history backend 'rqlite' implmentation #791
Conversation
Thanks for trying to make reedline & nushell better. I'm guessing this won't move forward because it's kind of what atuin already does and atuin supports nushell. It's interesting but I'm not sure other team members will want to add this. We can wait and see if they respond. We typically recommend that people join our Discord and discuss changes like this before implementing them in order to save them time. |
Thanks for fast reply, I have tried atuin before, I thinks is has few issues below:
However, I also knew this solution has some defect:
Anyway, I like this implementation, if have someone want to try it, I believe they can learn many things from this. (e.g. raft protocol) |
I'll also add that it's generally not a good idea to run raft over the public internet anyway, because it is somewhat latency sensitive and is fully consistent rather than available, so you'll struggle to use it if you or some of your other machines lose network access. Raft is really meant for use within a local intranet, especially a single cluster of datacenters, to provide redundancy on that scale. It's not really intended for you to link up all of your machines across the web, even if you were to do it well (perhaps doing Wireguard peer-to-peer) A centrally hosted service where you keep a local copy of your history data and it gets synchronized (like how git works) is much better for that reason If atuin is not tightly integrated enough, we should try to provide ways for it to do so with the plugin API |
I agree at this point, but is not necessaily to run raft over public internet, We can just expose http api and config some password for it (VPN also a option for me). However, I thinks i can setup some experimental server, use traffic controll incressing latency and observe this PR is it work well. |
I was wrong, I just make a quick try, even latency distribute in 140ms ~ 170ms on 6 nodes rqlite network, entering command also consuming 500ms at least, fatally is it occurred on every command executing. |
I don't think we're ready to accept this. Thanks for all the effort. |
Hello theres.
This PR make Reedline and Nushell can storage command history into Rqlite, a distributed SQLite database. details here.
The new
RqliteBackedHistory
can connect to an Rqlite instance and storage history entries like sqlite.Support for nushell will be another PR, commits on vcup/nushell#feat/rqlite.
Motivation / Benefits
I have multiple machines and some "shell snippet" can exec across them. Using Rqlite can sync command history across multiple machines. Heres some tricks to make history commands completion more handy by adding a tag before command like this
Syncing history across multiple machines can greatly enhance this trick.
Also:
Search all history whenever they are typed on which machines. also enhanced the trick: leaving tags after commands makes them easier to search.
When Nushell's history
file_format
is"sqlite"
, it stores "hostname" into database. maybe we can use it to get nushell more intelligent? idk, but if we already save it, then synching history over multiple machines is natural.I have tried use some file synching application to sync my history files. However, if I open multiple instance of Nushell in difference machine at same time, syncing will conflict because sqlite's auxiliary files(they also host-specific). Not syncing them is not a option because network will randomlly lags.
Thanks for considering this PR. Please let me know what you think.