-
Notifications
You must be signed in to change notification settings - Fork 128
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
optimizations/refactoring #299
optimizations/refactoring #299
Conversation
…ing to octal escaped format
use trace options from config correct client_id logging unify proxy interfaces use factories extend decryptor
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.
Really deep refactoring :-) Great!
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.
Great job!
It's very useful to have unified API of decryptors and Proxy.
@@ -143,9 +143,15 @@ func (ex *WriteToFileExecutor) Execute(data []byte) { | |||
|
|||
// Close file | |||
func (ex *WriteToFileExecutor) Close() { |
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 *host != cmd.DEFAULT_ACRA_HOST || *port != cmd.DEFAULT_ACRASERVER_PORT { | ||
*acraConnectionString = network.BuildConnectionString("tcp", *host, *port, "") | ||
config.SetAcraConnectionString(network.BuildConnectionString("tcp", *host, *port, "")) |
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.
👍
cmd/acra-server/acra-server.go
Outdated
poisonCallbacks.AddCallback(base.NewExecuteScriptCallback(*scriptOnPoison)) | ||
config.scriptOnPoison = *scriptOnPoison | ||
} | ||
// must be last |
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.
"must be last" in terms of setting poison callbacks?
maybe it makes sense to change to "should setup "stopOnPoison" as last poison record callback"
decryptor/base/dataProcessor.go
Outdated
} | ||
|
||
// WithZoneID replace ZoneID and return itself | ||
func (ctx *DataProcessorContext) WithZoneID(id []byte) *DataProcessorContext { |
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 would expect that ctx.WithZoneID()
will return new copy of itself with selected ZoneID. Maybe it's only me, but maybe it makes sense to rename method to SetZoneID
/ UpdateZoneID
? To make clear that it returns the same context, just ZoneID updated.
decryptor/base/dataProcessor.go
Outdated
} | ||
|
||
// WithContext replace context and return itself | ||
func (ctx *DataProcessorContext) WithContext(newContext context.Context) *DataProcessorContext { |
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.
same as above
@@ -128,7 +128,7 @@ func (packet *MysqlPacket) replaceQuery(newQuery string) { | |||
|
|||
// readPacket read header to struct and return payload as return result or error | |||
func (packet *MysqlPacket) readPacket(connection net.Conn) ([]byte, error) { | |||
if _, err := connection.Read(packet.header); err != nil { | |||
if _, err := io.ReadFull(connection, packet.header); err != nil { |
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.
what is the difference?
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.
helper read more than once (if first read call was not full and return only part of data cached in os buffer). until some error or until no data was returned. ReadFull read in loop until read expected num of bytes. I meet one failed test when here read return part of packet and without error
) | ||
|
||
var lock = sync.RWMutex{} |
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.
bye-bye mutex 😢
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.
it wasn't used)
Co-Authored-By: Lagovas <[email protected]>
Co-Authored-By: Lagovas <[email protected]>
Co-Authored-By: Lagovas <[email protected]>
…vas/acra into lagovas/open-source-version
As I remember, I didn't change any public CLI or API interfaces that should be changed in documentation. And didn't change any behavior of server. Touched only some log messages (uppercase or change level from DEBUG to INFO)