-
Notifications
You must be signed in to change notification settings - Fork 8
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
Get object #82
Get object #82
Conversation
@@ -16,9 +16,7 @@ defmodule Jetstream.API.Object do | |||
name: stream_name(bucket_name), | |||
subjects: stream_subjects(bucket_name), | |||
description: Keyword.get(params, :description), | |||
max_msgs_per_subject: Keyword.get(params, :history, 1), |
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.
After writing my test for storing and retrieving a large file, I couldn't get the test to pass. I was troubleshooting with the nats
CLI tool and realized that when I used the CLI to add a file to my test bucket it also couldn't download the file. Eventually I realized it's because I was creating the bucket with the wrong parameters.
end | ||
end | ||
|
||
def info(conn, bucket_name, object_name) do |
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 didn't change this function in this PR, just moved it up to alphabetize
@@ -90,7 +95,7 @@ defmodule Jetstream.API.Object do | |||
nuid: nuid, | |||
size: size, | |||
chunks: chunks, | |||
digest: "SHA-256=#{Base.encode64(digest)}" | |||
digest: "SHA-256=#{Base.url_encode64(digest)}" |
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.
The ADR-20 just specific Base64
encoding, but I ran into some cases where the nats CLI was complaining about invalid base64 data. But when I checked in the go client it was actually doing URL-safe base64 encoding https://github.com/nats-io/nats.go/blob/97ccbd884fa75a3a5e86bef0ee4c9374dc0dd2b5/object.go#L317-L319
Add support for retrieving a file from the object store. While working on this I came across a few surprising problems (see inline comments for those interested)