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(iroh)!: cleanup public API #2263

Merged
merged 26 commits into from
May 6, 2024
Merged

refactor(iroh)!: cleanup public API #2263

merged 26 commits into from
May 6, 2024

Conversation

dignifiedquire
Copy link
Contributor

@dignifiedquire dignifiedquire commented May 2, 2024

Description

Cleanup and improve public api, see individual commits for details.

Breaking Changes

Many, but hopefully less in the future.

  • iroh:
    • renamed:
      • ProviderService -> RpcService
      • iroh::client
        • mem::Iroh -> MemIroh
        • mem::Doc -> MemDoc
        • quic::Iroh -> QuicIroh
        • quic::Doc -> QuicDoc
        • blobs::BlobReader -> blobs::Reader
        • blobs::BlobAddProgress -> blobs::AddProgress
        • blobs::BlobAddOutcome -> blobs::AddOutcome
        • blobs::BlobDownloadProgress -> blobs::DownloadProgress
        • blobs::BlobDownloadOutcome -> blobs::DownloadOutcome
        • blobs::BlobExportProgress -> blobs::ExportProgress
        • docs::DocImportFileProgress -> docs::ImportFileProgress
        • docs::DocExportFileProgress -> docs::ExportFileProgress
        • docs::DocImportFileOutcome -> docs::ImportFileOutcome
        • docs::DocExportFileOutcome -> docs::ExportFileOutcome
      • rpc_protocol::NodeStatusResponse -> client::node::NodeStatus
      • rpc_protocol::ListTagsResponse -> client::tags::TagInfo
      • rpc_protocol::BlobListResponse -> client::blobs::BlobInfo
      • rpc_protocol::BlobListIncompleteResponse -> client::blobs::IncompleteBlobInfo
      • rpc_protocol::BlobListCollectionResponse -> client::blobs::CollectionInfo
      • rpc_protocol::DownloadMode -> client::blobs::DownloadMode
    • moved:
      • DocTicket into iroh-sync
    • removed:
      • ticket module
      • dial module
    • made private:
      • sync_engine
      • client::rpc_protocol
      • client::quic::RPC_ALPN
      • client::quic::connect_raw
    • added
      • client::node::Client::id
      • client::blobs::Client::download_with_opts
      • client::blobs::Client::download_hash_seq

@dignifiedquire dignifiedquire changed the title [WIP] refactor: improve public iroh API refactor: cleanup public iroh API May 3, 2024
@dignifiedquire dignifiedquire marked this pull request as ready for review May 3, 2024 08:19
@divagant-martian
Copy link
Contributor

divagant-martian commented May 3, 2024

Really like the iroh::clients::doc, iroh::client::blobs, iroh::client::node approach. The only one change I don't love is the now iroh::client::{MemDoc, QuicDoc, QuicIroh, etc}. IMO iroh::client::{mem, quic} was pretty clean. But it's not a hill I'll die on.

Also, to confirm, removing access to the rpc is based on the assumption that only we use it, right? If that's the case (and even if not) here is a quick search of non fork repos using rpc_protocol. It looks to me like everything people are using is either an import with a new (more reasonable) path or achievable in a less convoluted way, so it LGTM

@dignifiedquire
Copy link
Contributor Author

IMO iroh::client::{mem, quic} was pretty clean. But it's not a hill I'll die on.

I agree, the reason I changed it, was that I found it confusing to have eg client::mem and client::docs, as this looke like mem was just another part of the API

@Frando
Copy link
Member

Frando commented May 6, 2024

Maybe also rename ProviderRequest and ProviderResponse? They seem out of place now, we don't use the Provider term anywhere else anymore. So maybe just RpcRequest and RpcResponse?

@dignifiedquire
Copy link
Contributor Author

Maybe also rename ProviderRequest and ProviderResponse?

keeping with the rust convention of avoiding double names, I changed them to rpc_protocol::{Request, Response}

SCCACHE_GHA_ENABLED: "on"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use with: toolchain then this should be @master

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but then this is not against a fixed tag and would change everytime there is a change on the action, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

true, it's the way the action is designed though. i think it makes sense to use as designed, until we find out it hurts us. @stable is also a moving tag which moves every 6 weeks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@dignifiedquire dignifiedquire added this to the v0.16.0 milestone May 6, 2024
@dignifiedquire dignifiedquire changed the title refactor: cleanup public iroh API refactor(iroh)!: cleanup public API May 6, 2024
@dignifiedquire dignifiedquire self-assigned this May 6, 2024
@dignifiedquire dignifiedquire enabled auto-merge May 6, 2024 15:13
Copy link
Contributor

@divagant-martian divagant-martian left a comment

Choose a reason for hiding this comment

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

lgtm

@dignifiedquire dignifiedquire added this pull request to the merge queue May 6, 2024
Merged via the queue into main with commit d41f433 May 6, 2024
21 of 22 checks passed
@dignifiedquire dignifiedquire deleted the refactor-api branch May 6, 2024 15:58
matheus23 pushed a commit that referenced this pull request Nov 14, 2024
## Description

Cleanup and improve public api, see individual commits for details.

## Breaking Changes

Many, but hopefully less in the future.

- `iroh`:
  - renamed:
    - `ProviderService` -> `RpcService`
    - `iroh::client`
      - `mem::Iroh` -> `MemIroh`
      - `mem::Doc` -> `MemDoc`
      - `quic::Iroh` -> `QuicIroh`
      - `quic::Doc` -> `QuicDoc`
      - `blobs::BlobReader` -> `blobs::Reader`
      - `blobs::BlobAddProgress` -> `blobs::AddProgress`
      - `blobs::BlobAddOutcome` -> `blobs::AddOutcome`
      - `blobs::BlobDownloadProgress` -> `blobs::DownloadProgress`
      - `blobs::BlobDownloadOutcome` -> `blobs::DownloadOutcome`
      - `blobs::BlobExportProgress` -> `blobs::ExportProgress`
      - `docs::DocImportFileProgress` -> `docs::ImportFileProgress`
      - `docs::DocExportFileProgress` -> `docs::ExportFileProgress`
      - `docs::DocImportFileOutcome` -> `docs::ImportFileOutcome`
      - `docs::DocExportFileOutcome` -> `docs::ExportFileOutcome`
    - `rpc_protocol::NodeStatusResponse` -> `client::node::NodeStatus`
    - `rpc_protocol::ListTagsResponse` -> `client::tags::TagInfo`
    - `rpc_protocol::BlobListResponse` -> `client::blobs::BlobInfo`
- `rpc_protocol::BlobListIncompleteResponse` ->
`client::blobs::IncompleteBlobInfo`
- `rpc_protocol::BlobListCollectionResponse` ->
`client::blobs::CollectionInfo`
    - `rpc_protocol::DownloadMode` -> `client::blobs::DownloadMode`
  - moved:
    - `DocTicket` into `iroh-sync`
  - removed:
    - `ticket` module
    - `dial` module
  - made private:
    - `sync_engine`
    - `client::rpc_protocol`
    - `client::quic::RPC_ALPN`
    - `client::quic::connect_raw`
  - added
    - `client::node::Client::id`
    - `client::blobs::Client::download_with_opts`
    - `client::blobs::Client::download_hash_seq`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants