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

feat: 1487 Chunk Manager Empty Iteration Failure #1528

Closed
wants to merge 11 commits into from

Conversation

JasonPaulGithub
Copy link
Contributor

@JasonPaulGithub JasonPaulGithub commented Mar 28, 2024

Description

A redesign is needed for the chunk_file process to match three types of file.

  1. An empty file: write into the data_map the string EMPTY. On decrypt, we detect this and just create an empty file.
  2. A small file: The whole content of those can be in the data_map. Just in SE lib we write the < MIN_SIZE to the data map.
  3. A qualified file: Same as below (no change)

Fix for Issue : #1487

Manual testing needs to be done for this:

  • Upload Empty File
  • Download Empty File
  • Upload Small File
  • Download Small File
  • Upload Qualified File
  • Download Qualified File

sn_client/src/files.rs Outdated Show resolved Hide resolved
@JasonPaulGithub JasonPaulGithub changed the title feat: todo to layout fix for three types of outcome in regard to file… feat: 1487 Chunk Manager Empty Iteration Failure Apr 1, 2024
sn_client/src/files.rs Fixed Show fixed Hide fixed
@JasonPaulGithub JasonPaulGithub added Enhancement New feature or request Small Pull request is small labels Apr 3, 2024
@JasonPaulGithub JasonPaulGithub force-pushed the cat_file_fix branch 5 times, most recently from 93d95b6 to d50d496 Compare April 4, 2024 12:25
@JasonPaulGithub JasonPaulGithub marked this pull request as ready for review April 4, 2024 12:53
@JasonPaulGithub JasonPaulGithub marked this pull request as draft April 4, 2024 14:00
@JasonPaulGithub JasonPaulGithub marked this pull request as ready for review April 4, 2024 23:43
impl ChunkBySize for EmptyFile {
fn chunk_by_size(self) -> (Chunk, Vec<(XorName, PathBuf)>) {
let bytes: Bytes = Default::default();
let chunk = Chunk::new(bytes);
Copy link
Member

Choose a reason for hiding this comment

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

So I assume this would get an address of 0000..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. Will this cause any issues?

@happybeing
Copy link
Contributor

Probably too late for this PR but if you are working more in this area, is there a chance you can add the file path (not just name as it is now) to the ChunkManager uploaded files tracking? More in this issue #1576

I want to use the ChunkManager and to be able to access the xor address and full path of each uploaded file, not just the filenames.

@JasonPaulGithub
Copy link
Contributor Author

JasonPaulGithub commented Apr 6, 2024

Hi @happybeing,
I think this is possible. @RolandSherwin What do you think?
Cheers 👍

@JasonPaulGithub JasonPaulGithub added Medium Medium sized PR and removed Small Pull request is small labels Apr 8, 2024
@JasonPaulGithub JasonPaulGithub added Small Pull request is small and removed Medium Medium sized PR labels Apr 8, 2024
@JasonPaulGithub JasonPaulGithub removed their assignment Apr 10, 2024
@joshuef
Copy link
Contributor

joshuef commented Apr 11, 2024

the SmallFile here is not encrypted, so we're actually potentially exposing user data here.

This is one reason we've opted to error out on small files for now until they can be reliably encrypted via the Folders commands. (though that's unintentionally leaking out via the error handling in the client here.

So I think the solution here for #1487 is to handle the error, as opposed to attempting to chunk the file (but potentially not encrypting the data within).


If we accept that the storing of the file can throw an error for now, we can make a follow up issue to track encryption of small files via the Folders command apis.

How does that sound?

@JasonPaulGithub JasonPaulGithub marked this pull request as draft April 16, 2024 18:44
@JasonPaulGithub JasonPaulGithub deleted the cat_file_fix branch April 18, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Refactor Small Pull request is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants