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

Added upload options (encryption/compression) for head nodes #140

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

clostao
Copy link
Member

@clostao clostao commented Oct 29, 2024

PR Type

enhancement


Description

  • Introduced FileUploadOptions to support encryption and compression during file uploads.
  • Updated IPLD builders and chunker functions to accept and process new upload options.
  • Enhanced metadata structures to include upload options for both files and folders.
  • Extended protobuf schema to define and handle new upload options.

PRDescriptionHeader.CHANGES_WALKTHROUGH

Relevant files
Enhancement
builders.ts
Add file upload options to IPLD builders                                 

packages/auto-drive/src/ipld/builders.ts

  • Added fileUploadOptions parameter to root and single functions.
  • Imported FileUploadOptions from metadata.
  • +3/-1     
    chunker.ts
    Integrate upload options into chunker processing                 

    packages/auto-drive/src/ipld/chunker.ts

  • Introduced ChunkerOptions type with upload options.
  • Added encryption and compression options to chunk processing
    functions.
  • Updated function signatures to include ChunkerOptions.
  • +59/-10 
    nodes.ts
    Support upload options in IPLD node creation                         

    packages/auto-drive/src/ipld/nodes.ts

  • Added uploadOptions parameter to various node creation functions.
  • Imported FileUploadOptions from metadata.
  • +11/-2   
    file.ts
    Include upload options in offchain file metadata                 

    packages/auto-drive/src/metadata/offchain/file.ts

  • Added uploadOptions to OffchainFileMetadata.
  • Updated fileMetadata function to include uploadOptions.
  • +7/-1     
    folder.ts
    Add upload options to offchain folder metadata                     

    packages/auto-drive/src/metadata/offchain/folder.ts

  • Added uploadOptions to OffchainFolderMetadata.
  • Updated folderMetadata function to include uploadOptions.
  • +4/-1     
    OnchainMetadata.ts
    Define and handle file upload options in metadata               

    packages/auto-drive/src/metadata/onchain/protobuf/OnchainMetadata.ts

  • Defined FileUploadOptions, CompressionOptions, and EncryptionOptions
    interfaces.
  • Added encoding and decoding logic for new options.
  • +240/-0 
    OnchainMetadata.proto
    Extend protobuf schema with file upload options                   

    packages/auto-drive/src/metadata/onchain/protobuf/OnchainMetadata.proto

  • Added FileUploadOptions message with compression and encryption
    options.
  • Defined CompressionAlgorithm and EncryptionAlgorithm enums.
  • +23/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Interface Change
    The interface Builders has been modified to include optional fileUploadOptions in methods root and single. Ensure backward compatibility and proper handling when fileUploadOptions is not provided.

    Default Values
    Default values for encryption and compression are set to undefined multiple times. Consider centralizing default value assignment to avoid redundancy and potential errors in future modifications.

    Encoding Complexity
    The encoding and decoding logic for FileUploadOptions, CompressionOptions, and EncryptionOptions is complex and spread across multiple methods. Consider refactoring to simplify the codec implementations and improve maintainability.

    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @clostao clostao merged commit 8a4b9ef into main Oct 30, 2024
    1 check passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants