-
Notifications
You must be signed in to change notification settings - Fork 22
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
Changes I made for the http-api-gateway component #290
Conversation
...and add a load-from-address for the old functionality
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.
I think this all looks good!
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.
This looks fine to me, but I do have a minor suggestion that you can take or leave as you see fit.
src/fluree/db/json_ld/api.cljc
Outdated
(let [address (<! (alias->address conn ledger-alias)) | ||
_ (log/debug "Attempting to load ledger from" address) | ||
attempt (<! (jld-ledger/load conn address))] | ||
(when-not (util/exception? attempt) |
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.
Minor nitpick, but there could be an exception here from a different error other than the ledger not existing. In that case the issue would be swallowed and the user would assume the ledger doesn't exist when it does but it just has another problem.
I don't think it's a big deal for now, but maybe we could look for a specific exception to ignore, and pass everything else through.
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.
True, true. I'll investigate. And/or eliminate this fn entirely. :)
src/fluree/db/json_ld/api.cljc
Outdated
(log/debug "Loading ledger from" address) | ||
(<! (jld-ledger/load conn address)))))) | ||
|
||
(defn load-if-exists |
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.
Are all these load
* functions meant to be part of the public api? It's not clear to me when I would use load
vs load-if-exists
.
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.
I think we should just decide if we're going to swallow exceptions here or not and just do one.
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.
Yeah, there's definitely room for improvement here. Basically I needed a way to implement idempotent create
. This was my "simplest possible thing that could possibly work" but I'd be happy to push it a little further in the direction of the ideal.
...and supporting protocol stuff, tests, etc.
Sounds good! Although as it relates to API and JS compatibility the |
I was going to export it as |
We only did the Since we ditched backwards compatibility, all of the We should probably have a ticket opened for that and get it into alpha 1 so we don't break API after release. |
Ah, sure. In that case it would just be named |
Created a ticket here: #293 |
These are the changes I made to the API for the http-api-gateway component (rename coming shortly): https://github.com/fluree/http-api-server
Happy to change anything in here, just let me know.
Part of #267