Skip to content

Conversation

@lauzadis
Copy link
Member

@lauzadis lauzadis commented Dec 2, 2022

Change usage of CrcSource/CrcSink to HashingSource and HashingSink.

Issue #

Description of changes

This change is required to use the HashingSource and HashingSink implemented in the smithy-kotlin pair PR: smithy-lang/smithy-kotlin#756

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

github-actions bot commented Dec 5, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

github-actions bot commented Dec 6, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@lauzadis lauzadis marked this pull request as ready for review December 9, 2022 15:12
@lauzadis lauzadis requested a review from a team as a code owner December 9, 2022 15:12
@lauzadis
Copy link
Member Author

lauzadis commented Dec 9, 2022

The failing e2e test is unrelated to this change, and I'm working on fixing it in a separate PR.

Copy link
Contributor

@aajtodd aajtodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's get e2e tests and service check batch tests working before merging though. (In particular e2e tests as it covers two different event stream services/operations)

private fun emptyByteArray(): ByteArray = ByteArray(0)

// Convert a big-endian ByteArray to an Int
private fun ByteArray.toInt(): Int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: you could make this internal and share it with your unit tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the .toInt() conversion entirely, now just writing the raw bytes out using write() instead of writeInt()

Comment on lines 3 to 4
"type": "feature",
"description": "Add usages of HashingSource and HashingSink"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: This isn't a great changelog description of the change. Is there a meaningful difference here like performance improvements? If not, this may be something that doesn't deserve a changelog entry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, since it's a small change and not really customer-facing (no performance improvements / other effects expected), I will exclude the changelog

Comment on lines 130 to 132
dest.writeInt(sink.crc.toInt())
dest.writeInt(sink.digest().toInt())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why writeInt with a toInt conversion? Why not write which takes a byte array?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tip, this will work and make it simpler. I was converting the big endian ByteArray to an integer when I could just write the bytes out directly

@lauzadis lauzadis added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Dec 9, 2022
@github-actions
Copy link

github-actions bot commented Dec 9, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@github-actions
Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

@lauzadis lauzadis merged commit 2e22b7b into main Dec 12, 2022
@lauzadis lauzadis deleted the feat-hashing-io branch March 3, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants