-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support encoding in parallel and partial flush - WIP #1
base: main
Are you sure you want to change the base?
Conversation
Posrabi
commented
Apr 26, 2022
- Add SetFirst, SetArray to allow using multiple stream encoder at once.
- Flush the buf when its contents reach 64 kB ( needs more testing to find the most suitable number).
- Do not enclose the array if the array field is set to false.
return sw | ||
} | ||
|
||
func (sw *StreamEncoder) SetArray(array bool) *StreamEncoder { |
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 can be in the constructor rather than here, right?
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.
Hmm, yeah
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.
Actually I don't think so, I am doing this so I could override the default encoder settings here.
https://github.com/multiprocessio/datastation/blob/9de174a0a88d5623bfedf74601cd13a67c1e6f90/runner/file.go#L34
@@ -32,8 +32,20 @@ func NewGenericStreamEncoder(w io.Writer, marshalFn Marshaler, array bool) *Stre | |||
} | |||
} | |||
|
|||
func (sw *StreamEncoder) SetFirst(first bool) *StreamEncoder { | |||
sw.first = first |
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 needs to be surrounded with a mutex if this is modified by EncodeRow
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'm only using it on initializing.