-
Notifications
You must be signed in to change notification settings - Fork 159
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
feat(iroh): add more rpc methods #1962
Conversation
Allows to efficiently read parts of a blob via RPC
Cool I thought to add this quite a while ago already. Is there a reason to keep both |
iroh/src/client.rs
Outdated
DownloadProgress, ListTagsRequest, ListTagsResponse, NodeConnectionInfoRequest, | ||
NodeConnectionInfoResponse, NodeConnectionsRequest, NodeShutdownRequest, NodeStatsRequest, | ||
NodeStatusRequest, NodeStatusResponse, ProviderService, SetTagOption, ShareMode, WrapOption, | ||
BlobListRequest, BlobListResponse, BlobReadAtRequest, BlobReadAtResponse, BlobReadRequest, |
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 import section seems to indicate that wildcard imports aren't that bad after all....
iroh/src/node.rs
Outdated
(1, len) | ||
} else { | ||
( | ||
(len as f64 / max_chunk_size as f64).ceil() as usize, |
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.
weird to use f64 here... It is shorter than the integer variant, but will fail if len or max_chunk_size is > 2^53.
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.
how would I round up otherwise?
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.
len / max_chunk_size + if len % max_chunk_size == 0 { 0 } else { 1 }
or
len / max_chunk_size + (len % max_chunk_size !=0) as usize
or something. With a bit of luck the optimizer will do only 1 integer division for both division and rest.
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.
Note that I don't worry about speed here. It's just weird to use fp for integer ops, and it will fail in weird ways as soon as you exceed the range of integers that can be losslessly represented in a fp num.
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.
ah yes, that is of course nice
allows fetching a collection via rpc
02f04d9
to
c3abd8f
Compare
done |
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.
avoid the floats!
- add `blobs.read_at`: Allows to efficiently read parts of a blob via RPC - add `blobs.get_collection`: read a collection
blobs.read_at
: Allows to efficiently read parts of a blob via RPCblobs.get_collection
: read a collection