Skip to content

Conversation

@jeqo
Copy link
Contributor

@jeqo jeqo commented Sep 23, 2024

Pass directly the file input stream to the storage layer instead of calculating chunks on the fly. Optimizes for the default configuration (no encryption/compression), and prepares for further passing the path to the storage layer if uploading directly from file is preferred.

It contains a couple of meaningful refactoring to clean up RSM logic and simplify chunking. See commits for further details.

 RSM upload steps are messy and hard to read, mainly because of the encryption metadata.
 By moving the instantiation to the data key and aad, we can separate the upload stages a bit better.
  Chunking is defined by original chunk size, not original content size.
  This commit removed the scenario where these two sizes are conflated (e.g. passing original size zero to disable chunking, etc.).
@jeqo jeqo force-pushed the jeqo/upload-log-from-file branch from 06fff4d to 325b9d1 Compare September 23, 2024 12:35
When producing an input stream, if no transformation is applied, then an input stream from the source file can be provided.
This will further be used to pass the path directly to the storage backend in a further PR.
@jeqo jeqo force-pushed the jeqo/upload-log-from-file branch from 325b9d1 to 04dbb86 Compare September 23, 2024 12:39
@jeqo jeqo marked this pull request as ready for review September 23, 2024 12:51
@jeqo jeqo requested a review from a team as a code owner September 23, 2024 12:51
"encryption.enabled", Boolean.toString(encryption)
));
final SegmentEncryptionMetadataV1 encryptionMetadata;
final DataKeyAndAAD maybeEncryptionKey;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using an Optional instead of setting maybeEncryptionKey to null ?
Then when using maybeEncryptionKey you don't need to check again if encryptionEnabled, but if the value is present in the Optional then it means that encryption is enabled and you will use that encryption key. Probably it does not reduce the code but I find it more easy to reason about explicit nulls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree; though the main issue is that it would force the functions to take Optional as input parameters which is not recommended; see related discussion: #531 (comment)

I guess a context object that brings these values together could simplify this; but would leave that for another PR.

@jeqo jeqo requested a review from giuseppelillo September 25, 2024 13:56
@giuseppelillo giuseppelillo merged commit 87ea1a5 into main Oct 1, 2024
9 checks passed
@giuseppelillo giuseppelillo deleted the jeqo/upload-log-from-file branch October 1, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants