Skip to content
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

Revert change to Reassembler.Push from #116 #122

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Reduce allocations when converting bytes to strings for received messages. [#116](https://github.com/elastic/go-libaudit/pull/116)
- Reduce allocations when converting bytes to strings for received messages. [#116](https://github.com/elastic/go-libaudit/pull/116) [#120](https://github.com/elastic/go-libaudit/pull/122)
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved

### Removed

Expand Down
9 changes: 4 additions & 5 deletions reassembler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"time"

"github.com/elastic/go-libaudit/v2/auparse"
"github.com/elastic/go-libaudit/v2/internal"
)

var errReassemblerClosed = errors.New("reassembler closed")
Expand Down Expand Up @@ -94,12 +93,12 @@ func (r *Reassembler) PushMessage(msg *auparse.AuditMessage) {
r.callback(evicted, lost)
}

// Push pushes a new audit message into the Reassembler. This is a convenence
// Push pushes a new audit message into the Reassembler. This is a convenience
// function that handles calling auparse.Parse() to extract the message's
// timestamp and sequence number. If parsing fails then an error will be
// returned. See PushMessage.
// timestamp and sequence number. It copies the rawData contents. If parsing
// fails then an error will be returned. See PushMessage.
func (r *Reassembler) Push(typ auparse.AuditMessageType, rawData []byte) error {
msg, err := auparse.Parse(typ, internal.UnsafeByteSlice2String(rawData))
msg, err := auparse.Parse(typ, string(rawData))
if err != nil {
return err
}
Expand Down