-
Notifications
You must be signed in to change notification settings - Fork 7
Optimize tuple management #65
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
base: master
Are you sure you want to change the base?
Changes from all commits
121ccc5
fb4103b
03e5493
c47407e
1682218
06a413a
67f48a6
e103aad
2045236
77ec75a
d80e352
b5d99c3
36badbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update Copyright header |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,10 @@ | |
| import io.carbynestack.httpclient.CsHttpClientException; | ||
| import io.vavr.control.Option; | ||
| import io.vavr.control.Try; | ||
|
|
||
| import java.io.ByteArrayInputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
| import lombok.Value; | ||
|
|
@@ -91,19 +95,26 @@ private DefaultCastorIntraVcpClient(Builder builder) { | |
| @Override | ||
| public TupleList downloadTupleShares(UUID requestId, TupleType tupleType, long count) { | ||
| try { | ||
| return csHttpClient | ||
| .getForEntity( | ||
| serviceUri.getIntraVcpRequestTuplesUri(requestId, tupleType, count), | ||
| getHeaders(serviceUri), | ||
| TupleList.class) | ||
| .get(); | ||
| byte[] shares = csHttpClient | ||
| .getForEntity( | ||
| serviceUri.getIntraVcpRequestTuplesUri(requestId, tupleType, count), | ||
| getHeaders(serviceUri), | ||
| byte[].class) | ||
| .get(); | ||
| long length = tupleType.getTupleSize() * count; | ||
| return TupleList.fromStream(tupleType.getTupleCls(), | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As Tuples as mostly consumed within a stream, it may make sense to keep tuples as a stream (potentially still wrapped as a TupleList and lazily converted later if required).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe |
||
| tupleType.getField(), | ||
| new ByteArrayInputStream(shares), | ||
| length); | ||
| } catch (CsHttpClientException chce) { | ||
| throw new CastorClientException( | ||
| String.format( | ||
| FAILED_DOWNLOADING_TUPLES_EXCEPTION_MSG, | ||
| serviceUri.getRestServiceUri(), | ||
| chce.getMessage()), | ||
| chce); | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
unused import?
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.
If not update Copyright Header