Skip to content

Commit aade353

Browse files
committed
feat: tower client and streaming body support
1 parent 83f56fe commit aade353

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+10336
-1328
lines changed

.github/workflows/coverage.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ jobs:
2424
- uses: taiki-e/install-action@cargo-llvm-cov
2525
- run: |
2626
cargo llvm-cov clean --workspace
27-
cargo llvm-cov --no-report --no-default-features --package http-cache --features manager-cacache,cacache-async-std,with-http-types,manager-moka
28-
cargo llvm-cov --no-report --no-default-features --package http-cache --features manager-cacache,cacache-tokio
29-
cargo llvm-cov --no-report --package http-cache-surf --features manager-moka
30-
cargo llvm-cov --no-report --package http-cache-reqwest --features manager-moka
27+
cargo llvm-cov --no-report --no-default-features --package http-cache --features manager-cacache,cacache-smol,with-http-types,manager-moka,streaming-smol
28+
cargo llvm-cov --no-report --no-default-features --package http-cache --features manager-cacache,cacache-tokio,with-http-types,manager-moka,streaming-tokio
29+
cargo llvm-cov --no-report --package http-cache-surf --all-features
30+
cargo llvm-cov --no-report --package http-cache-reqwest --all-features
31+
cargo llvm-cov --no-report --package http-cache-tower --all-features
32+
cargo llvm-cov --no-report --package http-cache-quickcache --all-features
3133
cargo llvm-cov report --lcov --output-path lcov.info
3234
- uses: codecov/codecov-action@v5
3335
with:

.github/workflows/http-cache-mokadeser.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
name: http-cache-darkbird
1+
name: http-cache-tower
22

33
on:
4+
push:
5+
branches: [main]
6+
pull_request:
47
workflow_dispatch:
58

69
env:
710
CARGO_TERM_COLOR: always
811

912
concurrency:
10-
group: ${{ github.ref }}-http-cache-darkbird
13+
group: ${{ github.ref }}-http-cache-tower
1114
cancel-in-progress: true
1215

1316
defaults:
1417
run:
15-
working-directory: ./http-cache-darkbird
18+
working-directory: ./http-cache-tower
1619

1720
jobs:
1821
fmt:
@@ -41,6 +44,16 @@ jobs:
4144
- run: |
4245
cargo test --all-targets --all-features
4346
47+
examples:
48+
name: Test examples
49+
needs: [fmt]
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: dtolnay/rust-toolchain@stable
54+
- run: |
55+
cargo run --example streaming_memory_profile --features streaming
56+
4457
clippy:
4558
name: Check clippy
4659
needs: [fmt, test]

.github/workflows/http-cache.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
- uses: actions/checkout@v4
4343
- uses: dtolnay/rust-toolchain@stable
4444
- run: |
45-
cargo test --all-targets --no-default-features --features manager-cacache,cacache-async-std,with-http-types,manager-moka
46-
cargo test --all-targets --no-default-features --features manager-cacache,cacache-tokio
45+
cargo test --all-targets --no-default-features --features manager-cacache,cacache-smol,with-http-types,manager-moka,streaming-smol
46+
cargo test --all-targets --no-default-features --features manager-cacache,cacache-tokio,with-http-types,manager-moka,streaming-tokio
4747
4848
clippy:
4949
name: Check clippy
@@ -55,8 +55,8 @@ jobs:
5555
with:
5656
components: "clippy"
5757
- run: |
58-
cargo clippy --lib --tests --all-targets --no-default-features --features manager-cacache,cacache-async-std,with-http-types,manager-moka -- -D warnings
59-
cargo clippy --lib --tests --all-targets --no-default-features --features manager-cacache,cacache-tokio -- -D warnings
58+
cargo clippy --lib --tests --all-targets --no-default-features --features manager-cacache,cacache-smol,with-http-types,manager-moka,streaming-smol -- -D warnings
59+
cargo clippy --lib --tests --all-targets --no-default-features --features manager-cacache,cacache-tokio,with-http-types,manager-moka,streaming-tokio -- -D warnings
6060
6161
docs:
6262
name: Build docs
@@ -68,4 +68,7 @@ jobs:
6868
env:
6969
RUSTFLAGS: --cfg docsrs
7070
RUSTDOCFLAGS: --cfg docsrs -Dwarnings
71-
- run: cargo doc --no-deps --document-private-items
71+
- run: |
72+
cargo doc --no-deps --document-private-items
73+
cargo test --doc --no-default-features --features manager-cacache,cacache-smol,with-http-types,manager-moka,streaming-smol
74+
cargo test --doc --no-default-features --features manager-cacache,cacache-tokio,with-http-types,manager-moka,streaming-tokio

