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

Refactor FileSinkBuilder #785

Merged
merged 2 commits into from
Apr 10, 2024
Merged

Refactor FileSinkBuilder #785

merged 2 commits into from
Apr 10, 2024

Conversation

michaeldjeffrey
Copy link
Contributor

FileSink.file_upload was added as an alternative FileSink.deposits.

They behave in a mutually exclusive manner, and no production code was constructing a FileSink without providing a FileUpload. (There was one test that made a FileSink without a destination channel).

This PR removes the ability to use FileSinkBuilder.deposits and the corresponding FileSink.deposits;
and requires a FileUpload when constructing a FileSinkBuilder.

…equired

File sinks were not made anywhere without providing a file_upload.
A file_upload must be provided to construct a sink.

Removes the old idea of a deposit that was dormant in the code.
Removes needing to manage to potentially two sinks that were mutually
exclusive in implementation.
Copy link
Contributor

@andymck andymck left a comment

Choose a reason for hiding this comment

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

One thing to consider here, some non oracle applications may be using the old deposits. I guess things will break should they update to latest filestore and force a refactor

@michaeldjeffrey
Copy link
Contributor Author

One thing to consider here, some non oracle applications may be using the old deposits. I guess things will break should they update to latest filestore and force a refactor

Great point, here's something for the release notes.


file_sink::FileSinkBuilder API breaking change

  • The method signature for FileSinkBuilder::new has been updated to include file_upload.
  let (sink, mut sink_server) = file_sink::FileSinkBuilder::new(
      FileType::MapperMsg,
      store_base_path,
+     file_upload.clone(),
      concat!(env!("CARGO_PKG_NAME"), "_mapper_msg"),
      shutdown_listener.clone(),
  )
- .file_upload(Some(file_upload.clone()))
  .roll_time(Duration::minutes(SINK_ROLL_MINS))
  .create()
  .await?;
  • FileSinkBuilder::deposits method has been removed.
  let (sink, mut sink_server) = file_sink::FileSinkBuilder::new(
      FileType::MapperMsg,
      store_base_path,
+     file_upload::FileUpload { sender: file_upload_tx.clone()) },
      concat!(env!("CARGO_PKG_NAME"), "_mapper_msg"),
      shutdown_listener.clone(),
  )
-  .deposits(Some(file_upload_tx.clone()))
  .roll_time(Duration::minutes(SINK_ROLL_MINS))
  .create()
  .await?;

@michaeldjeffrey michaeldjeffrey merged commit d8eb7c4 into main Apr 10, 2024
1 check passed
@michaeldjeffrey michaeldjeffrey deleted the mj/file-upload-option branch April 10, 2024 17: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.

4 participants