-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): async adapter & redis adapter (#419)
* feat(socketio): async adapter (#395) * feat: improve `Adapter` error types for `broadcast` and `disconnect` methods (#408) * feat(socketio/ns): improve `SocketEmitter` trait (#410) * feat(core/adapter): pass filter to get_sids * feat: add custom `Iterator` return for apply_opts fn * chore(docs): add doc on async adapters (#411) * feat(adapter): add a remote socket API (#412) * feat(core): switch to a new type for server uid (#413) * chore(deps): rm `__test_harness` && `tracing` feature flags. * chore(deps): add fuzzing as cfg flag * chore(ci): msrv * chore(clippy): fix redundant import (#414) * feat(core): improve local adapter perf (#415) * test(e2e): provide e2e testing system for adapters (#422) * test(e2e): provide e2e testing system for adapters * fix(e2e/adapter): remove redis deps * feat(socketio): check namespaces at insertion * feat(redis): redis adapter crate (#402)
- Loading branch information
Showing
126 changed files
with
7,380 additions
and
1,579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: adapter-setup | ||
services: | ||
valkey: | ||
image: valkey/valkey | ||
network_mode: host | ||
healthcheck: | ||
test: "valkey-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
redis-node-0: | ||
image: docker.io/bitnami/redis-cluster:7.0 | ||
network_mode: host | ||
healthcheck: | ||
test: "redis-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_PORT_NUMBER=7000 | ||
- REDIS_CLUSTER_ANNOUNCE_PORT=7000 | ||
- REDIS_CLUSTER_ANNOUNCE_IP=127.0.0.1 # host ip address | ||
- REDIS_CLUSTER_ANNOUNCE_BUS_PORT=17000 | ||
- REDIS_CLUSTER_DYNAMIC_IPS=no | ||
- REDIS_NODES=127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 | ||
|
||
redis-node-1: | ||
image: docker.io/bitnami/redis-cluster:7.0 | ||
network_mode: host | ||
healthcheck: | ||
test: "redis-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_PORT_NUMBER=7001 | ||
- REDIS_CLUSTER_ANNOUNCE_PORT=7001 | ||
- REDIS_CLUSTER_ANNOUNCE_BUS_PORT=17001 | ||
- REDIS_CLUSTER_ANNOUNCE_IP=127.0.0.1 | ||
- REDIS_CLUSTER_DYNAMIC_IPS=no | ||
- REDIS_NODES=127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 | ||
|
||
redis-node-2: | ||
image: docker.io/bitnami/redis-cluster:7.0 | ||
network_mode: host | ||
healthcheck: | ||
test: "redis-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_PORT_NUMBER=7002 | ||
- REDIS_CLUSTER_ANNOUNCE_PORT=7002 | ||
- REDIS_CLUSTER_ANNOUNCE_BUS_PORT=17002 | ||
- REDIS_CLUSTER_ANNOUNCE_IP=127.0.0.1 | ||
- REDIS_CLUSTER_DYNAMIC_IPS=no | ||
- REDIS_NODES=127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 | ||
|
||
redis-node-3: | ||
image: docker.io/bitnami/redis-cluster:7.0 | ||
network_mode: host | ||
healthcheck: | ||
test: "redis-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_PORT_NUMBER=7003 | ||
- REDIS_CLUSTER_ANNOUNCE_PORT=7003 | ||
- REDIS_CLUSTER_ANNOUNCE_BUS_PORT=17003 | ||
- REDIS_CLUSTER_ANNOUNCE_IP=127.0.0.1 | ||
- REDIS_CLUSTER_DYNAMIC_IPS=no | ||
- REDIS_NODES=127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 | ||
|
||
redis-node-4: | ||
image: docker.io/bitnami/redis-cluster:7.0 | ||
network_mode: host | ||
healthcheck: | ||
test: "redis-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_PORT_NUMBER=7004 | ||
- REDIS_CLUSTER_ANNOUNCE_PORT=7004 | ||
- REDIS_CLUSTER_ANNOUNCE_BUS_PORT=17004 | ||
- REDIS_CLUSTER_ANNOUNCE_IP=127.0.0.1 | ||
- REDIS_CLUSTER_DYNAMIC_IPS=no | ||
- REDIS_NODES=127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 | ||
|
||
redis-node-5: | ||
image: docker.io/bitnami/redis-cluster:7.0 | ||
network_mode: host | ||
healthcheck: | ||
test: "redis-cli ping" | ||
interval: 2s | ||
timeout: 5s | ||
depends_on: | ||
- redis-node-0 | ||
- redis-node-1 | ||
- redis-node-2 | ||
- redis-node-3 | ||
- redis-node-4 | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- REDIS_CLUSTER_REPLICAS=1 | ||
- REDIS_PORT_NUMBER=7005 | ||
- REDIS_CLUSTER_ANNOUNCE_PORT=7005 | ||
- REDIS_CLUSTER_ANNOUNCE_BUS_PORT=17005 | ||
- REDIS_CLUSTER_ANNOUNCE_IP=127.0.0.1 | ||
- REDIS_CLUSTER_DYNAMIC_IPS=no | ||
- REDIS_NODES=127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 | ||
- REDIS_CLUSTER_CREATOR=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ on: | |
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
format: | ||
|
@@ -58,10 +56,10 @@ jobs: | |
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-nightly | ||
- name: Check unused dependencies on default features | ||
run: cargo udeps --workspace | ||
run: RUSTFLAGS="--cfg fuzzing" cargo udeps | ||
|
||
- name: Check unused dependencies on all features | ||
run: cargo udeps --all-features --workspace | ||
run: RUSTFLAGS="--cfg fuzzing" cargo udeps --all-features | ||
|
||
msrv: | ||
runs-on: ubuntu-latest | ||
|
@@ -85,7 +83,7 @@ jobs: | |
components: rustfmt, clippy | ||
|
||
- name: check crates | ||
run: cargo check -p socketioxide -p engineioxide --all-features | ||
run: cargo check --all-features | ||
|
||
feature_set: | ||
runs-on: ubuntu-latest | ||
|
@@ -110,7 +108,7 @@ jobs: | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: check --feature-powerset | ||
run: cargo hack check --feature-powerset --no-dev-deps -p socketioxide -p engineioxide | ||
run: cargo hack check --feature-powerset --no-dev-deps -p socketioxide -p engineioxide -p socketioxide-redis | ||
|
||
examples: | ||
runs-on: ubuntu-latest | ||
|
@@ -271,3 +269,57 @@ jobs: | |
- name: Client output | ||
if: always() | ||
run: cat client.txt | ||
adapter: | ||
runs-on: ubuntu-latest | ||
needs: [socket_io, engine_io] | ||
strategy: | ||
matrix: | ||
socketio-version: [v4, v4-msgpack, v5, v5-msgpack] | ||
adapter: [fred-e2e, redis-e2e, redis-cluster-e2e, fred-cluster-e2e] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-adapter | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- name: install adapter infra | ||
uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: ./.github/workflows/adapter-ci/docker-compose.yml | ||
- run: cd e2e/adapter && npm install && npm install ts-node --location=global | ||
- name: Install deps & run tests | ||
run: | | ||
PARSER=$(echo ${{ matrix.socketio-version }} | cut -d'-' -f2 -s) | ||
VERSION=$(echo ${{ matrix.socketio-version }} | cut -d'-' -f1) | ||
cargo build -p adapter-e2e --bin ${{ matrix.adapter }} --features $VERSION,$PARSER | ||
cd e2e/adapter && CMD="cargo run -p adapter-e2e --bin ${{ matrix.adapter }} --features $VERSION,$PARSER" ts-node client.ts | ||
- name: Server output | ||
if: always() | ||
run: cat e2e/adapter/*.log | ||
all_passed: | ||
runs-on: ubuntu-latest | ||
needs: | ||
[ | ||
adapter, | ||
feature_set, | ||
format, | ||
udeps, | ||
msrv, | ||
examples, | ||
doctest, | ||
rust-clippy-analyze, | ||
] | ||
steps: | ||
- name: All passed | ||
run: echo "All tests passed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.