.github/workflows/msrv.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
- http-cache
2424
- http-cache-reqwest
2525
- http-cache-surf
26+
- http-cache-tower
27+
- http-cache-quickcache
2628
steps:
2729
- uses: actions/checkout@v4
2830
- uses: dtolnay/rust-toolchain@stable

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ target/
22
Cargo.lock
33
**/*.rs.bk
44
http-cacache/
5-
http-darkbird/
65
/.idea
76
/public
7+
/.DS_Store

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ members = [
44
"http-cache",
55
"http-cache-reqwest",
66
"http-cache-surf",
7-
"http-cache-quickcache"
7+
"http-cache-quickcache",
8+
"http-cache-tower"
89
]

docs/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [Client Implementations](./clients/clients.md)
99
- [reqwest](./clients/reqwest.md)
1010
- [surf](./clients/surf.md)
11+
- [tower](./clients/tower.md)
1112
- [Backend Cache Manager Implementations](./managers/managers.md)
1213
- [cacache](./managers/cacache.md)
1314
- [moka](./managers/moka.md)

docs/src/clients/clients.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ The following client implementations are provided by this crate:
44

55
## [reqwest](./reqwest.md)
66

7-
The [`http-cache-reqwest`](https://github.com/06chaynes/http-cache/tree/latest/http-cache-reqwest) crate provides a [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware.html) implementation for the [`reqwest`](https://github.com/seanmonstar/reqwest) HTTP client.
7+
The [`http-cache-reqwest`](https://github.com/06chaynes/http-cache/tree/main/http-cache-reqwest) crate provides a [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware.html) implementation for the [`reqwest`](https://github.com/seanmonstar/reqwest) HTTP client.
88

99
## [surf](./surf.md)
1010

11-
The [`http-cache-surf`](https://github.com/06chaynes/http-cache/tree/latest/http-cache-surf) crate provides a [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware.html) implementation for the [`surf`](https://github.com/http-rs/surf) HTTP client.
11+
The [`http-cache-surf`](https://github.com/06chaynes/http-cache/tree/main/http-cache-surf) crate provides a [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware.html) implementation for the [`surf`](https://github.com/http-rs/surf) HTTP client.
12+
13+
## [tower](./tower.md)
14+
15+
The [`http-cache-tower`](https://github.com/06chaynes/http-cache/tree/main/http-cache-tower) crate provides Tower Layer and Service implementations for caching HTTP requests and responses. It supports both regular and streaming cache operations for memory-efficient handling of large responses.

docs/src/clients/reqwest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# reqwest
22

3-
The [`http-cache-reqwest`](https://github.com/06chaynes/http-cache/tree/latest/http-cache-reqwest) crate provides a [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware.html) implementation for the [`reqwest`](https://github.com/seanmonstar/reqwest) HTTP client. It accomplishes this by utilizing [`reqwest_middleware`](https://github.com/TrueLayer/reqwest-middleware).
3+
The [`http-cache-reqwest`](https://github.com/06chaynes/http-cache/tree/main/http-cache-reqwest) crate provides a [`Middleware`](https://docs.rs/http-cache/latest/http_cache/trait.Middleware.html) implementation for the [`reqwest`](https://github.com/seanmonstar/reqwest) HTTP client. It accomplishes this by utilizing [`reqwest_middleware`](https://github.com/TrueLayer/reqwest-middleware).
44

55
## Getting Started
66

0 commit comments

Comments
 (0)