-
Notifications
You must be signed in to change notification settings - Fork 14
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
Streaming hoard #84
Streaming hoard #84
Conversation
Signed-off-by: Silas Davis <silas@monax.io>
e4d75b0
to
40282c5
Compare
52a8d8f
to
87a97b9
Compare
- Remove use of oneof - note this should be backwards compatible - Update to version 7 and write changelog - Code cleanup and refactor Signed-off-by: Silas Davis <silas@monax.io>
87a97b9
to
22ce590
Compare
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.
Before tagging we need to do a version bump on all imports and in the go mod file. Without oneof
, I question why we need to enforce message ordering server side. In the case of the salt (which is just another byte slice) why can't we simply append? Otherwise this looks good! Might be worth adding some documentation on using the js lib, but that is low priority.
streaming.go
Outdated
return fmt.Errorf("recevied multiple salts but there can be at most one") | ||
} | ||
if len(accum.Data) > 0 { | ||
return fmt.Errorf("recevied salt after data but salt must come before all data chunks") |
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.
return fmt.Errorf("recevied salt after data but salt must come before all data chunks") | |
return fmt.Errorf("received salt after data but salt must come before all data chunks") |
if chunk == nil { | ||
return nil | ||
} | ||
if len(chunk.Salt) > 0 { |
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.
Why do we need to enforce these constraints on the salt?
document.go
Outdated
@@ -7,12 +7,12 @@ import ( | |||
"fmt" | |||
|
|||
"github.com/gogo/protobuf/proto" | |||
"github.com/monax/hoard/v6/api" |
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 all hoard imports should point to v7 now...
@@ -2,32 +2,28 @@ module github.com/monax/hoard/v6 | |||
|
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 should point to v7.
streaming.go
Outdated
"fmt" | ||
"io" | ||
|
||
"github.com/monax/hoard/v6/api" |
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.
v++
streaming.go
Outdated
|
||
if d.Meta != nil { | ||
if accum.Meta != nil { | ||
return nil, fmt.Errorf("recevied multiple document meta but there can be at most 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.
return nil, fmt.Errorf("recevied multiple document meta but there can be at most one") | |
return nil, fmt.Errorf("received multiple document meta but there can be at most 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.
Why can we only consume 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.
If we add two - which one is the real one?
Or are you consider we allow them to be composited - this seems like an unnecessary complication. Almost by definition we don't expect our metadata to be so large - much better if we can be sure once we have read the metadata we have all of it.
streaming.go
Outdated
return fmt.Errorf("recevied multiple grant specs but there can be at most one") | ||
} | ||
if len(accum.Plaintext.Data) > 0 { | ||
return fmt.Errorf("recevied grant spec after data but spec must come before all data chunks") |
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.
return fmt.Errorf("recevied grant spec after data but spec must come before all data chunks") | |
return fmt.Errorf("received grant spec after data but spec must come before all data chunks") |
streaming_test.go
Outdated
"io" | ||
"testing" | ||
|
||
"github.com/monax/hoard/v6/api" |
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.
v++
The primary reason is that we want to be able to read the beginning of a stream sequentially and get the metadata without reading further in. If we allow out-of-order transmission then either we need to re-order it which is a pain or we loose the ability to take the HEAD of a stream and extract the metadata. We could append on the salt but again we provide flexibility but there is no good reason to split up a salt - it is probably a mistake. Generally having stronger invariants is better than have more arbitrary flexibility if it is not clear what good that does. We basically have some descriptive metadata and some stream. If it wasn't for the way plaintexts are handled I'd be tempted to have a message like:
And include the salt, metadata, grantspec and whatever other stuff you are only meant to say once in there. We could still go this route but I didn't want to make too many changes.
|
Signed-off-by: Silas Davis <silas@monax.io>
b8cdf94
to
dcb4490
Compare
No description provided.