-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implementing general-purpose file list handler #785
Conversation
I have encountered an issue in the implementation, where accessing the stream returns a |
So in MatrixAI/Polykey-CLI#245, there's nowhere that the spec specifies the possibility of a getting file contents. However this PR appears to create a raw stream that can also stream file contents. I think file content streaming (if you really want to do a sort of archive streaming), should really be a different RPC call. The Basically that means this should work using a server streaming call, not a raw stream. You can rename the raw stream handler to some other thing like I don't think it's always the right thing to have a single flexible god function that can do anything, instead having named functions that do specific things is often much clearer especially between program interfaces. |
The way I designed this was in two parts. First the But you're right, this could be split into two stages.
The problem with this is we can run into race conditions across the multiple RPC streams since the locks would only apply to each stream separately. To solve this we'd need a RPC call for getting the lock of one or more vaults and allows us to use that lock for the follow up RPC calls. This lock can be held for the duration of the RPC call and any follow up RPC calls. It will need to handle timeouts for a call holding the lock for too long for whatever reason. I was thinking this was needed for some of the more complex unix commands such as This leaves us with a few small changes to how I wrote the utilities.
|
I'm not sure how to do these tasks. We will need to have a discussion to help me with understanding and implementing this. |
In The only changes I made was to replace the
|
You also have to keep in mind how the RPC may be used by third party client sdks in the future. So maintaining a simple IPC interface helps adoption. This is why I prefer having both complex RPC and simple RPC options being compostable. |
For 1. Right now the for 2. Ignore that for now. Things will work without it, we just run into locking and race condition issues without it. I'll write up a new issue for it but we can proceed without it for now. |
I know what's wrong with it but it's a good object lesson in debugging problems so I'll let you work this one out. I can tell you that.
|
I made a new issue for tracking the vault locking RPC call at #786 |
The specification of the file content streaming RPC call (which I have named After changing the Most importantly, what is the use-case of this RPC handler? Is it to implement something like UNIX's I would need clarification on all these points before I can begin implementation of the raw handler RPC call. |
Some of these function names seem really generic. |
This new handler will indeed be for other UNIX commands and is not relevant for the After having a chat with @tegefaulkes, I was able to better understand the requirements of this RPC and how to achieve it. The Same thing in the On that note, the |
ca89c94
to
f1eac5e
Compare
As per our discussion, I have removed all the extra features we didn't need, and trimmed it to the bare minimum an I am working on more advanced features like parity with GNU's |
8e881e7
to
ef9032e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small things need changing.
cb67eda
to
4944b1c
Compare
wip: working on adding unix-like ls for secrets chore: added custom type and pattern matching chore: updated caller for VaultsSecretsList wip: working on passing filetree via rpc feat: revamped the entire VaultsSecretsList handler chore: updated handler name chore: working on fixing read: 0 error chore: renamed VaultsSecretsList to VaultsSecretsGetFileTree fix: fixed problem with `withVaultsG` where `this` wasn't defined [ci skip] chore: switched from RawHandler to ServerCaller chore: cleaned up code and started work on param parser feat: added parsers for parameters [ci skip] chore: updated all tests referencing old serializerStreamFactory feat: switched over the rpc handler from rawhandler to stremhandler feat: stopped using globWalk for reading and listing files chore: added error handling for invalid patterns chore: added error handling for invalid patterns chore: added symbolic link information to the file stats chore: cleaned up irrelevant code chore: fixed tests chore: updated types chore: added comments for stream ending prematurely bug: working out why errors arent being caught by expect chore: updated tests and added new kinds of errors chore: added complement for 'ErrorSecretsIsDirectory'
4944b1c
to
4b99748
Compare
Everything looks good. Merging. |
Description
Currently, Polykey can only return a list of secrets within a vault. This PR aims to implement an RPC handler which creates a general-purpose function able to output data similar to the UNIX command
ls
.Issues Fixed
secrets ls
command Polykey-CLI#245secrets ls
command Polykey-CLI#255Tasks
ls
list
command for secretsls
handler4. Write handler for streaming file contentswill be completed incat
command5. Write tests for file streaming (will be completed incat
) handlercat
commandFinal checklist