Open josephmturner opened 10 months ago
With the current design, how would we handle these two scenarios:
drive.batch()
Since the Batch
class isn't serializable, the client can't call batch.flush()
.
drive.compare(entryA, entryB)
Since entries aren't serializable, the client can't call drive.compare()
.
Another consideration is that a custom API designed around the hyperdrive.el
frontend could save on roundtrip requests to the server. For example, if the frontend wants to get the contents of all hyperdrive files inside a directory, then we could design an RPC method that would accept a public key and a directory path and then return all of those file contents in a single response.
IIUC with the current design, we'd need to first run drive.list({ recursive: true })
to get the list of filepaths, then we'd need to call drive.get()
on each filepath.
I'd like to get your feedback on an alternative way to design the rpc server. With the current design, (1) client sends pseudo-JS string in the RPC request, (2) server validates it against
methods.json
, then (3) server evaluates the request string and sends back the result.Currently, rpc methods look like
"sdk.getDrive(url,driveOpts).checkout(checkout).list(folder,listOpts)"
.Alternatively, we could make the rpc server expose a custom API for Hyperdrive and Hyperbee. This way, we could expose a simpler rpc method (like
"driveList"
) to do the same thing as above, which would accept the same arguments as the pseudo-JS method:Then, in
index.js
, we'd have a bunch of methods to handle each custom API method:Here are pros of this new method (custom API):
"driveList"
versus"sdk.getDrive(url,driveOpts).checkout(checkout).list(folder,listOpts)"
)drive.list()
)methods.json
Cons:
hyper-sdk-rpc
code (as opposed to one parser which handles all methods and properties)What do you think?