You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by gk...@apache.org on 2025/07/28 15:25:40 UTC
(iggy) branch io_uring_tpc updated: feat(io_uring): merge upstream (#2047)
This is an automated email from the ASF dual-hosted git repository.
gkoszyk pushed a commit to branch io_uring_tpc
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/io_uring_tpc by this push:
new e2b3ee29 feat(io_uring): merge upstream (#2047)
e2b3ee29 is described below
commit e2b3ee29803a377a539c367b3624ba284bf5a44a
Author: Grzegorz Koszyk <11...@users.noreply.github.com>
AuthorDate: Mon Jul 28 17:25:36 2025 +0200
feat(io_uring): merge upstream (#2047)
---
.convco | 2 +-
.dockerignore | 9 +-
.github/changed-files-config.json | 4 +-
.github/workflows/ci-check-go-sdk.yml | 2 +-
.github/workflows/ci-check-python-sdk.yml | 2 +-
.github/workflows/ci-prod-rust.yml | 6 +-
.github/workflows/ci-publish-go.yml | 68 ++
.github/workflows/publish_connectors.yml | 211 +++++-
.../{publish_server.yml => publish_mcp.yml} | 65 +-
.github/workflows/publish_server.yml | 10 +-
.github/workflows/release_bench.yml | 16 +-
.github/workflows/release_connectors.yml | 16 +-
.../{release_bench.yml => release_mcp.yml} | 36 +-
Cargo.lock | 730 ++++++++++++++-----
Cargo.toml | 37 +-
DEPENDENCIES.md | 139 ++--
Dockerfile.ci.dockerignore | 3 +
docker-compose.yml => Dockerfile.connectors.ci | 32 +-
...ignore => Dockerfile.connectors.ci.dockerignore | 3 +
Dockerfile.ci.dockerignore => Dockerfile.mcp.ci | 25 +-
....dockerignore => Dockerfile.mcp.ci.dockerignore | 3 +
README.md | 6 +-
bdd/go/tests/tcp_test/messages_feature_send.go | 4 +-
bdd/go/tests/tcp_test/messages_steps.go | 5 +-
core/ai/README.md | 5 +
core/ai/mcp/Cargo.toml | 25 +
docker-compose.yml => core/ai/mcp/Dockerfile | 33 +-
core/ai/mcp/README.md | 62 ++
core/ai/mcp/config.toml | 49 ++
.../runtime/src/api/mod.rs => ai/mcp/src/api.rs} | 94 ++-
core/ai/mcp/src/configs.rs | 178 +++++
.../python/src/lib.rs => core/ai/mcp/src/error.rs | 41 +-
core/ai/mcp/src/main.rs | 198 ++++++
core/ai/mcp/src/service/mod.rs | 773 +++++++++++++++++++++
core/ai/mcp/src/service/requests.rs | 559 +++++++++++++++
core/ai/mcp/src/stream.rs | 62 ++
core/bench/dashboard/frontend/index.prod.html | 62 +-
core/bench/dashboard/frontend/src/config.rs | 4 +-
core/bench/dashboard/server/Cargo.toml | 4 +-
.../time_series/processors/moving_average.rs | 9 +-
core/cli/Cargo.toml | 2 +-
core/common/Cargo.toml | 2 +-
core/common/src/certificates.rs | 2 +-
.../connectors/runtime/Dockerfile | 33 +-
core/connectors/runtime/src/api/mod.rs | 4 +-
core/connectors/sdk/Cargo.toml | 10 +-
core/integration/Cargo.toml | 9 +-
core/integration/src/lib.rs | 2 +
core/integration/src/quic_client.rs | 2 +-
core/integration/src/test_mcp_server.rs | 232 +++++++
core/integration/src/test_tls_utils.rs | 2 +-
core/integration/tests/mcp/mod.rs | 701 +++++++++++++++++++
core/integration/tests/mod.rs | 1 +
core/sdk/src/client_provider.rs | 2 +-
core/sdk/src/clients/client.rs | 8 +-
core/sdk/src/clients/client_builder.rs | 2 +-
core/sdk/src/clients/consumer.rs | 9 +
core/sdk/src/clients/consumer_builder.rs | 1 +
core/sdk/src/clients/producer.rs | 1 +
core/sdk/src/clients/producer_builder.rs | 1 +
core/sdk/src/consumer_ext/consumer_message_ext.rs | 6 +-
.../sdk/src/consumer_ext/consumer_message_trait.rs | 6 +-
core/sdk/src/quic/mod.rs | 2 +-
.../src/quic/{quick_client.rs => quic_client.rs} | 79 ++-
core/sdk/src/tcp/tcp_client.rs | 86 +--
core/server/src/shard/system/topics.rs | 1 +
core/server/src/streaming/streams/topics.rs | 8 +-
docker-compose.yml | 2 -
.../rust/src/stream-builder/stream-basic/main.rs | 2 +-
.../stream-builder/stream-consumer-config/main.rs | 3 +-
.../src/stream-builder/stream-consumer/main.rs | 3 +-
foreign/csharp/Iggy_SDK/Iggy_SDK.csproj | 9 +-
.../fetch_messages_request_serializer_test.go | 5 +-
foreign/go/contracts/consumer.go | 24 +
foreign/go/contracts/partitions.go | 4 +-
foreign/go/samples/consumer/consumer.go | 5 +-
foreign/node/README.md | 10 +-
foreign/node/package-lock.json | 8 +-
foreign/node/package.json | 12 +-
foreign/node/src/bdd/message.ts | 4 +-
foreign/node/src/client/client.connection.ts | 221 ++++++
foreign/node/src/client/client.socket.ts | 190 ++---
foreign/node/src/client/client.transport.ts | 154 ----
foreign/node/src/client/client.ts | 17 +-
foreign/node/src/client/client.type.ts | 2 +-
foreign/node/src/client/client.utils.ts | 22 +-
foreign/node/src/debug.ts | 2 +-
foreign/node/src/e2e/tcp.consumer-group.e2e.ts | 9 +-
foreign/node/src/e2e/tcp.send-message.e2e.ts | 10 +-
foreign/node/src/examples/stream-file-to-topic.ts | 101 +++
foreign/node/src/examples/stream-topic-to-file.ts | 109 +++
foreign/node/src/examples/utils.ts | 67 ++
foreign/node/src/index.ts | 7 +-
foreign/node/src/quic.lib-test.js | 105 ---
foreign/node/src/stream/consumer-stream.ts | 113 +--
foreign/node/src/wire/client/client.utils.ts | 2 +
foreign/node/src/wire/index.ts | 2 +
foreign/node/src/wire/offset/get-offset.command.ts | 3 +
foreign/node/src/wire/offset/index.ts | 3 +-
foreign/node/src/wire/offset/offset.utils.ts | 15 +
foreign/node/src/wire/stream/stream.utils.ts | 3 +
.../node/src/wire/topic/create-topic.command.ts | 8 +-
foreign/node/src/wire/topic/index.ts | 1 +
foreign/node/src/wire/topic/topic.utils.ts | 16 +-
.../node/src/wire/topic/update-topic.command.ts | 8 +-
foreign/node/src/wire/user/user.utils.ts | 3 +
foreign/python/Cargo.toml | 7 +-
foreign/python/iggy_py.pyi | 274 +++++++-
foreign/python/pyproject.toml | 3 +-
foreign/python/src/client.rs | 178 +++--
foreign/python/src/consumer.rs | 415 +++++++++++
foreign/python/src/identifier.rs | 50 ++
foreign/python/src/lib.rs | 7 +
foreign/python/src/receive_message.rs | 14 +-
foreign/python/tests/test_iggy_sdk.py | 223 ++++--
115 files changed, 5998 insertions(+), 1263 deletions(-)
diff --git a/.convco b/.convco
index 507d7885..2f7fc2cc 100644
--- a/.convco
+++ b/.convco
@@ -1 +1 @@
-scopeRegex: "(ci|sdk|server|connectors|cli|bench|misc|docs|io_uring|test|repo|deps|deps-dev)(,(ci|sdk|server|connectors|cli|bench|misc|docs|io_uring|test|repo|deps|deps-dev))*"
+scopeRegex: "(ci|sdk|server|connectors|cli|bench|misc|mcp|docs|io_uring|test|repo|deps|deps-dev)(,(ci|sdk|server|connectors|cli|bench|misc|mcp|docs|io_uring|test|repo|deps|deps-dev))*"
diff --git a/.dockerignore b/.dockerignore
index 0caab147..336912aa 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -3,8 +3,15 @@
.git
.github
.gitignore
+.idea
+.vscode
+.zed
/assets
-/certs
+/core/certs
+/helm
+/licenses
/local_data
+/performance_results
/scripts
/target
+/web
diff --git a/.github/changed-files-config.json b/.github/changed-files-config.json
index a96ea4e2..0588b7a0 100644
--- a/.github/changed-files-config.json
+++ b/.github/changed-files-config.json
@@ -1,6 +1,6 @@
{
"rust": [
- "core/(bench|cli|examples|integration|sdk|server|tools|connectors).*\\.rs",
+ "core/(bench|cli|examples|integration|sdk|server|tools|connectors|ai).*\\.rs",
"bdd/rust/.*\\.rs",
"core/Cargo.toml",
"Cargo.toml",
@@ -15,7 +15,7 @@
".github/workflows/ci-check-pr.yml"
],
"rust-prod": [
- "core/(bench|cli|examples|integration|sdk|server|tools|connectors).*\\.rs",
+ "core/(bench|cli|examples|integration|sdk|server|tools|connectors|ai).*\\.rs",
"bdd/rust/.*\\.rs",
"core/Cargo.toml",
"Cargo.toml",
diff --git a/.github/workflows/ci-check-go-sdk.yml b/.github/workflows/ci-check-go-sdk.yml
index 9b7f5207..3d11c56c 100644
--- a/.github/workflows/ci-check-go-sdk.yml
+++ b/.github/workflows/ci-check-go-sdk.yml
@@ -60,4 +60,4 @@ jobs:
uses: golangci/golangci-lint-action@v8
with:
version: v2.1
- working-directory: ${{ matrix.module }}
+ working-directory: ${{ matrix.module }}
\ No newline at end of file
diff --git a/.github/workflows/ci-check-python-sdk.yml b/.github/workflows/ci-check-python-sdk.yml
index 2f93c010..9c5a752f 100644
--- a/.github/workflows/ci-check-python-sdk.yml
+++ b/.github/workflows/ci-check-python-sdk.yml
@@ -60,7 +60,7 @@ jobs:
working-directory: foreign/python
before-script-linux: 'dnf install -y perl-IPC-Cmd && (python3 -m pip --version || python3 -m ensurepip)'
manylinux: '2_28'
- args: --release --out dist --find-interpreter
+ args: --release --out dist --interpreter python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14
sccache: 'true'
- name: Set up Docker Buildx
if: matrix.target == 'x86_64'
diff --git a/.github/workflows/ci-prod-rust.yml b/.github/workflows/ci-prod-rust.yml
index 7efec3e1..f7672d0f 100644
--- a/.github/workflows/ci-prod-rust.yml
+++ b/.github/workflows/ci-prod-rust.yml
@@ -75,9 +75,9 @@ jobs:
echo -n "test" | gnome-keyring-daemon --unlock
- name: Prepare ${{ matrix.platform.target }} toolchain
run: |
- rustup toolchain add --profile=minimal stable
- rustup target add --toolchain=stable ${{ matrix.platform.target }}
- rustup override set stable
+ rustup toolchain add --profile=minimal stable
+ rustup target add --toolchain=stable ${{ matrix.platform.target }}
+ rustup override set stable
- name: Install cross tool
uses: taiki-e/install-action@v2
with:
diff --git a/.github/workflows/ci-publish-go.yml b/.github/workflows/ci-publish-go.yml
new file mode 100644
index 00000000..5cab1bf5
--- /dev/null
+++ b/.github/workflows/ci-publish-go.yml
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: ci-publish-go
+on:
+ push:
+ tags:
+ - "foreign/go/v*"
+
+jobs:
+ validate:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Extract tag name
+ id: extract
+ run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
+
+ - name: Validate tag format
+ run: |
+ if [[ ! "$TAG" =~ ^foreign/go/v([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
+ echo "Tag $TAG does not match required format: foreign/go/vX.Y.Z"
+ exit 1
+ fi
+ echo "Valid Go module tag: $TAG"
+
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Check go.mod module path in foreign/go
+ run: |
+ MOD_PATH=$(grep '^module ' foreign/go/go.mod | awk '{print $2}')
+ if [[ "$MOD_PATH" != "github.com/${{ github.repository }}/foreign/go" ]]; then
+ echo "go.mod module path ($MOD_PATH) does not match expected path: github.com/${{ github.repository }}/foreign/go"
+ exit 1
+ fi
+ echo "go.mod module path is correct: $MOD_PATH"
+
+ - name: Check if go.mod version matches tag
+ run: |
+ TAG_VERSION="${TAG#foreign/go/}"
+ # Check if go.mod contains this version in replace or require (not strictly necessary, but can be used for extra checks)
+ echo "Tag version is $TAG_VERSION (no strict version field in go.mod to check for single module)"
+ # (No error here, just informative)
+
+ - name: Run go mod tidy
+ working-directory: foreign/go
+ run: |
+ go mod tidy
+ git diff --exit-code || (echo 'Please run "go mod tidy" and commit the changes before tagging.' && exit 1)
+
+ - name: Run Go tests
+ working-directory: foreign/go
+ run: go test -v ./...
+
diff --git a/.github/workflows/publish_connectors.yml b/.github/workflows/publish_connectors.yml
index e70ff128..9f269a7e 100644
--- a/.github/workflows/publish_connectors.yml
+++ b/.github/workflows/publish_connectors.yml
@@ -16,18 +16,23 @@
# under the License.
name: publish_connectors
+
on:
push:
tags:
- - "iggy-connectors-*"
+ - "connectors-*"
env:
+ DOCKERHUB_REGISTRY_NAME: apache/iggy-connect
+ CRATE_NAME: iggy-connectors
GITHUB_TOKEN: ${{ github.token }}
+ RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
+ IGGY_CI_BUILD: true
jobs:
validate:
- if: startsWith(github.ref, 'refs/tags/iggy-connectors-')
+ if: startsWith(github.ref, 'refs/tags/connectors-')
runs-on: ubuntu-latest
steps:
- name: Extract tag name
@@ -37,8 +42,8 @@ jobs:
- name: Validate tag format
run: |
TAG=${TAG}
- if [[ ! "$TAG" =~ ^iggy-connectors-([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
- echo "Tag $TAG does not match strict semver format (iggy-connectors-X.Y.Z where 0 <= X,Y,Z <= 999)"
+ if [[ ! "$TAG" =~ ^connectors-([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
+ echo "Tag $TAG does not match strict semver format (connectors-X.Y.Z where 0 <= X,Y,Z <= 999)"
exit 1
fi
echo "Valid tag: $TAG"
@@ -62,14 +67,14 @@ jobs:
- name: Extract iggy-connectors version from Cargo.toml
id: extract_version
run: |
- version=$(cargo pkgid -p iggy-connectors | cut -d@ -f2)
- echo "iggy_connectors_version=$version" >> "$GITHUB_OUTPUT"
+ version=$(cargo pkgid -p iggy-connectors | cut -d# -f2 | cut -d: -f2)
+ echo "connectors_version=$version" >> "$GITHUB_OUTPUT"
echo "::notice ::Version from Cargo.toml $version"
- name: Check if version from Cargo.toml is the same as the tag
id: check_git_tag
run: |
- if [[ "iggy-connectors-${{ steps.extract_version.outputs.iggy_connectors_version }}" == "${{ steps.extract_tag.outputs.tag_name }}" ]];
+ if [[ "connectors-${{ steps.extract_version.outputs.connectors_version }}" == "${{ steps.extract_tag.outputs.tag_name }}" ]];
then
echo "::notice ::Tag ${{ steps.extract_tag.outputs.tag_name }} matches the version in Cargo.toml"
echo "tag_matches=true" >> "$GITHUB_OUTPUT"
@@ -79,41 +84,203 @@ jobs:
fi
outputs:
- iggy_connectors_version: ${{ steps.extract_tag.outputs.tag_name }}
+ connectors_version: ${{ steps.extract_version.outputs.connectors_version }}
tag_created: ${{ steps.check_git_tag.outputs.tag_matches }}
- publish:
- name: Publish Connectors Runtime on crates.io
+ release_and_publish:
+ name: build release ${{ matrix.platform.os_name }}
needs: tag
- if: ${{ needs.tag.outputs.tag_created == 'true' }}
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.platform.os }}
+ strategy:
+ matrix:
+ platform:
+ - os_name: Linux-x86_64-musl
+ os: ubuntu-latest
+ target: x86_64-unknown-linux-musl
+ bin:
+ - iggy-connectors
+ name: iggy-connectors-Linux-x86_64-musl.tar.gz
+ cargo_command: cargo
+ docker_arch: linux/amd64
+ cross: false
+
+ - os_name: Linux-aarch64-musl
+ os: ubuntu-latest
+ target: aarch64-unknown-linux-musl
+ bin:
+ - iggy-connectors
+ name: iggy-connectors-Linux-aarch64-musl.tar.gz
+ docker_arch: linux/arm64/v8
+ cross: true
+
+ toolchain:
+ - stable
+
steps:
- - uses: actions/checkout@v4
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Cache cargo & target directories
+ uses: Swatinem/rust-cache@v2
+ with:
+ key: "publish-connectors-${{ matrix.platform.target }}"
+
+ - name: Install musl-tools on Linux
+ run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
+ if: contains(matrix.platform.name, 'musl')
- - run: |
+ - name: Prepare ${{ matrix.platform.target }} toolchain
+ run: |
rustup toolchain add --profile=minimal stable
+ rustup target add --toolchain=stable ${{ matrix.platform.target }}
rustup override set stable
- - name: publish
+ - name: Install cross
+ uses: taiki-e/install-action@v2
+ with:
+ tool: cross
+
+ - name: Build iggy-connectors ${{ matrix.platform.target }} release binary
+ run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} --bin iggy-connectors
+
+ - name: Build iggy-cli ${{ matrix.platform.target }} release binary
+ run: cross +stable build --verbose --release --no-default-features --target ${{ matrix.platform.target }} --bin iggy
+
+ - name: Prepare artifacts
+ run: |
+ mkdir -p release_artifacts/
+ cp target/${{ matrix.platform.target }}/release/iggy-connectors release_artifacts/
+ cp target/${{ matrix.platform.target }}/release/iggy release_artifacts/
+
+ - name: Print message
+ run: echo "::notice ::Published ${{ needs.tag.outputs.connectors_version }} release artifacts on GitHub"
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+ with:
+ platforms: "arm64,arm"
+ if: ${{ matrix.platform.cross }}
+
+ - name: Set up Docker
+ uses: crazy-max/ghaction-setup-docker@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USER }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.DOCKERHUB_REGISTRY_NAME }}
+
+ - name: Build and push by digest
+ id: build
+ uses: docker/build-push-action@v6
+ with:
+ context: ./
+ file: ./Dockerfile.connectors.ci
+ platforms: ${{ matrix.platform.docker_arch }}
+ labels: ${{ steps.meta.outputs.labels }}
+ outputs: type=image,name=${{ env.DOCKERHUB_REGISTRY_NAME }},push-by-digest=true,name-canonical=true,push=true
+ build-args: |
+ IGGY_CONNECTORS_PATH=target/${{ matrix.platform.target }}/release/iggy-connectors
+
+ - name: Export digest
run: |
- cargo login "${{ secrets.CARGO_REGISTRY_TOKEN }}"
- cargo publish -p iggy-connectors
+ mkdir -p /tmp/digests
+ digest="${{ steps.build.outputs.digest }}"
+ touch "/tmp/digests/${digest#sha256:}"
+
+ - name: Upload digest
+ uses: actions/upload-artifact@v4
+ with:
+ name: digests-${{ matrix.platform.os_name }}
+ path: /tmp/digests/*
+ if-no-files-found: error
+ retention-days: 1
- finalize_connectors:
+ merge_docker_manifest:
runs-on: ubuntu-latest
needs:
- - publish
+ - release_and_publish
+ - tag
+ steps:
+ - name: Download digests
+ uses: actions/download-artifact@v4
+ with:
+ pattern: "digests-*"
+ merge-multiple: true
+ path: /tmp/digests
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USER }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Docker meta (tag was created)
+ if: ${{ needs.tag.outputs.tag_created == 'true' }}
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.DOCKERHUB_REGISTRY_NAME }}
+ tags: |
+ ${{ needs.tag.outputs.connectors_version }}
+ latest
+
+ - name: Docker meta (tag was not created)
+ if: ${{ needs.tag.outputs.tag_created == '' }}
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.DOCKERHUB_REGISTRY_NAME }}
+ tags: |
+ edge
+
+ - name: Create manifest list and push
+ working-directory: /tmp/digests
+ run: |
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
+ $(printf '${{ env.DOCKERHUB_REGISTRY_NAME }}@sha256:%s ' *)
+
+ - name: Inspect image
+ run: |
+ docker buildx imagetools inspect ${{ env.DOCKERHUB_REGISTRY_NAME }}:latest
+
+ github_release:
+ uses: ./.github/workflows/release_connectors.yml
+ needs: tag
+ if: ${{ needs.tag.outputs.tag_created == 'true' }}
+ with:
+ tag_name: "connectors-${{ needs.tag.outputs.connectors_version }}"
+
+ finalize_publish_connectors:
+ runs-on: ubuntu-latest
+ needs:
+ - release_and_publish
+ - merge_docker_manifest
+ - github_release
if: always()
steps:
- - uses: actions/checkout@v4
+ - name: Checkout code
+ uses: actions/checkout@v4
+
- name: Everything is fine
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
+
- name: Something went wrong
- if: ${{ contains(needs.*.result, 'failure') }}
+ if: ${{ contains(needs.*.result, 'failure') && github.event_name != 'workflow_dispatch' }}
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- GITHUB_BOT_CONTEXT_STRING: "publish to crates.io"
+ GITHUB_BOT_CONTEXT_STRING: "build and release to dockerhub"
with:
filename: .github/BOT_ISSUE_TEMPLATE.md
diff --git a/.github/workflows/publish_server.yml b/.github/workflows/publish_mcp.yml
similarity index 80%
copy from .github/workflows/publish_server.yml
copy to .github/workflows/publish_mcp.yml
index c860c666..6bcad502 100644
--- a/.github/workflows/publish_server.yml
+++ b/.github/workflows/publish_mcp.yml
@@ -15,16 +15,16 @@
# specific language governing permissions and limitations
# under the License.
-name: publish_server
+name: publish_mcp
on:
push:
tags:
- - 'server-*'
+ - "mcp-*"
env:
- DOCKERHUB_REGISTRY_NAME: apache/iggy
- CRATE_NAME: iggy
+ DOCKERHUB_REGISTRY_NAME: apache/iggy-mcp
+ CRATE_NAME: iggy-mcp
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
@@ -32,7 +32,7 @@ env:
jobs:
validate:
- if: startsWith(github.ref, 'refs/tags/server-')
+ if: startsWith(github.ref, 'refs/tags/mcp-')
runs-on: ubuntu-latest
steps:
- name: Extract tag name
@@ -42,8 +42,8 @@ jobs:
- name: Validate tag format
run: |
TAG=${TAG}
- if [[ ! "$TAG" =~ ^server-([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
- echo "Tag $TAG does not match strict semver format (server-X.Y.Z where 0 <= X,Y,Z <= 999)"
+ if [[ ! "$TAG" =~ ^mcp-([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
+ echo "Tag $TAG does not match strict semver format (mcp-X.Y.Z where 0 <= X,Y,Z <= 999)"
exit 1
fi
echo "Valid tag: $TAG"
@@ -64,17 +64,17 @@ jobs:
echo "tag_name=$tag" >> "$GITHUB_OUTPUT"
echo "::notice ::Tag that triggered the workflow: $tag"
- - name: Extract iggy-server version from Cargo.toml
+ - name: Extract iggy-mcp version from Cargo.toml
id: extract_version
run: |
- version=$(cargo pkgid -p server | cut -d# -f2 | cut -d: -f2)
- echo "server_version=$version" >> "$GITHUB_OUTPUT"
+ version=$(cargo pkgid -p iggy-mcp | cut -d# -f2 | cut -d: -f2)
+ echo "mcp_version=$version" >> "$GITHUB_OUTPUT"
echo "::notice ::Version from Cargo.toml $version"
- name: Check if version from Cargo.toml is the same as the tag
id: check_git_tag
run: |
- if [[ "server-${{ steps.extract_version.outputs.server_version }}" == "${{ steps.extract_tag.outputs.tag_name }}" ]];
+ if [[ "mcp-${{ steps.extract_version.outputs.mcp_version }}" == "${{ steps.extract_tag.outputs.tag_name }}" ]];
then
echo "::notice ::Tag ${{ steps.extract_tag.outputs.tag_name }} matches the version in Cargo.toml"
echo "tag_matches=true" >> "$GITHUB_OUTPUT"
@@ -84,7 +84,7 @@ jobs:
fi
outputs:
- server_version: ${{ steps.extract_version.outputs.server_version }}
+ mcp_version: ${{ steps.extract_version.outputs.mcp_version }}
tag_created: ${{ steps.check_git_tag.outputs.tag_matches }}
release_and_publish:
@@ -98,9 +98,8 @@ jobs:
os: ubuntu-latest
target: x86_64-unknown-linux-musl
bin:
- - iggy-server
- - iggy
- name: iggy-Linux-x86_64-musl.tar.gz
+ - iggy-mcp
+ name: iggy-mcp-Linux-x86_64-musl.tar.gz
cargo_command: cargo
docker_arch: linux/amd64
cross: false
@@ -109,9 +108,8 @@ jobs:
os: ubuntu-latest
target: aarch64-unknown-linux-musl
bin:
- - iggy-server
- - iggy
- name: iggy-Linux-aarch64-musl.tar.gz
+ - iggy-mcp
+ name: iggy-mcp-Linux-aarch64-musl.tar.gz
docker_arch: linux/arm64/v8
cross: true
@@ -125,7 +123,7 @@ jobs:
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
- key: "publish-server-${{ matrix.platform.target }}"
+ key: "publish-mcp-${{ matrix.platform.target }}"
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
@@ -133,17 +131,17 @@ jobs:
- name: Prepare ${{ matrix.platform.target }} toolchain
run: |
- rustup toolchain add --profile=minimal stable
- rustup target add --toolchain=stable ${{ matrix.platform.target }}
- rustup override set stable
+ rustup toolchain add --profile=minimal stable
+ rustup target add --toolchain=stable ${{ matrix.platform.target }}
+ rustup override set stable
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross
- - name: Build iggy-server ${{ matrix.platform.target }} release binary
- run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} --bin iggy-server
+ - name: Build iggy-mcp ${{ matrix.platform.target }} release binary
+ run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} --bin iggy-mcp
- name: Build iggy-cli ${{ matrix.platform.target }} release binary
run: cross +stable build --verbose --release --no-default-features --target ${{ matrix.platform.target }} --bin iggy
@@ -151,11 +149,11 @@ jobs:
- name: Prepare artifacts
run: |
mkdir -p release_artifacts/
- cp target/${{ matrix.platform.target }}/release/iggy-server release_artifacts/
+ cp target/${{ matrix.platform.target }}/release/iggy-mcp release_artifacts/
cp target/${{ matrix.platform.target }}/release/iggy release_artifacts/
- name: Print message
- run: echo "::notice ::Published ${{ needs.tag.outputs.server_version }} release artifacts on GitHub"
+ run: echo "::notice ::Published ${{ needs.tag.outputs.mcp }} release artifacts on GitHub"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -186,13 +184,12 @@ jobs:
uses: docker/build-push-action@v6
with:
context: ./
- file: ./Dockerfile.ci
+ file: ./Dockerfile.mcp.ci
platforms: ${{ matrix.platform.docker_arch }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.DOCKERHUB_REGISTRY_NAME }},push-by-digest=true,name-canonical=true,push=true
build-args: |
- IGGY_CMD_PATH=target/${{ matrix.platform.target }}/release/iggy
- IGGY_SERVER_PATH=target/${{ matrix.platform.target }}/release/iggy-server
+ IGGY_MCP_PATH=target/${{ matrix.platform.target }}/release/iggy-mcp
- name: Export digest
run: |
@@ -217,7 +214,7 @@ jobs:
- name: Download digests
uses: actions/download-artifact@v4
with:
- pattern: 'digests-*'
+ pattern: "digests-*"
merge-multiple: true
path: /tmp/digests
@@ -236,7 +233,7 @@ jobs:
with:
images: ${{ env.DOCKERHUB_REGISTRY_NAME }}
tags: |
- ${{ needs.tag.outputs.server_version }}
+ ${{ needs.tag.outputs.mcp_version }}
latest
- name: Docker meta (tag was not created)
@@ -258,13 +255,13 @@ jobs:
docker buildx imagetools inspect ${{ env.DOCKERHUB_REGISTRY_NAME }}:latest
github_release:
- uses: ./.github/workflows/release_server.yml
+ uses: ./.github/workflows/release_mcp.yml
needs: tag
if: ${{ needs.tag.outputs.tag_created == 'true' }}
with:
- tag_name: "server-${{ needs.tag.outputs.server_version }}"
+ tag_name: "mcp-${{ needs.tag.outputs.mcp_version }}"
- finalize_publish_server:
+ finalize_publish_mcp:
runs-on: ubuntu-latest
needs:
- release_and_publish
diff --git a/.github/workflows/publish_server.yml b/.github/workflows/publish_server.yml
index c860c666..33c9c857 100644
--- a/.github/workflows/publish_server.yml
+++ b/.github/workflows/publish_server.yml
@@ -20,7 +20,7 @@ name: publish_server
on:
push:
tags:
- - 'server-*'
+ - "server-*"
env:
DOCKERHUB_REGISTRY_NAME: apache/iggy
@@ -133,9 +133,9 @@ jobs:
- name: Prepare ${{ matrix.platform.target }} toolchain
run: |
- rustup toolchain add --profile=minimal stable
- rustup target add --toolchain=stable ${{ matrix.platform.target }}
- rustup override set stable
+ rustup toolchain add --profile=minimal stable
+ rustup target add --toolchain=stable ${{ matrix.platform.target }}
+ rustup override set stable
- name: Install cross
uses: taiki-e/install-action@v2
@@ -217,7 +217,7 @@ jobs:
- name: Download digests
uses: actions/download-artifact@v4
with:
- pattern: 'digests-*'
+ pattern: "digests-*"
merge-multiple: true
path: /tmp/digests
diff --git a/.github/workflows/release_bench.yml b/.github/workflows/release_bench.yml
index 2548c866..6fc94122 100644
--- a/.github/workflows/release_bench.yml
+++ b/.github/workflows/release_bench.yml
@@ -39,31 +39,31 @@ jobs:
platform:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- executable: iggy
+ executable: iggy-bench
file: iggy-bench-x86_64-unknown-linux-musl.tgz
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- executable: iggy
+ executable: iggy-bench
file: iggy-bench-aarch64-unknown-linux-musl.tgz
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- executable: iggy
+ executable: iggy-bench
file: iggy-bench-x86_64-unknown-linux-gnu.tgz
- target: x86_64-pc-windows-msvc
os: windows-latest
- executable: iggy.exe
+ executable: iggy-bench.exe
file: iggy-bench-x86_64-pc-windows-msvc.zip
- target: aarch64-pc-windows-msvc
os: windows-latest
- executable: iggy.exe
+ executable: iggy-bench.exe
file: iggy-bench-aarch64-pc-windows-msvc.zip
- target: x86_64-apple-darwin
os: macos-latest
- executable: iggy
+ executable: iggy-bench
file: iggy-bench-x86_64-apple-darwin.zip
- target: aarch64-apple-darwin
os: macos-latest
- executable: iggy
+ executable: iggy-bench
file: iggy-bench-aarch64-apple-darwin.zip
steps:
- name: Checkout code
@@ -90,7 +90,7 @@ jobs:
tool: cross
- name: Build ${{ matrix.platform.target }} release binary
- run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} -p iggy
+ run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} -p iggy-bench
- name: Collect ${{ matrix.platform.target }} executable
run: |
diff --git a/.github/workflows/release_connectors.yml b/.github/workflows/release_connectors.yml
index a87adb6b..9daf10a1 100644
--- a/.github/workflows/release_connectors.yml
+++ b/.github/workflows/release_connectors.yml
@@ -39,31 +39,31 @@ jobs:
platform:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- executable: iggy
+ executable: iggy-connectors
file: iggy-connectors-x86_64-unknown-linux-musl.tgz
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- executable: iggy
+ executable: iggy-connectors
file: iggy-connectors-aarch64-unknown-linux-musl.tgz
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- executable: iggy
+ executable: iggy-connectors
file: iggy-connectors-x86_64-unknown-linux-gnu.tgz
- target: x86_64-pc-windows-msvc
os: windows-latest
- executable: iggy.exe
+ executable: iggy-connectors.exe
file: iggy-connectors-x86_64-pc-windows-msvc.zip
- target: aarch64-pc-windows-msvc
os: windows-latest
- executable: iggy.exe
+ executable: iggy-connectors.exe
file: iggy-connectors-aarch64-pc-windows-msvc.zip
- target: x86_64-apple-darwin
os: macos-latest
- executable: iggy
+ executable: iggy-connectors
file: iggy-connectors-x86_64-apple-darwin.zip
- target: aarch64-apple-darwin
os: macos-latest
- executable: iggy
+ executable: iggy-connectors
file: iggy-connectors-aarch64-apple-darwin.zip
steps:
- name: Checkout code
@@ -90,7 +90,7 @@ jobs:
tool: cross
- name: Build ${{ matrix.platform.target }} release binary
- run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} -p iggy
+ run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} -p iggy-connectors
- name: Collect ${{ matrix.platform.target }} executable
run: |
diff --git a/.github/workflows/release_bench.yml b/.github/workflows/release_mcp.yml
similarity index 82%
copy from .github/workflows/release_bench.yml
copy to .github/workflows/release_mcp.yml
index 2548c866..c944790d 100644
--- a/.github/workflows/release_bench.yml
+++ b/.github/workflows/release_mcp.yml
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-name: release_bench
+name: release_mcp
on:
workflow_call:
@@ -32,39 +32,39 @@ env:
IGGY_CI_BUILD: true
jobs:
- build_bench:
+ build_mcp:
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- executable: iggy
- file: iggy-bench-x86_64-unknown-linux-musl.tgz
+ executable: iggy-mcp
+ file: iggy-mcp-x86_64-unknown-linux-musl.tgz
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- executable: iggy
- file: iggy-bench-aarch64-unknown-linux-musl.tgz
+ executable: iggy-mcp
+ file: iggy-mcp-aarch64-unknown-linux-musl.tgz
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- executable: iggy
- file: iggy-bench-x86_64-unknown-linux-gnu.tgz
+ executable: iggy-mcp
+ file: iggy-mcp-x86_64-unknown-linux-gnu.tgz
- target: x86_64-pc-windows-msvc
os: windows-latest
- executable: iggy.exe
- file: iggy-bench-x86_64-pc-windows-msvc.zip
+ executable: iggy-mcp.exe
+ file: iggy-mcp-x86_64-pc-windows-msvc.zip
- target: aarch64-pc-windows-msvc
os: windows-latest
- executable: iggy.exe
- file: iggy-bench-aarch64-pc-windows-msvc.zip
+ executable: iggy-mcp.exe
+ file: iggy-mcp-aarch64-pc-windows-msvc.zip
- target: x86_64-apple-darwin
os: macos-latest
- executable: iggy
- file: iggy-bench-x86_64-apple-darwin.zip
+ executable: iggy-mcp
+ file: iggy-mcp-x86_64-apple-darwin.zip
- target: aarch64-apple-darwin
os: macos-latest
- executable: iggy
- file: iggy-bench-aarch64-apple-darwin.zip
+ executable: iggy-mcp
+ file: iggy-mcp-aarch64-apple-darwin.zip
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -72,7 +72,7 @@ jobs:
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
- key: "release-bench-${{ matrix.platform.target }}"
+ key: "release-mcp-${{ matrix.platform.target }}"
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
@@ -90,7 +90,7 @@ jobs:
tool: cross
- name: Build ${{ matrix.platform.target }} release binary
- run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} -p iggy
+ run: cross +stable build --verbose --release --target ${{ matrix.platform.target }} -p iggy-mcp
- name: Collect ${{ matrix.platform.target }} executable
run: |
diff --git a/Cargo.lock b/Cargo.lock
index 2a32b031..b5d46bb7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -77,7 +77,7 @@ dependencies = [
"flate2",
"foldhash",
"futures-core",
- "h2 0.3.26",
+ "h2 0.3.27",
"http 0.2.12",
"httparse",
"httpdate",
@@ -87,7 +87,7 @@ dependencies = [
"mime",
"percent-encoding",
"pin-project-lite",
- "rand 0.9.1",
+ "rand 0.9.2",
"sha1",
"smallvec",
"tokio",
@@ -489,11 +489,11 @@ dependencies = [
[[package]]
name = "async-compression"
-version = "0.4.25"
+version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40f6024f3f856663b45fd0c9b6f2024034a702f453549449e0d84a305900dad4"
+checksum = "ddb939d66e4ae03cee6091612804ba446b12878410cfa17f785f4dd67d4014e8"
dependencies = [
- "bzip2 0.6.0",
+ "bzip2",
"flate2",
"futures-core",
"futures-io",
@@ -660,9 +660,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "aws-lc-rs"
-version = "1.13.1"
+version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fcc8f365936c834db5514fc45aee5b1202d677e6b40e48468aaaa8183ca8c7"
+checksum = "5c953fe1ba023e6b7730c0d4b031d06f267f23a46167dcbd40316644b10a17ba"
dependencies = [
"aws-lc-sys",
"zeroize",
@@ -670,9 +670,9 @@ dependencies = [
[[package]]
name = "aws-lc-sys"
-version = "0.29.0"
+version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61b1d86e7705efe1be1b569bab41d4fa1e14e220b60a160f78de2db687add079"
+checksum = "dbfd150b5dbdb988bcc8fb1fe787eb6b7ee6180ca24da683b61ea5405f3d43ff"
dependencies = [
"bindgen",
"cc",
@@ -934,10 +934,10 @@ dependencies = [
"derive-new",
"derive_more 2.0.1",
"human-repr",
- "rand 0.9.1",
+ "rand 0.9.2",
"serde",
"serde_json",
- "sysinfo 0.35.2",
+ "sysinfo 0.36.1",
"tracing",
"uuid",
]
@@ -1069,9 +1069,9 @@ dependencies = [
[[package]]
name = "bon"
-version = "3.6.4"
+version = "3.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f61138465baf186c63e8d9b6b613b508cd832cba4ce93cf37ce5f096f91ac1a6"
+checksum = "33d9ef19ae5263a138da9a86871eca537478ab0332a7770bac7e3f08b801f89f"
dependencies = [
"bon-macros",
"rustversion",
@@ -1079,11 +1079,11 @@ dependencies = [
[[package]]
name = "bon-macros"
-version = "3.6.4"
+version = "3.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40d1dad34aa19bf02295382f08d9bc40651585bd497266831d40ee6296fb49ca"
+checksum = "577ae008f2ca11ca7641bd44601002ee5ab49ef0af64846ce1ab6057218a5cc1"
dependencies = [
- "darling",
+ "darling 0.21.0",
"ident_case",
"prettyplease",
"proc-macro2",
@@ -1225,15 +1225,6 @@ dependencies = [
"bytes",
]
-[[package]]
-name = "bzip2"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47"
-dependencies = [
- "bzip2-sys",
-]
-
[[package]]
name = "bzip2"
version = "0.6.0"
@@ -1243,16 +1234,6 @@ dependencies = [
"libbz2-rs-sys",
]
-[[package]]
-name = "bzip2-sys"
-version = "0.1.13+1.0.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14"
-dependencies = [
- "cc",
- "pkg-config",
-]
-
[[package]]
name = "camino"
version = "1.1.10"
@@ -1286,10 +1267,22 @@ dependencies = [
]
[[package]]
+<<<<<<< HEAD
+=======
+name = "castaway"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
+dependencies = [
+ "rustversion",
+]
+
+[[package]]
+>>>>>>> master
name = "cc"
-version = "1.2.27"
+version = "1.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc"
+checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7"
dependencies = [
"jobserver",
"libc",
@@ -1389,9 +1382,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.5.40"
+version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f"
+checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
dependencies = [
"clap_builder",
"clap_derive",
@@ -1399,9 +1392,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.40"
+version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e"
+checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
dependencies = [
"anstream",
"anstyle",
@@ -1412,18 +1405,18 @@ dependencies = [
[[package]]
name = "clap_complete"
-version = "4.5.54"
+version = "4.5.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aad5b1b4de04fead402672b48897030eec1f3bfe1550776322f59f6d6e6a5677"
+checksum = "a5abde44486daf70c5be8b8f8f1b66c49f86236edf6fa2abadb4d961c4c6229a"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
-version = "4.5.40"
+version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce"
+checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -1858,9 +1851,9 @@ dependencies = [
[[package]]
name = "config"
-version = "0.15.11"
+version = "0.15.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "595aae20e65c3be792d05818e8c63025294ac3cb7e200f11459063a352a6ef80"
+checksum = "5b1eb4fb07bc7f012422df02766c7bd5971effb894f573865642f06fa3265440"
dependencies = [
"async-trait",
"convert_case 0.6.0",
@@ -1870,8 +1863,8 @@ dependencies = [
"rust-ini",
"serde",
"serde_json",
- "toml",
- "winnow 0.7.11",
+ "toml 0.9.2",
+ "winnow 0.7.12",
"yaml-rust2",
]
@@ -1895,8 +1888,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8030735ecb0d128428b64cd379809817e620a40e5001c54465b99ec5feec2857"
dependencies = [
"futures-core",
- "prost",
- "prost-types",
+ "prost 0.13.5",
+ "prost-types 0.13.5",
"tonic 0.12.3",
"tracing-core",
]
@@ -1914,8 +1907,8 @@ dependencies = [
"hdrhistogram",
"humantime",
"hyper-util",
- "prost",
- "prost-types",
+ "prost 0.13.5",
+ "prost-types 0.13.5",
"serde",
"serde_json",
"thread_local",
@@ -2043,6 +2036,7 @@ dependencies = [
[[package]]
name = "crc"
version = "3.3.0"
+<<<<<<< HEAD
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
dependencies = [
@@ -2058,8 +2052,25 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
name = "crc32fast"
version = "1.4.2"
+=======
+>>>>>>> master
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
+checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+
+[[package]]
+name = "crc32fast"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
dependencies = [
"cfg-if",
]
@@ -2305,8 +2316,18 @@ version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
dependencies = [
- "darling_core",
- "darling_macro",
+ "darling_core 0.20.11",
+ "darling_macro 0.20.11",
+]
+
+[[package]]
+name = "darling"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a79c4acb1fd5fa3d9304be4c76e031c54d2e92d172a393e24b19a14fe8532fe9"
+dependencies = [
+ "darling_core 0.21.0",
+ "darling_macro 0.21.0",
]
[[package]]
@@ -2323,13 +2344,38 @@ dependencies = [
"syn 2.0.104",
]
+[[package]]
+name = "darling_core"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74875de90daf30eb59609910b84d4d368103aaec4c924824c6799b28f77d6a1d"
+dependencies = [
+ "fnv",
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim",
+ "syn 2.0.104",
+]
+
[[package]]
name = "darling_macro"
version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [
- "darling_core",
+ "darling_core 0.20.11",
+ "quote",
+ "syn 2.0.104",
+]
+
+[[package]]
+name = "darling_macro"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e79f8e61677d5df9167cd85265f8e5f64b215cdea3fb55eebc3e622e44c7a146"
+dependencies = [
+ "darling_core 0.21.0",
"quote",
"syn 2.0.104",
]
@@ -2437,7 +2483,7 @@ version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"
dependencies = [
- "darling",
+ "darling 0.20.11",
"proc-macro2",
"quote",
"syn 2.0.104",
@@ -2832,7 +2878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27cea6e7f512d43b098939ff4d5a5d6fe3db07971e1d05176fe26c642d33f5b8"
dependencies = [
"getrandom 0.3.3",
- "rand 0.9.1",
+ "rand 0.9.2",
"siphasher",
"wide",
]
@@ -2859,30 +2905,28 @@ dependencies = [
"pear",
"serde",
"serde_json",
- "toml",
+ "toml 0.8.23",
"uncased",
"version_check",
]
[[package]]
name = "file-operation"
-version = "0.5.12"
+version = "0.5.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1b81e9a35a431f57f3304aec4ed6a59c7f1fb82af62b02e18afe197e8e3769d"
+checksum = "db833ed44bb54a24e43acc553147e7d0a8f1111128b261646afd11c28151a79c"
dependencies = [
"tokio",
]
[[package]]
-name = "filetime"
-version = "0.2.25"
+name = "flatbuffers"
+version = "25.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
+checksum = "1045398c1bfd89168b5fd3f1fc11f6e70b34f6f66300c87d44d3de849463abf1"
dependencies = [
- "cfg-if",
- "libc",
- "libredox",
- "windows-sys 0.59.0",
+ "bitflags 2.9.1",
+ "rustc_version",
]
[[package]]
@@ -3672,7 +3716,7 @@ dependencies = [
"parking_lot 0.12.4",
"portable-atomic",
"quanta",
- "rand 0.9.1",
+ "rand 0.9.2",
"smallvec",
"spinning_top",
"web-time",
@@ -3680,9 +3724,9 @@ dependencies = [
[[package]]
name = "h2"
-version = "0.3.26"
+version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
+checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d"
dependencies = [
"bytes",
"fnv",
@@ -3699,9 +3743,9 @@ dependencies = [
[[package]]
name = "h2"
-version = "0.4.10"
+version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5"
+checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785"
dependencies = [
"atomic-waker",
"bytes",
@@ -3965,7 +4009,7 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
- "h2 0.4.10",
+ "h2 0.4.11",
"http 1.3.1",
"http-body",
"httparse",
@@ -3993,7 +4037,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
- "webpki-roots 1.0.1",
+ "webpki-roots 1.0.2",
]
[[package]]
@@ -4011,9 +4055,9 @@ dependencies = [
[[package]]
name = "hyper-util"
-version = "0.1.14"
+version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb"
+checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e"
dependencies = [
"base64 0.22.1",
"bytes",
@@ -4027,7 +4071,11 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
+<<<<<<< HEAD
"socket2 0.5.10",
+=======
+ "socket2 0.6.0",
+>>>>>>> master
"tokio",
"tower-service",
"tracing",
@@ -4197,7 +4245,7 @@ dependencies = [
"tokio-rustls",
"tracing",
"trait-variant",
- "webpki-roots 1.0.1",
+ "webpki-roots 1.0.2",
]
[[package]]
@@ -4218,12 +4266,16 @@ dependencies = [
"iggy",
"integration",
"nonzero_lit",
+<<<<<<< HEAD
"rand 0.9.1",
+=======
+ "rand 0.9.2",
+>>>>>>> master
"rayon",
"serde",
- "sysinfo 0.35.2",
+ "sysinfo 0.36.1",
"tokio",
- "toml",
+ "toml 0.9.2",
"tracing",
"tracing-appender",
"tracing-subscriber",
@@ -4274,7 +4326,27 @@ dependencies = [
"strum",
"thiserror 2.0.12",
"tokio",
- "toml",
+ "toml 0.9.2",
+ "tower-http",
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "iggy-mcp"
+version = "0.1.0"
+dependencies = [
+ "axum 0.8.4",
+ "axum-server",
+ "config",
+ "dotenvy",
+ "figlet-rs",
+ "iggy",
+ "rmcp",
+ "serde",
+ "strum",
+ "thiserror 2.0.12",
+ "tokio",
"tower-http",
"tracing",
"tracing-subscriber",
@@ -4297,7 +4369,7 @@ dependencies = [
"serde",
"serde_json",
"tokio",
- "toml",
+ "toml 0.9.2",
"tracing",
]
@@ -4390,7 +4462,7 @@ dependencies = [
"humantime",
"iggy_connector_sdk",
"once_cell",
- "rand 0.9.1",
+ "rand 0.9.2",
"serde",
"simd-json",
"tokio",
@@ -4410,8 +4482,13 @@ dependencies = [
"iggy",
"once_cell",
"postcard",
+<<<<<<< HEAD
"prost",
"prost-types",
+=======
+ "prost 0.14.1",
+ "prost-types 0.14.1",
+>>>>>>> master
"protox",
"protox-parse",
"regex",
@@ -4450,7 +4527,7 @@ dependencies = [
"clap",
"futures-util",
"iggy",
- "rand 0.9.1",
+ "rand 0.9.2",
"serde",
"serde_json",
"thiserror 2.0.12",
@@ -4605,7 +4682,10 @@ dependencies = [
"libc",
"log",
"predicates",
+ "rand 0.9.2",
"rcgen",
+ "reqwest",
+ "rmcp",
"serial_test",
"server",
"tempfile",
@@ -4627,9 +4707,15 @@ dependencies = [
[[package]]
name = "io-uring"
+<<<<<<< HEAD
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013"
+=======
+version = "0.7.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4"
+>>>>>>> master
dependencies = [
"bitflags 2.9.1",
"cfg-if",
@@ -4637,6 +4723,7 @@ dependencies = [
]
[[package]]
+<<<<<<< HEAD
name = "io_uring_buf_ring"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4648,6 +4735,8 @@ dependencies = [
]
[[package]]
+=======
+>>>>>>> master
name = "ipnet"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4986,13 +5075,28 @@ dependencies = [
[[package]]
name = "libredox"
+<<<<<<< HEAD
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1580801010e535496706ba011c15f8532df6b42297d2e471fec38ceadd8c0638"
+=======
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0"
+>>>>>>> master
dependencies = [
"bitflags 2.9.1",
"libc",
- "redox_syscall 0.5.13",
+]
+
+[[package]]
+name = "libsqlite3-sys"
+version = "0.30.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
+dependencies = [
+ "pkg-config",
+ "vcpkg",
]
[[package]]
@@ -5194,6 +5298,25 @@ dependencies = [
]
[[package]]
+<<<<<<< HEAD
+=======
+name = "md-5"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
+dependencies = [
+ "cfg-if",
+ "digest",
+]
+
+[[package]]
+name = "md5"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
+
+[[package]]
+>>>>>>> master
name = "memchr"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5389,12 +5512,11 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
[[package]]
name = "notify"
-version = "8.0.0"
+version = "8.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943"
+checksum = "3163f59cd3fa0e9ef8c32f242966a7b9994fd7378366099593e0e73077cd8c97"
dependencies = [
"bitflags 2.9.1",
- "filetime",
"fsevent-sys",
"inotify",
"kqueue",
@@ -5403,7 +5525,7 @@ dependencies = [
"mio",
"notify-types",
"walkdir",
- "windows-sys 0.59.0",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -5703,9 +5825,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "openssl-src"
-version = "300.5.0+3.5.0"
+version = "300.5.1+3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8ce546f549326b0e6052b649198487d91320875da901e7bd11a06d1ee3f9c2f"
+checksum = "735230c832b28c000e3bc117119e6466a663ec73506bc0a9907ea4187508e42a"
dependencies = [
"cc",
]
@@ -5774,7 +5896,7 @@ dependencies = [
"opentelemetry-http",
"opentelemetry-proto",
"opentelemetry_sdk",
- "prost",
+ "prost 0.13.5",
"reqwest",
"thiserror 2.0.12",
"tokio",
@@ -5790,7 +5912,7 @@ checksum = "2e046fd7660710fe5a05e8748e70d9058dc15c94ba914e7c4faa7c728f0e8ddc"
dependencies = [
"opentelemetry",
"opentelemetry_sdk",
- "prost",
+ "prost 0.13.5",
"tonic 0.13.1",
]
@@ -5811,7 +5933,7 @@ dependencies = [
"futures-util",
"opentelemetry",
"percent-encoding",
- "rand 0.9.1",
+ "rand 0.9.2",
"serde_json",
"thiserror 2.0.12",
"tokio",
@@ -5899,7 +6021,7 @@ checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall 0.5.13",
+ "redox_syscall 0.5.15",
"smallvec",
"windows-targets 0.52.6",
]
@@ -6201,6 +6323,12 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
+[[package]]
+name = "ppmd-rust"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c834641d8ad1b348c9ee86dec3b9840d805acd5f24daa5f90c788951a52ff59b"
+
[[package]]
name = "ppv-lite86"
version = "0.2.21"
@@ -6362,7 +6490,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5"
dependencies = [
"bytes",
- "prost-derive",
+ "prost-derive 0.13.5",
+]
+
+[[package]]
+name = "prost"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
+dependencies = [
+ "bytes",
+ "prost-derive 0.14.1",
]
[[package]]
@@ -6379,6 +6517,7 @@ dependencies = [
]
[[package]]
+<<<<<<< HEAD
name = "prost-reflect"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6388,6 +6527,30 @@ dependencies = [
"miette",
"prost",
"prost-types",
+=======
+name = "prost-derive"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
+dependencies = [
+ "anyhow",
+ "itertools 0.14.0",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.104",
+]
+
+[[package]]
+name = "prost-reflect"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e6b545c556471033fc1099868fca468bff8cf034f7bb9153b445f24d00aa28d"
+dependencies = [
+ "logos",
+ "miette",
+ "prost 0.14.1",
+ "prost-types 0.14.1",
+>>>>>>> master
]
[[package]]
@@ -6396,7 +6559,43 @@ version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16"
dependencies = [
- "prost",
+ "prost 0.13.5",
+]
+
+[[package]]
+name = "prost-types"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72"
+dependencies = [
+ "prost 0.14.1",
+]
+
+[[package]]
+name = "protox"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8555716f64c546306ddf3383065dc40d4232609e79e0a4c50e94e87d54f30fb4"
+dependencies = [
+ "bytes",
+ "miette",
+ "prost 0.14.1",
+ "prost-reflect",
+ "prost-types 0.14.1",
+ "protox-parse",
+ "thiserror 2.0.12",
+]
+
+[[package]]
+name = "protox-parse"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366"
+dependencies = [
+ "logos",
+ "miette",
+ "prost-types 0.14.1",
+ "thiserror 2.0.12",
]
[[package]]
@@ -6501,7 +6700,7 @@ dependencies = [
"fastbloom",
"getrandom 0.3.3",
"lru-slab",
- "rand 0.9.1",
+ "rand 0.9.2",
"ring",
"rustc-hash 2.1.1",
"rustls",
@@ -6562,9 +6761,9 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.9.1"
+version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
+checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.3",
@@ -6639,9 +6838,9 @@ dependencies = [
[[package]]
name = "rcgen"
-version = "0.13.2"
+version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75e669e5202259b5314d1ea5397316ad400819437857b90861765f24c4cf80a2"
+checksum = "0068c5b3cab1d4e271e0bb6539c87563c43411cad90b057b15c79958fbeb41f7"
dependencies = [
"pem",
"ring",
@@ -6661,9 +6860,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.5.13"
+version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
+checksum = "7e8af0dde094006011e6a740d4879319439489813bd0bcdc7d821beaeeff48ec"
dependencies = [
"bitflags 2.9.1",
]
@@ -6766,9 +6965,9 @@ dependencies = [
[[package]]
name = "reqwest"
-version = "0.12.20"
+version = "0.12.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813"
+checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531"
dependencies = [
"base64 0.22.1",
"bytes",
@@ -6801,7 +7000,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "webpki-roots 1.0.1",
+ "webpki-roots 1.0.2",
]
[[package]]
@@ -6893,6 +7092,51 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "rmcp"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b008b927a85d514699ff304be84c5084598596e6cad4a6f5bc67207715fafe5f"
+dependencies = [
+ "axum 0.8.4",
+ "base64 0.22.1",
+ "bytes",
+ "chrono",
+ "futures",
+ "http 1.3.1",
+ "http-body",
+ "http-body-util",
+ "paste",
+ "pin-project-lite",
+ "rand 0.9.2",
+ "reqwest",
+ "rmcp-macros",
+ "schemars 1.0.4",
+ "serde",
+ "serde_json",
+ "sse-stream",
+ "thiserror 2.0.12",
+ "tokio",
+ "tokio-stream",
+ "tokio-util",
+ "tower-service",
+ "tracing",
+ "uuid",
+]
+
+[[package]]
+name = "rmcp-macros"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7465280d5f73f2c5c99017a04af407b2262455a149f255ad22f2b0b29087695c"
+dependencies = [
+ "darling 0.21.0",
+ "proc-macro2",
+ "quote",
+ "serde_json",
+ "syn 2.0.104",
+]
+
[[package]]
name = "ron"
version = "0.8.1"
@@ -6914,6 +7158,7 @@ checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746"
[[package]]
name = "rsa"
version = "0.9.8"
+<<<<<<< HEAD
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b"
dependencies = [
@@ -6934,12 +7179,33 @@ dependencies = [
[[package]]
name = "rust-ini"
version = "0.21.1"
+=======
+>>>>>>> master
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b"
+dependencies = [
+ "const-oid",
+ "digest",
+ "num-bigint-dig",
+ "num-integer",
+ "num-traits",
+ "pkcs1",
+ "pkcs8",
+ "rand_core 0.6.4",
+ "signature",
+ "spki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rust-ini"
+version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e310ef0e1b6eeb79169a1171daf9abcb87a2e17c03bee2c4bb100b55c75409f"
+checksum = "e7295b7ce3bf4806b419dc3420745998b447178b7005e2011947b38fc5aa6791"
dependencies = [
"cfg-if",
"ordered-multimap",
- "trim-in-place",
]
[[package]]
@@ -7000,22 +7266,22 @@ dependencies = [
[[package]]
name = "rustix"
-version = "1.0.7"
+version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
+checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
dependencies = [
"bitflags 2.9.1",
"errno",
"libc",
"linux-raw-sys 0.9.4",
- "windows-sys 0.59.0",
+ "windows-sys 0.60.2",
]
[[package]]
name = "rustls"
-version = "0.23.28"
+version = "0.23.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7160e3e10bf4535308537f3c4e1641468cd0e485175d6163087c0393c7d46643"
+checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1"
dependencies = [
"aws-lc-rs",
"log",
@@ -7108,9 +7374,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
[[package]]
name = "rustls-webpki"
-version = "0.103.3"
+version = "0.103.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435"
+checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc"
dependencies = [
"aws-lc-rs",
"ring",
@@ -7197,6 +7463,32 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "schemars"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
+dependencies = [
+ "chrono",
+ "dyn-clone",
+ "ref-cast",
+ "schemars_derive",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "schemars_derive"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "serde_derive_internals",
+ "syn 2.0.104",
+]
+
[[package]]
name = "scoped-tls"
version = "1.0.1"
@@ -7211,9 +7503,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sdd"
-version = "3.0.8"
+version = "3.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "584e070911c7017da6cb2eb0788d09f43d789029b5877d3e5ecc8acf86ceee21"
+checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca"
[[package]]
name = "seahash"
@@ -7325,11 +7617,22 @@ dependencies = [
"syn 2.0.104",
]
+[[package]]
+name = "serde_derive_internals"
+version = "0.29.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.104",
+]
+
[[package]]
name = "serde_json"
-version = "1.0.140"
+version = "1.0.141"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
+checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
dependencies = [
"itoa",
"memchr",
@@ -7356,6 +7659,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "serde_spanned"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@@ -7370,16 +7682,21 @@ dependencies = [
[[package]]
name = "serde_with"
-version = "3.13.0"
+version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf65a400f8f66fb7b0552869ad70157166676db75ed8181f8104ea91cf9d0b42"
+checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5"
dependencies = [
"base64 0.22.1",
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.10.0",
+<<<<<<< HEAD
"schemars",
+=======
+ "schemars 0.9.0",
+ "schemars 1.0.4",
+>>>>>>> master
"serde",
"serde_derive",
"serde_json",
@@ -7389,11 +7706,11 @@ dependencies = [
[[package]]
name = "serde_with_macros"
-version = "3.13.0"
+version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81679d9ed988d5e9a5e6531dc3f2c28efbd639cbd1dfb628df08edea6004da77"
+checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f"
dependencies = [
- "darling",
+ "darling 0.20.11",
"proc-macro2",
"quote",
"syn 2.0.104",
@@ -7498,13 +7815,13 @@ dependencies = [
"socket2 0.5.10",
"static-toml",
"strum",
- "sysinfo 0.35.2",
+ "sysinfo 0.36.1",
"tempfile",
"thiserror 2.0.12",
"tokio",
"tokio-rustls",
"tokio-util",
- "toml",
+ "toml 0.9.2",
"tower-http",
"tracing",
"tracing-appender",
@@ -7926,6 +8243,22 @@ dependencies = [
]
[[package]]
+<<<<<<< HEAD
+=======
+name = "sse-stream"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb4dc4d33c68ec1f27d386b5610a351922656e1fdf5c05bbaad930cd1519479a"
+dependencies = [
+ "bytes",
+ "futures-util",
+ "http-body",
+ "http-body-util",
+ "pin-project-lite",
+]
+
+[[package]]
+>>>>>>> master
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -7942,7 +8275,18 @@ dependencies = [
"proc-macro2",
"quote",
"syn 2.0.104",
- "toml",
+ "toml 0.8.23",
+]
+
+[[package]]
+name = "stringprep"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+ "unicode-properties",
]
[[package]]
@@ -7964,23 +8308,22 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
-version = "0.27.1"
+version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32"
+checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
-version = "0.27.1"
+version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
+checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
- "rustversion",
"syn 2.0.104",
]
@@ -8080,9 +8423,9 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.35.2"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c3ffa3e4ff2b324a57f7aeb3c349656c7b127c3c189520251a648102a92496e"
+checksum = "252800745060e7b9ffb7b2badbd8b31cfa4aa2e61af879d0a3bf2a317c20217d"
dependencies = [
"libc",
"memchr",
@@ -8113,7 +8456,7 @@ dependencies = [
"fastrand",
"getrandom 0.3.3",
"once_cell",
- "rustix 1.0.7",
+ "rustix 1.0.8",
"windows-sys 0.59.0",
]
@@ -8123,7 +8466,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed"
dependencies = [
- "rustix 1.0.7",
+ "rustix 1.0.8",
"windows-sys 0.59.0",
]
@@ -8295,17 +8638,22 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.45.1"
+version = "1.46.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
+checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17"
dependencies = [
"backtrace",
"bytes",
+ "io-uring",
"libc",
"mio",
"parking_lot 0.12.4",
"pin-project-lite",
"signal-hook-registry",
+<<<<<<< HEAD
+=======
+ "slab",
+>>>>>>> master
"socket2 0.5.10",
"tokio-macros",
"tracing",
@@ -8365,11 +8713,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
dependencies = [
"serde",
- "serde_spanned",
- "toml_datetime",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.6.11",
"toml_edit 0.22.27",
]
+[[package]]
+name = "toml"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac"
+dependencies = [
+ "indexmap 2.10.0",
+ "serde",
+ "serde_spanned 1.0.0",
+ "toml_datetime 0.7.0",
+ "toml_parser",
+ "toml_writer",
+ "winnow 0.7.12",
+]
+
[[package]]
name = "toml_datetime"
version = "0.6.11"
@@ -8379,6 +8742,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "toml_datetime"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "toml_edit"
version = "0.19.15"
@@ -8386,7 +8758,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.10.0",
+<<<<<<< HEAD
"toml_datetime",
+=======
+ "toml_datetime 0.6.11",
+>>>>>>> master
"winnow 0.5.40",
]
@@ -8398,10 +8774,19 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap 2.10.0",
"serde",
- "serde_spanned",
- "toml_datetime",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.6.11",
"toml_write",
- "winnow 0.7.11",
+ "winnow 0.7.12",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30"
+dependencies = [
+ "winnow 0.7.12",
]
[[package]]
@@ -8410,6 +8795,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
+[[package]]
+name = "toml_writer"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64"
+
[[package]]
name = "tonic"
version = "0.12.3"
@@ -8421,7 +8812,7 @@ dependencies = [
"axum 0.7.9",
"base64 0.22.1",
"bytes",
- "h2 0.4.10",
+ "h2 0.4.11",
"http 1.3.1",
"http-body",
"http-body-util",
@@ -8430,7 +8821,11 @@ dependencies = [
"hyper-util",
"percent-encoding",
"pin-project",
+<<<<<<< HEAD
"prost",
+=======
+ "prost 0.13.5",
+>>>>>>> master
"socket2 0.5.10",
"tokio",
"tokio-stream",
@@ -8457,7 +8852,7 @@ dependencies = [
"hyper-util",
"percent-encoding",
"pin-project",
- "prost",
+ "prost 0.13.5",
"tokio",
"tokio-stream",
"tower 0.5.2",
@@ -8473,7 +8868,7 @@ dependencies = [
"anyhow",
"clap",
"iggy",
- "rand 0.9.1",
+ "rand 0.9.2",
"tokio",
"tracing",
"tracing-subscriber",
@@ -8652,12 +9047,6 @@ dependencies = [
"syn 2.0.104",
]
-[[package]]
-name = "trim-in-place"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc"
-
[[package]]
name = "try-lock"
version = "0.2.5"
@@ -8670,7 +9059,7 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"
dependencies = [
- "rand 0.9.1",
+ "rand 0.9.2",
]
[[package]]
@@ -8711,7 +9100,7 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe"
dependencies = [
- "rand 0.9.1",
+ "rand 0.9.2",
"web-time",
]
@@ -8853,7 +9242,7 @@ checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
dependencies = [
"getrandom 0.3.3",
"js-sys",
- "rand 0.9.1",
+ "rand 0.9.2",
"serde",
"wasm-bindgen",
"zerocopy",
@@ -9106,14 +9495,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75c7f0ef91146ebfb530314f5f1d24528d7f0767efbfd31dce919275413e393e"
dependencies = [
- "webpki-root-certs 1.0.1",
+ "webpki-root-certs 1.0.2",
]
[[package]]
name = "webpki-root-certs"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86138b15b2b7d561bc4469e77027b8dd005a43dc502e9031d1f5afc8ce1f280e"
+checksum = "4e4ffd8df1c57e87c325000a3d6ef93db75279dc3a231125aac571650f22b12a"
dependencies = [
"rustls-pki-types",
]
@@ -9124,14 +9513,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.1",
+ "webpki-roots 1.0.2",
]
[[package]]
name = "webpki-roots"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8782dd5a41a24eed3a4f40b606249b3e236ca61adf1f25ea4d45c73de122b502"
+checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2"
dependencies = [
"rustls-pki-types",
]
@@ -9154,7 +9543,11 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7"
dependencies = [
+<<<<<<< HEAD
"redox_syscall 0.5.13",
+=======
+ "redox_syscall 0.5.15",
+>>>>>>> master
"wasite",
]
@@ -9667,9 +10060,9 @@ dependencies = [
[[package]]
name = "winnow"
-version = "0.7.11"
+version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
+checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
dependencies = [
"memchr",
]
@@ -9930,13 +10323,13 @@ dependencies = [
[[package]]
name = "zip"
-version = "4.2.0"
+version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95ab361742de920c5535880f89bbd611ee62002bf11341d16a5f057bb8ba6899"
+checksum = "9aed4ac33e8eb078c89e6cbb1d5c4c7703ec6d299fc3e7c3695af8f8b423468b"
dependencies = [
"aes",
"arbitrary",
- "bzip2 0.5.2",
+ "bzip2",
"constant_time_eq",
"crc32fast",
"deflate64",
@@ -9947,6 +10340,7 @@ dependencies = [
"liblzma",
"memchr",
"pbkdf2",
+ "ppmd-rust",
"sha1",
"time",
"zeroize",
diff --git a/Cargo.toml b/Cargo.toml
index 1faea63f..38d3a6e0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,6 +22,7 @@ codegen-units = 1
[workspace]
members = [
"bdd/rust",
+ "core/ai/mcp",
"core/bench",
"core/bench/dashboard/frontend",
"core/bench/dashboard/server",
@@ -34,9 +35,11 @@ members = [
"core/connectors/runtime",
"core/connectors/sdk",
"core/connectors/sinks/postgres_sink",
+ "core/connectors/sinks/postgres_sink",
"core/connectors/sinks/quickwit_sink",
"core/connectors/sinks/stdout_sink",
"core/connectors/sources/postgres_source",
+ "core/connectors/sources/postgres_source",
"core/connectors/sources/random_source",
"core/integration",
"core/sdk",
@@ -66,7 +69,7 @@ axum-server = { version = "0.7.2", features = ["tls-rustls"] }
bcrypt = "0.17.0"
bincode = { version = "2.0.1", features = ["serde"] }
blake3 = "1.8.2"
-bon = "3.6.4"
+bon = "3.6.5"
byte-unit = { version = "5.1.6", default-features = false, features = [
"serde",
"byte",
@@ -75,10 +78,10 @@ byte-unit = { version = "5.1.6", default-features = false, features = [
bytes = "1.10.1"
charming = "0.6.0"
chrono = { version = "0.4.41", features = ["serde"] }
-clap = { version = "4.5.40", features = ["derive"] }
-config = { version = "0.15.11" }
+clap = { version = "4.5.41", features = ["derive"] }
+config = { version = "0.15.13" }
comfy-table = "7.1.4"
-crc32fast = "1.4.2"
+crc32fast = "1.5.0"
crossbeam = "0.8.4"
dashmap = "6.1.0"
derive_builder = "0.20.2"
@@ -87,6 +90,7 @@ derive-new = "0.7.0"
dirs = "6.0.0"
dlopen2 = "0.8.0"
dotenvy = "0.15.7"
+dotenvy = "0.15.7"
enum_dispatch = "0.3.13"
figlet-rs = "0.1.5"
flume = "0.11.1"
@@ -100,29 +104,30 @@ nonzero_lit = "0.1.2"
once_cell = "1.21.3"
passterm = "=2.0.1"
quinn = "0.11.8"
-postcard = { version = "1.1.1", features = ["alloc"] }
-rand = "0.9.1"
-reqwest = { version = "0.12.20", default-features = false, features = [
+postcard = { version = "1.1.2", features = ["alloc"] }
+rand = "0.9.2"
+reqwest = { version = "0.12.22", default-features = false, features = [
"json",
"rustls-tls",
] }
reqwest-middleware = { version = "0.4.2", features = ["json"] }
reqwest-retry = "0.7.0"
-rustls = { version = "0.23.28", features = ["ring"] }
+rustls = { version = "0.23.29", features = ["ring"] }
serde = { version = "1.0.219", features = ["derive", "rc"] }
-serde_json = "1.0.140"
-serde_with = { version = "3.13.0", features = ["base64", "macros"] }
+serde_json = "1.0.141"
+serde_with = { version = "3.14.0", features = ["base64", "macros"] }
serde_yml = "0.0.12"
serial_test = "3.2.0"
simd-json = { version = "0.15.1", features = ["serde_impl"] }
-sysinfo = "0.35.2"
+sysinfo = "0.36.1"
tempfile = "3.20.0"
thiserror = "2.0.12"
tokio = { version = "1.45.1", features = ["full"] }
compio = { git = "https://github.com/compio-rs/compio.git", rev = "fe4243f0b6811ebc325afd081c9b087b4d9817be", features = ["runtime", "macros", "io-uring", "time", "rustls"] }
cyper = { version = "0.4.0", features = ["rustls"], default-features = false}
+tokio = { version = "1.46.1", features = ["full"] }
tokio-rustls = "0.26.2"
-toml = "0.8.23"
+toml = "0.9.2"
tracing = "0.1.41"
tracing-appender = "0.2.3"
tracing-subscriber = { version = "0.3.19", default-features = false, features = [
@@ -141,8 +146,8 @@ rust-s3 = { version = "0.36.0-beta.2", default-features = false, features = [
"tokio-rustls-tls",
"tags",
] }
-strum = { version = "0.27.1", features = ["derive"] }
-strum_macros = "0.27.1"
+strum = { version = "0.27.2", features = ["derive"] }
+strum_macros = "0.27.2"
aes-gcm = "0.10.3"
base64 = "0.22.1"
twox-hash = { version = "2.1.1", features = ["xxhash32"] }
@@ -163,8 +168,8 @@ tower-http = { version = "0.6.6", features = [
"trace",
] }
trait-variant = "0.1.2"
-webpki-roots = "1.0.1"
-zip = "4.2.0"
+webpki-roots = "1.0.2"
+zip = "4.3.0"
# Optional dependencies
mimalloc = "0.1"
diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md
index 85fb16c9..0f943481 100644
--- a/DEPENDENCIES.md
+++ b/DEPENDENCIES.md
@@ -39,7 +39,7 @@ arrayref: 0.3.9, "BSD-2-Clause",
arrayvec: 0.7.6, "Apache-2.0 OR MIT",
assert_cmd: 2.0.17, "Apache-2.0 OR MIT",
async-broadcast: 0.7.2, "Apache-2.0 OR MIT",
-async-compression: 0.4.25, "Apache-2.0 OR MIT",
+async-compression: 0.4.27, "Apache-2.0 OR MIT",
async-dropper: 0.3.1, "MIT",
async-dropper-derive: 0.3.1, "MIT",
async-dropper-simple: 0.2.6, "MIT",
@@ -50,14 +50,15 @@ async-stream-impl: 0.3.6, "MIT",
async-trait: 0.1.88, "Apache-2.0 OR MIT",
async_zip: 0.0.17, "MIT",
atoi: 2.0.0, "MIT",
+atoi: 2.0.0, "MIT",
atomic: 0.6.1, "Apache-2.0 OR MIT",
atomic-polyfill: 1.0.3, "Apache-2.0 OR MIT",
atomic-waker: 1.1.2, "Apache-2.0 OR MIT",
attohttpc: 0.28.5, "MPL-2.0",
autocfg: 1.5.0, "Apache-2.0 OR MIT",
aws-creds: 0.38.0, "MIT",
-aws-lc-rs: 1.13.1, "ISC AND (Apache-2.0 OR ISC)",
-aws-lc-sys: 0.29.0, "ISC AND (Apache-2.0 OR ISC) AND OpenSSL",
+aws-lc-rs: 1.13.3, "ISC AND (Apache-2.0 OR ISC)",
+aws-lc-sys: 0.30.0, "ISC AND (Apache-2.0 OR ISC) AND OpenSSL",
aws-region: 0.26.0, "MIT",
axum: 0.7.9, "MIT",
axum: 0.8.4, "MIT",
@@ -68,9 +69,11 @@ backtrace: 0.3.75, "Apache-2.0 OR MIT",
base64: 0.21.7, "Apache-2.0 OR MIT",
base64: 0.22.1, "Apache-2.0 OR MIT",
base64ct: 1.8.0, "Apache-2.0 OR MIT",
+base64ct: 1.8.0, "Apache-2.0 OR MIT",
bcrypt: 0.17.0, "MIT",
bdd: 0.0.1, "Apache-2.0",
beef: 0.5.2, "Apache-2.0 OR MIT",
+beef: 0.5.2, "Apache-2.0 OR MIT",
bench-dashboard-frontend: 0.4.1, "Apache-2.0",
bench-dashboard-server: 0.4.0, "Apache-2.0",
bench-dashboard-shared: 0.1.0, "Apache-2.0",
@@ -86,15 +89,15 @@ bitvec: 1.0.1, "MIT",
blake3: 1.8.2, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR CC0-1.0",
block-buffer: 0.10.4, "Apache-2.0 OR MIT",
blowfish: 0.9.1, "Apache-2.0 OR MIT",
-bon: 3.6.4, "Apache-2.0 OR MIT",
-bon-macros: 3.6.4, "Apache-2.0 OR MIT",
+bon: 3.6.5, "Apache-2.0 OR MIT",
+bon-macros: 3.6.5, "Apache-2.0 OR MIT",
boolinator: 2.4.0, "Apache-2.0 OR MIT",
borsh: 1.5.7, "Apache-2.0 OR MIT",
borsh-derive: 1.5.7, "Apache-2.0",
brotli: 8.0.1, "BSD-3-Clause AND MIT",
brotli-decompressor: 5.0.0, "BSD-3-Clause OR MIT",
bstr: 1.12.0, "Apache-2.0 OR MIT",
-bumpalo: 3.18.1, "Apache-2.0 OR MIT",
+bumpalo: 3.19.0, "Apache-2.0 OR MIT",
byte-unit: 5.1.6, "MIT",
bytecheck: 0.6.12, "MIT",
bytecheck_derive: 0.6.12, "MIT",
@@ -103,14 +106,12 @@ bytemuck: 1.23.1, "Apache-2.0 OR MIT OR Zlib",
byteorder: 1.5.0, "MIT OR Unlicense",
bytes: 1.10.1, "MIT",
bytestring: 1.4.0, "Apache-2.0 OR MIT",
-bzip2: 0.5.2, "Apache-2.0 OR MIT",
bzip2: 0.6.0, "Apache-2.0 OR MIT",
-bzip2-sys: 0.1.13+1.0.8, "Apache-2.0 OR MIT",
camino: 1.1.10, "Apache-2.0 OR MIT",
cargo-platform: 0.1.9, "Apache-2.0 OR MIT",
cargo_metadata: 0.19.2, "MIT",
-castaway: 0.2.3, "MIT",
-cc: 1.2.27, "Apache-2.0 OR MIT",
+castaway: 0.2.4, "MIT",
+cc: 1.2.30, "Apache-2.0 OR MIT",
cesu8: 1.1.0, "Apache-2.0 OR MIT",
cexpr: 0.6.0, "Apache-2.0 OR MIT",
cfg-if: 1.0.1, "Apache-2.0 OR MIT",
@@ -120,25 +121,26 @@ charming_macros: 0.1.0, "Apache-2.0 OR MIT",
chrono: 0.4.41, "Apache-2.0 OR MIT",
cipher: 0.4.4, "Apache-2.0 OR MIT",
clang-sys: 1.8.1, "Apache-2.0",
-clap: 4.5.40, "Apache-2.0 OR MIT",
-clap_builder: 4.5.40, "Apache-2.0 OR MIT",
-clap_complete: 4.5.54, "Apache-2.0 OR MIT",
-clap_derive: 4.5.40, "Apache-2.0 OR MIT",
+clap: 4.5.41, "Apache-2.0 OR MIT",
+clap_builder: 4.5.41, "Apache-2.0 OR MIT",
+clap_complete: 4.5.55, "Apache-2.0 OR MIT",
+clap_derive: 4.5.41, "Apache-2.0 OR MIT",
clap_lex: 0.7.5, "Apache-2.0 OR MIT",
cmake: 0.1.54, "Apache-2.0 OR MIT",
-cobs: 0.2.3, "Apache-2.0 OR MIT",
+cobs: 0.3.0, "Apache-2.0 OR MIT",
colorchoice: 1.0.4, "Apache-2.0 OR MIT",
colored: 3.0.0, "MPL-2.0",
combine: 4.6.7, "MIT",
comfy-table: 7.1.4, "MIT",
compact_str: 0.7.1, "MIT",
concurrent-queue: 2.5.0, "Apache-2.0 OR MIT",
-config: 0.15.11, "Apache-2.0 OR MIT",
+config: 0.15.13, "Apache-2.0 OR MIT",
console: 0.15.11, "MIT",
console-api: 0.8.1, "MIT",
console-subscriber: 0.4.1, "MIT",
console_error_panic_hook: 0.1.7, "Apache-2.0 OR MIT",
const-oid: 0.9.6, "Apache-2.0 OR MIT",
+const-oid: 0.9.6, "Apache-2.0 OR MIT",
const-random: 0.1.18, "Apache-2.0 OR MIT",
const-random-macro: 0.1.16, "Apache-2.0 OR MIT",
constant_time_eq: 0.3.1, "Apache-2.0 OR CC0-1.0 OR MIT-0",
@@ -152,6 +154,9 @@ cpufeatures: 0.2.17, "Apache-2.0 OR MIT",
crc: 3.3.0, "Apache-2.0 OR MIT",
crc-catalog: 2.4.0, "Apache-2.0 OR MIT",
crc32fast: 1.4.2, "Apache-2.0 OR MIT",
+crc: 3.3.0, "Apache-2.0 OR MIT",
+crc-catalog: 2.4.0, "Apache-2.0 OR MIT",
+crc32fast: 1.5.0, "Apache-2.0 OR MIT",
critical-section: 1.2.0, "Apache-2.0 OR MIT",
crossbeam: 0.8.4, "Apache-2.0 OR MIT",
crossbeam-channel: 0.5.15, "Apache-2.0 OR MIT",
@@ -161,7 +166,7 @@ crossbeam-queue: 0.3.12, "Apache-2.0 OR MIT",
crossbeam-utils: 0.8.21, "Apache-2.0 OR MIT",
crossterm: 0.28.1, "MIT",
crossterm_winapi: 0.9.1, "MIT",
-crunchy: 0.2.3, "MIT",
+crunchy: 0.2.4, "MIT",
crypto-common: 0.1.6, "Apache-2.0 OR MIT",
ctor: 0.4.2, "Apache-2.0 OR MIT",
ctor-proc-macro: 0.0.5, "Apache-2.0 OR MIT",
@@ -170,13 +175,17 @@ cucumber: 0.21.1, "Apache-2.0 OR MIT",
cucumber-codegen: 0.21.1, "Apache-2.0 OR MIT",
cucumber-expressions: 0.3.0, "Apache-2.0 OR MIT",
darling: 0.20.11, "MIT",
+darling: 0.21.0, "MIT",
darling_core: 0.20.11, "MIT",
+darling_core: 0.21.0, "MIT",
darling_macro: 0.20.11, "MIT",
+darling_macro: 0.21.0, "MIT",
dashmap: 6.1.0, "MIT",
dbus: 0.9.7, "Apache-2.0 OR MIT",
dbus-secret-service: 4.0.3, "Apache-2.0 OR MIT",
deflate64: 0.1.9, "MIT",
der: 0.7.10, "Apache-2.0 OR MIT",
+der: 0.7.10, "Apache-2.0 OR MIT",
deranged: 0.4.0, "Apache-2.0 OR MIT",
derive-new: 0.7.0, "MIT",
derive_arbitrary: 1.4.1, "Apache-2.0 OR MIT",
@@ -218,6 +227,7 @@ errno: 0.3.13, "Apache-2.0 OR MIT",
error_set: 0.8.5, "Apache-2.0",
error_set_impl: 0.8.5, "Apache-2.0",
etcetera: 0.8.0, "Apache-2.0 OR MIT",
+etcetera: 0.8.0, "Apache-2.0 OR MIT",
event-listener: 5.4.0, "Apache-2.0 OR MIT",
event-listener-strategy: 0.5.4, "Apache-2.0 OR MIT",
ext-trait: 1.0.1, "Apache-2.0 OR MIT OR Zlib",
@@ -228,6 +238,8 @@ fastbloom: 0.9.0, "Apache-2.0 OR MIT",
fastrand: 2.3.0, "Apache-2.0 OR MIT",
figlet-rs: 0.1.5, "Apache-2.0",
figment: 0.10.19, "Apache-2.0 OR MIT",
+file-operation: 0.5.16, "MIT",
+flatbuffers: 25.2.10, "Apache-2.0",
file-operation: 0.5.12, "MIT",
filetime: 0.2.25, "Apache-2.0 OR MIT",
flatbuffers: 24.12.23, "Apache-2.0",
@@ -249,6 +261,7 @@ futures-channel: 0.3.31, "Apache-2.0 OR MIT",
futures-core: 0.3.31, "Apache-2.0 OR MIT",
futures-executor: 0.3.31, "Apache-2.0 OR MIT",
futures-intrusive: 0.5.0, "Apache-2.0 OR MIT",
+futures-intrusive: 0.5.0, "Apache-2.0 OR MIT",
futures-io: 0.3.31, "Apache-2.0 OR MIT",
futures-lite: 2.6.0, "Apache-2.0 OR MIT",
futures-macro: 0.3.31, "Apache-2.0 OR MIT",
@@ -296,8 +309,8 @@ gloo-worker: 0.4.0, "Apache-2.0 OR MIT",
gloo-worker: 0.5.0, "Apache-2.0 OR MIT",
gloo-worker-macros: 0.1.0, "Apache-2.0 OR MIT",
governor: 0.10.0, "MIT",
-h2: 0.3.26, "MIT",
-h2: 0.4.10, "MIT",
+h2: 0.3.27, "MIT",
+h2: 0.4.11, "MIT",
halfbrown: 0.3.0, "Apache-2.0 OR MIT",
handlebars: 6.3.2, "MIT",
hash32: 0.2.1, "Apache-2.0 OR MIT",
@@ -312,6 +325,7 @@ heck: 0.5.0, "Apache-2.0 OR MIT",
hermit-abi: 0.5.2, "Apache-2.0 OR MIT",
hex: 0.4.3, "Apache-2.0 OR MIT",
hkdf: 0.12.4, "Apache-2.0 OR MIT",
+hkdf: 0.12.4, "Apache-2.0 OR MIT",
hmac: 0.12.1, "Apache-2.0 OR MIT",
home: 0.5.11, "Apache-2.0 OR MIT",
hostname: 0.4.1, "MIT",
@@ -327,7 +341,7 @@ humantime: 2.2.0, "Apache-2.0 OR MIT",
hyper: 1.6.0, "MIT",
hyper-rustls: 0.27.7, "Apache-2.0 OR ISC OR MIT",
hyper-timeout: 0.5.2, "Apache-2.0 OR MIT",
-hyper-util: 0.1.14, "MIT",
+hyper-util: 0.1.16, "MIT",
iana-time-zone: 0.1.63, "Apache-2.0 OR MIT",
iana-time-zone-haiku: 0.1.2, "Apache-2.0 OR MIT",
icu_collections: 2.0.0, "Unicode-3.0",
@@ -344,10 +358,13 @@ iggy: 0.7.0, "Apache-2.0",
iggy-bench: 0.2.4, "Apache-2.0",
iggy-cli: 0.9.0, "Apache-2.0",
iggy-connectors: 0.1.0, "Apache-2.0",
+iggy-mcp: 0.1.0, "N/A",
iggy_binary_protocol: 0.7.0, "Apache-2.0",
iggy_common: 0.7.0, "Apache-2.0",
iggy_connector_postgres_sink: 0.1.0, "Apache-2.0",
iggy_connector_postgres_source: 0.1.0, "Apache-2.0",
+iggy_connector_postgres_sink: 0.1.0, "Apache-2.0",
+iggy_connector_postgres_source: 0.1.0, "Apache-2.0",
iggy_connector_quickwit_sink: 0.1.0, "Apache-2.0",
iggy_connector_random_source: 0.1.0, "Apache-2.0",
iggy_connector_sdk: 0.1.0, "Apache-2.0",
@@ -358,7 +375,7 @@ impl-more: 0.1.9, "Apache-2.0 OR MIT",
implicit-clone: 0.4.9, "Apache-2.0 OR MIT",
implicit-clone-derive: 0.1.2, "Apache-2.0 OR MIT",
indexmap: 1.9.3, "Apache-2.0 OR MIT",
-indexmap: 2.9.0, "Apache-2.0 OR MIT",
+indexmap: 2.10.0, "Apache-2.0 OR MIT",
indices: 0.3.6, "Apache-2.0",
inflections: 1.1.1, "MIT",
inlinable_string: 0.1.15, "Apache-2.0 OR MIT",
@@ -368,6 +385,7 @@ inout: 0.1.4, "Apache-2.0 OR MIT",
instant: 0.1.13, "BSD-3-Clause",
integration: 0.0.1, "Apache-2.0",
inventory: 0.3.20, "Apache-2.0 OR MIT",
+io-uring: 0.7.9, "Apache-2.0 OR MIT",
ipnet: 2.11.0, "Apache-2.0 OR MIT",
iri-string: 0.7.8, "Apache-2.0 OR MIT",
is_terminal_polyfill: 1.70.1, "Apache-2.0 OR MIT",
@@ -402,7 +420,10 @@ libloading: 0.8.8, "ISC",
liblzma: 0.4.2, "Apache-2.0 OR MIT",
liblzma-sys: 0.4.4, "Apache-2.0 OR MIT",
libm: 0.2.15, "MIT",
+libm: 0.2.15, "MIT",
libmimalloc-sys: 0.1.43, "MIT",
+libredox: 0.1.6, "MIT",
+libsqlite3-sys: 0.30.1, "MIT",
libredox: 0.1.3, "MIT",
libsqlite3-sys: 0.30.1, "MIT",
libyml: 0.0.5, "MIT",
@@ -419,6 +440,9 @@ log: 0.4.27, "Apache-2.0 OR MIT",
logos: 0.15.0, "Apache-2.0 OR MIT",
logos-codegen: 0.15.0, "Apache-2.0 OR MIT",
logos-derive: 0.15.0, "Apache-2.0 OR MIT",
+logos: 0.15.0, "Apache-2.0 OR MIT",
+logos-codegen: 0.15.0, "Apache-2.0 OR MIT",
+logos-derive: 0.15.0, "Apache-2.0 OR MIT",
loom: 0.7.2, "MIT",
lru-slab: 0.1.2, "Apache-2.0 OR MIT OR Zlib",
macro_rules_attribute: 0.1.3, "MIT",
@@ -428,10 +452,13 @@ matchit: 0.7.3, "MIT AND BSD-3-Clause",
matchit: 0.8.4, "MIT AND BSD-3-Clause",
maybe-async: 0.2.10, "MIT",
md-5: 0.10.6, "Apache-2.0 OR MIT",
+md-5: 0.10.6, "Apache-2.0 OR MIT",
md5: 0.7.0, "Apache-2.0 OR MIT",
memchr: 2.7.5, "MIT OR Unlicense",
miette: 7.6.0, "Apache-2.0",
miette-derive: 7.6.0, "Apache-2.0",
+miette: 7.6.0, "Apache-2.0",
+miette-derive: 7.6.0, "Apache-2.0",
mimalloc: 0.1.47, "MIT",
mime: 0.3.17, "Apache-2.0 OR MIT",
mime_guess: 2.0.5, "MIT",
@@ -450,7 +477,7 @@ nom_locate: 4.2.0, "MIT",
nonzero_ext: 0.3.0, "Apache-2.0",
nonzero_lit: 0.1.2, "Apache-2.0 OR CC0-1.0 OR MIT",
normalize-line-endings: 0.3.0, "Apache-2.0",
-notify: 8.0.0, "CC0-1.0",
+notify: 8.1.0, "CC0-1.0",
notify-types: 2.0.0, "Apache-2.0 OR MIT",
nougat: 0.2.4, "Apache-2.0 OR MIT OR Zlib",
nougat-proc_macros: 0.2.4, "Apache-2.0 OR MIT OR Zlib",
@@ -459,6 +486,7 @@ nu-ansi-term: 0.46.0, "MIT",
num: 0.4.3, "Apache-2.0 OR MIT",
num-bigint: 0.4.6, "Apache-2.0 OR MIT",
num-bigint-dig: 0.8.4, "Apache-2.0 OR MIT",
+num-bigint-dig: 0.8.4, "Apache-2.0 OR MIT",
num-complex: 0.4.6, "Apache-2.0 OR MIT",
num-conv: 0.1.0, "Apache-2.0 OR MIT",
num-integer: 0.1.46, "Apache-2.0 OR MIT",
@@ -479,7 +507,7 @@ opaque-debug: 0.3.1, "Apache-2.0 OR MIT",
openssl: 0.10.73, "Apache-2.0",
openssl-macros: 0.1.1, "Apache-2.0 OR MIT",
openssl-probe: 0.1.6, "Apache-2.0 OR MIT",
-openssl-src: 300.5.0+3.5.0, "Apache-2.0 OR MIT",
+openssl-src: 300.5.1+3.5.1, "Apache-2.0 OR MIT",
openssl-sys: 0.9.109, "MIT",
opentelemetry: 0.30.0, "Apache-2.0",
opentelemetry-appender-tracing: 0.30.1, "Apache-2.0",
@@ -507,6 +535,7 @@ peg-macros: 0.6.3, "MIT",
peg-runtime: 0.6.3, "MIT",
pem: 3.0.5, "MIT",
pem-rfc7468: 0.7.0, "Apache-2.0 OR MIT",
+pem-rfc7468: 0.7.0, "Apache-2.0 OR MIT",
percent-encoding: 2.3.1, "Apache-2.0 OR MIT",
pest: 2.8.1, "Apache-2.0 OR MIT",
pest_derive: 2.8.1, "Apache-2.0 OR MIT",
@@ -519,14 +548,17 @@ pin-utils: 0.1.0, "Apache-2.0 OR MIT",
pinned: 0.1.0, "Apache-2.0 OR MIT",
pkcs1: 0.7.5, "Apache-2.0 OR MIT",
pkcs8: 0.10.2, "Apache-2.0 OR MIT",
+pkcs1: 0.7.5, "Apache-2.0 OR MIT",
+pkcs8: 0.10.2, "Apache-2.0 OR MIT",
pkg-config: 0.3.32, "Apache-2.0 OR MIT",
polonius-the-crab: 0.2.1, "Apache-2.0 OR MIT OR Zlib",
polyval: 0.6.2, "Apache-2.0 OR MIT",
portable-atomic: 1.11.1, "Apache-2.0 OR MIT",
portable-atomic-util: 0.2.4, "Apache-2.0 OR MIT",
-postcard: 1.1.1, "Apache-2.0 OR MIT",
+postcard: 1.1.2, "Apache-2.0 OR MIT",
potential_utf: 0.1.2, "Unicode-3.0",
powerfmt: 0.2.0, "Apache-2.0 OR MIT",
+ppmd-rust: 1.2.1, "CC0-1.0",
ppv-lite86: 0.2.21, "Apache-2.0 OR MIT",
predicates: 3.1.3, "Apache-2.0 OR MIT",
predicates-core: 1.0.9, "Apache-2.0 OR MIT",
@@ -542,6 +574,7 @@ prokio: 0.1.0, "Apache-2.0 OR MIT",
prometheus-client: 0.23.1, "Apache-2.0 OR MIT",
prometheus-client-derive-encode: 0.4.2, "Apache-2.0 OR MIT",
prost: 0.13.5, "Apache-2.0",
+prost: 0.14.1, "Apache-2.0",
prost-derive: 0.13.5, "Apache-2.0",
prost-reflect: 0.15.3, "Apache-2.0 OR MIT",
prost-types: 0.13.5, "Apache-2.0",
@@ -559,7 +592,7 @@ quote: 1.0.40, "Apache-2.0 OR MIT",
r-efi: 5.3.0, "Apache-2.0 OR LGPL-2.1-or-later OR MIT",
radium: 0.7.0, "MIT",
rand: 0.8.5, "Apache-2.0 OR MIT",
-rand: 0.9.1, "Apache-2.0 OR MIT",
+rand: 0.9.2, "Apache-2.0 OR MIT",
rand_chacha: 0.3.1, "Apache-2.0 OR MIT",
rand_chacha: 0.9.0, "Apache-2.0 OR MIT",
rand_core: 0.6.4, "Apache-2.0 OR MIT",
@@ -567,9 +600,9 @@ rand_core: 0.9.3, "Apache-2.0 OR MIT",
raw-cpuid: 11.5.0, "MIT",
rayon: 1.10.0, "Apache-2.0 OR MIT",
rayon-core: 1.12.1, "Apache-2.0 OR MIT",
-rcgen: 0.13.2, "Apache-2.0 OR MIT",
+rcgen: 0.14.3, "Apache-2.0 OR MIT",
redox_syscall: 0.2.16, "MIT",
-redox_syscall: 0.5.13, "MIT",
+redox_syscall: 0.5.15, "MIT",
redox_users: 0.5.0, "MIT",
ref-cast: 1.0.24, "Apache-2.0 OR MIT",
ref-cast-impl: 1.0.24, "Apache-2.0 OR MIT",
@@ -581,13 +614,15 @@ regex-syntax: 0.6.29, "Apache-2.0 OR MIT",
regex-syntax: 0.7.5, "Apache-2.0 OR MIT",
regex-syntax: 0.8.5, "Apache-2.0 OR MIT",
rend: 0.4.2, "MIT",
-reqwest: 0.12.20, "Apache-2.0 OR MIT",
+reqwest: 0.12.22, "Apache-2.0 OR MIT",
reqwest-middleware: 0.4.2, "Apache-2.0 OR MIT",
reqwest-retry: 0.7.0, "Apache-2.0 OR MIT",
retry-policies: 0.4.0, "Apache-2.0 OR MIT",
ring: 0.17.14, "Apache-2.0 AND ISC",
rkyv: 0.7.45, "MIT",
rkyv_derive: 0.7.45, "MIT",
+rmcp: 0.3.0, "Apache-2.0 OR MIT",
+rmcp-macros: 0.3.0, "Apache-2.0 OR MIT",
ron: 0.8.1, "Apache-2.0 OR MIT",
route-recognizer: 0.3.1, "MIT",
rsa: 0.9.8, "Apache-2.0 OR MIT",
@@ -599,14 +634,14 @@ rustc-hash: 1.1.0, "Apache-2.0 OR MIT",
rustc-hash: 2.1.1, "Apache-2.0 OR MIT",
rustc_version: 0.4.1, "Apache-2.0 OR MIT",
rustix: 0.38.44, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT",
-rustix: 1.0.7, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT",
-rustls: 0.23.28, "Apache-2.0 OR ISC OR MIT",
+rustix: 1.0.8, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT",
+rustls: 0.23.29, "Apache-2.0 OR ISC OR MIT",
rustls-native-certs: 0.8.1, "Apache-2.0 OR ISC OR MIT",
rustls-pemfile: 2.2.0, "Apache-2.0 OR ISC OR MIT",
rustls-pki-types: 1.12.0, "Apache-2.0 OR MIT",
rustls-platform-verifier: 0.5.3, "Apache-2.0 OR MIT",
rustls-platform-verifier-android: 0.1.1, "Apache-2.0 OR MIT",
-rustls-webpki: 0.103.3, "ISC",
+rustls-webpki: 0.103.4, "ISC",
rustversion: 1.0.21, "Apache-2.0 OR MIT",
rxml: 0.11.1, "MIT",
rxml_validation: 0.11.0, "MIT",
@@ -616,9 +651,11 @@ same-file: 1.0.6, "MIT OR Unlicense",
scc: 2.3.4, "Apache-2.0",
schannel: 0.1.27, "MIT",
schemars: 0.9.0, "MIT",
+schemars: 1.0.4, "MIT",
+schemars_derive: 1.0.4, "MIT",
scoped-tls: 1.0.1, "Apache-2.0 OR MIT",
scopeguard: 1.2.0, "Apache-2.0 OR MIT",
-sdd: 3.0.8, "Apache-2.0",
+sdd: 3.0.10, "Apache-2.0",
seahash: 4.1.0, "MIT",
sealed: 0.5.0, "Apache-2.0 OR MIT",
secrecy: 0.10.3, "Apache-2.0 OR MIT",
@@ -629,12 +666,14 @@ serde: 1.0.219, "Apache-2.0 OR MIT",
serde-wasm-bindgen: 0.5.0, "MIT",
serde-wasm-bindgen: 0.6.5, "MIT",
serde_derive: 1.0.219, "Apache-2.0 OR MIT",
-serde_json: 1.0.140, "Apache-2.0 OR MIT",
+serde_derive_internals: 0.29.1, "Apache-2.0 OR MIT",
+serde_json: 1.0.141, "Apache-2.0 OR MIT",
serde_path_to_error: 0.1.17, "Apache-2.0 OR MIT",
serde_spanned: 0.6.9, "Apache-2.0 OR MIT",
+serde_spanned: 1.0.0, "Apache-2.0 OR MIT",
serde_urlencoded: 0.7.1, "Apache-2.0 OR MIT",
-serde_with: 3.13.0, "Apache-2.0 OR MIT",
-serde_with_macros: 3.13.0, "Apache-2.0 OR MIT",
+serde_with: 3.14.0, "Apache-2.0 OR MIT",
+serde_with_macros: 3.14.0, "Apache-2.0 OR MIT",
serde_yml: 0.0.12, "Apache-2.0 OR MIT",
serial_test: 3.2.0, "MIT",
serial_test_derive: 3.2.0, "MIT",
@@ -645,6 +684,7 @@ sharded-slab: 0.1.7, "MIT",
shlex: 1.3.0, "Apache-2.0 OR MIT",
signal-hook-registry: 1.4.5, "Apache-2.0 OR MIT",
signature: 2.2.0, "Apache-2.0 OR MIT",
+signature: 2.2.0, "Apache-2.0 OR MIT",
simd-adler32: 0.3.7, "MIT",
simd-json: 0.15.1, "Apache-2.0 OR MIT",
simdutf8: 0.1.5, "Apache-2.0 OR MIT",
@@ -657,6 +697,7 @@ smawk: 0.3.2, "MIT",
snafu: 0.8.6, "Apache-2.0 OR MIT",
snafu-derive: 0.8.6, "Apache-2.0 OR MIT",
socket2: 0.5.10, "Apache-2.0 OR MIT",
+socket2: 0.6.0, "Apache-2.0 OR MIT",
spin: 0.9.8, "MIT",
spinning_top: 0.3.0, "Apache-2.0 OR MIT",
spki: 0.7.3, "Apache-2.0 OR MIT",
@@ -671,9 +712,10 @@ stable_deref_trait: 1.2.0, "Apache-2.0 OR MIT",
static-toml: 1.3.0, "MIT",
static_assertions: 1.1.0, "Apache-2.0 OR MIT",
stringprep: 0.1.5, "Apache-2.0 OR MIT",
+stringprep: 0.1.5, "Apache-2.0 OR MIT",
strsim: 0.11.1, "MIT",
-strum: 0.27.1, "MIT",
-strum_macros: 0.27.1, "MIT",
+strum: 0.27.2, "MIT",
+strum_macros: 0.27.2, "MIT",
subtle: 2.6.1, "BSD-3-Clause",
syn: 1.0.109, "Apache-2.0 OR MIT",
syn: 2.0.104, "Apache-2.0 OR MIT",
@@ -683,7 +725,7 @@ synthez: 0.3.1, "BlueOak-1.0.0",
synthez-codegen: 0.3.1, "BlueOak-1.0.0",
synthez-core: 0.3.1, "BlueOak-1.0.0",
sysinfo: 0.34.2, "MIT",
-sysinfo: 0.35.2, "MIT",
+sysinfo: 0.36.1, "MIT",
tagptr: 0.2.0, "Apache-2.0 OR MIT",
tap: 1.0.1, "MIT",
tempfile: 3.20.0, "Apache-2.0 OR MIT",
@@ -705,16 +747,20 @@ tiny-keccak: 2.0.2, "CC0-1.0",
tinystr: 0.8.1, "Unicode-3.0",
tinyvec: 1.9.0, "Apache-2.0 OR MIT OR Zlib",
tinyvec_macros: 0.1.1, "Apache-2.0 OR MIT OR Zlib",
-tokio: 1.45.1, "MIT",
+tokio: 1.46.1, "MIT",
tokio-macros: 2.5.0, "MIT",
tokio-rustls: 0.26.2, "Apache-2.0 OR MIT",
tokio-stream: 0.1.17, "MIT",
tokio-util: 0.7.15, "MIT",
toml: 0.8.23, "Apache-2.0 OR MIT",
+toml: 0.9.2, "Apache-2.0 OR MIT",
toml_datetime: 0.6.11, "Apache-2.0 OR MIT",
+toml_datetime: 0.7.0, "Apache-2.0 OR MIT",
toml_edit: 0.19.15, "Apache-2.0 OR MIT",
toml_edit: 0.22.27, "Apache-2.0 OR MIT",
+toml_parser: 1.0.1, "Apache-2.0 OR MIT",
toml_write: 0.1.2, "Apache-2.0 OR MIT",
+toml_writer: 1.0.2, "Apache-2.0 OR MIT",
tonic: 0.12.3, "MIT",
tonic: 0.13.1, "MIT",
tools: 0.1.0, "Apache-2.0",
@@ -731,7 +777,6 @@ tracing-log: 0.2.0, "MIT",
tracing-opentelemetry: 0.31.0, "MIT",
tracing-subscriber: 0.3.19, "MIT",
trait-variant: 0.1.2, "Apache-2.0 OR MIT",
-trim-in-place: 0.1.7, "MIT",
try-lock: 0.2.5, "MIT",
twox-hash: 2.1.1, "MIT",
typed-builder: 0.15.2, "Apache-2.0 OR MIT",
@@ -742,12 +787,16 @@ ulid: 1.2.1, "MIT",
uncased: 0.9.10, "Apache-2.0 OR MIT",
unicase: 2.8.1, "Apache-2.0 OR MIT",
unicode-bidi: 0.3.18, "Apache-2.0 OR MIT",
+unicode-bidi: 0.3.18, "Apache-2.0 OR MIT",
unicode-ident: 1.0.18, "(MIT OR Apache-2.0) AND Unicode-3.0",
unicode-linebreak: 0.1.5, "Apache-2.0",
unicode-normalization: 0.1.24, "Apache-2.0 OR MIT",
unicode-properties: 0.1.3, "Apache-2.0 OR MIT",
+unicode-normalization: 0.1.24, "Apache-2.0 OR MIT",
+unicode-properties: 0.1.3, "Apache-2.0 OR MIT",
unicode-segmentation: 1.12.0, "Apache-2.0 OR MIT",
unicode-width: 0.1.14, "Apache-2.0 OR MIT",
+unicode-width: 0.1.14, "Apache-2.0 OR MIT",
unicode-width: 0.2.1, "Apache-2.0 OR MIT",
unicode-xid: 0.2.6, "Apache-2.0 OR MIT",
universal-hash: 0.5.1, "Apache-2.0 OR MIT",
@@ -774,6 +823,7 @@ want: 0.3.1, "MIT",
wasi: 0.11.1+wasi-snapshot-preview1, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT",
wasi: 0.14.2+wasi-0.2.4, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT",
wasite: 0.1.0, "Apache-2.0 OR BSL-1.0 OR MIT",
+wasite: 0.1.0, "Apache-2.0 OR BSL-1.0 OR MIT",
wasm-bindgen: 0.2.100, "Apache-2.0 OR MIT",
wasm-bindgen-backend: 0.2.100, "Apache-2.0 OR MIT",
wasm-bindgen-futures: 0.4.50, "Apache-2.0 OR MIT",
@@ -785,11 +835,12 @@ wasm-timer: 0.2.5, "MIT",
web-sys: 0.3.77, "Apache-2.0 OR MIT",
web-time: 1.1.0, "Apache-2.0 OR MIT",
webpki-root-certs: 0.26.11, "CDLA-Permissive-2.0",
-webpki-root-certs: 1.0.1, "CDLA-Permissive-2.0",
+webpki-root-certs: 1.0.2, "CDLA-Permissive-2.0",
webpki-roots: 0.26.11, "CDLA-Permissive-2.0",
-webpki-roots: 1.0.1, "CDLA-Permissive-2.0",
+webpki-roots: 1.0.2, "CDLA-Permissive-2.0",
which: 4.4.2, "MIT",
whoami: 1.6.0, "Apache-2.0 OR BSL-1.0 OR MIT",
+whoami: 1.6.0, "Apache-2.0 OR BSL-1.0 OR MIT",
wide: 0.7.33, "Apache-2.0 OR MIT OR Zlib",
winapi: 0.3.9, "Apache-2.0 OR MIT",
winapi-i686-pc-windows-gnu: 0.4.0, "Apache-2.0 OR MIT",
@@ -851,7 +902,7 @@ windows_x86_64_msvc: 0.48.5, "Apache-2.0 OR MIT",
windows_x86_64_msvc: 0.52.6, "Apache-2.0 OR MIT",
windows_x86_64_msvc: 0.53.0, "Apache-2.0 OR MIT",
winnow: 0.5.40, "MIT",
-winnow: 0.7.11, "MIT",
+winnow: 0.7.12, "MIT",
wit-bindgen-rt: 0.39.0, "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT",
writeable: 0.6.1, "Unicode-3.0",
wyz: 0.5.1, "MIT",
@@ -874,7 +925,7 @@ zeroize_derive: 1.4.2, "Apache-2.0 OR MIT",
zerotrie: 0.2.2, "Unicode-3.0",
zerovec: 0.11.2, "Unicode-3.0",
zerovec-derive: 0.11.1, "Unicode-3.0",
-zip: 4.2.0, "MIT",
+zip: 4.3.0, "MIT",
zlib-rs: 0.5.1, "Zlib",
zopfli: 0.8.2, "Apache-2.0",
zstd: 0.13.3, "MIT",
diff --git a/Dockerfile.ci.dockerignore b/Dockerfile.ci.dockerignore
index 251cad50..e2fdd5f0 100644
--- a/Dockerfile.ci.dockerignore
+++ b/Dockerfile.ci.dockerignore
@@ -19,7 +19,10 @@
.github
/assets
/local_data
+/licenses
/certs
+/helm
+/web
Dockerfile
docker-compose.yml
.dockerignore
diff --git a/docker-compose.yml b/Dockerfile.connectors.ci
similarity index 68%
copy from docker-compose.yml
copy to Dockerfile.connectors.ci
index 347bef1b..b195c914 100644
--- a/docker-compose.yml
+++ b/Dockerfile.connectors.ci
@@ -15,26 +15,18 @@
# specific language governing permissions and limitations
# under the License.
-version: '3.5'
-services:
+FROM alpine:latest
- iggy-server:
- build: .
- container_name: iggy-server
- restart: unless-stopped
- networks:
- - iggy
- ports:
- - 3000:3000
- - 8080:8080
- - 8090:8090
- volumes:
- - iggy-server:/local_data
+ARG IGGY_CONNECTORS_PATH
+RUN test -n "$IGGY_CONNECTORS_PATH" || (echo "IGGY_CONNECTORS_PATH not set" && false)
-volumes:
- iggy-server:
- driver: local
+WORKDIR /iggy
-networks:
- iggy:
- name: iggy-network
+COPY ./core/connectors/runtime/config.toml ./config.toml
+COPY ${IGGY_CONNECTORS_PATH} ./
+
+RUN chmod +x ./iggy-connectors
+
+RUN ln -sf /iggy/iggy-connectors /usr/bin/iggy-connectors
+
+CMD ["/iggy/iggy-connectors"]
diff --git a/Dockerfile.ci.dockerignore b/Dockerfile.connectors.ci.dockerignore
similarity index 97%
copy from Dockerfile.ci.dockerignore
copy to Dockerfile.connectors.ci.dockerignore
index 251cad50..e2fdd5f0 100644
--- a/Dockerfile.ci.dockerignore
+++ b/Dockerfile.connectors.ci.dockerignore
@@ -19,7 +19,10 @@
.github
/assets
/local_data
+/licenses
/certs
+/helm
+/web
Dockerfile
docker-compose.yml
.dockerignore
diff --git a/Dockerfile.ci.dockerignore b/Dockerfile.mcp.ci
similarity index 73%
copy from Dockerfile.ci.dockerignore
copy to Dockerfile.mcp.ci
index 251cad50..bc73ebe0 100644
--- a/Dockerfile.ci.dockerignore
+++ b/Dockerfile.mcp.ci
@@ -15,13 +15,18 @@
# specific language governing permissions and limitations
# under the License.
-.config
-.github
-/assets
-/local_data
-/certs
-Dockerfile
-docker-compose.yml
-.dockerignore
-.git
-.gitignore
+FROM alpine:latest
+
+ARG IGGY_MCP_PATH
+RUN test -n "$IGGY_MCP_PATH" || (echo "IGGY_MCP_PATH not set" && false)
+
+WORKDIR /iggy
+
+COPY ./core/ai/mcp/config.toml ./config.toml
+COPY ${IGGY_MCP_PATH} ./
+
+RUN chmod +x ./iggy-mcp
+
+RUN ln -sf /iggy/iggy-mcp /usr/bin/iggy-mcp
+
+CMD ["/iggy/iggy-mcp"]
diff --git a/Dockerfile.ci.dockerignore b/Dockerfile.mcp.ci.dockerignore
similarity index 97%
copy from Dockerfile.ci.dockerignore
copy to Dockerfile.mcp.ci.dockerignore
index 251cad50..e2fdd5f0 100644
--- a/Dockerfile.ci.dockerignore
+++ b/Dockerfile.mcp.ci.dockerignore
@@ -19,7 +19,10 @@
.github
/assets
/local_data
+/licenses
/certs
+/helm
+/web
Dockerfile
docker-compose.yml
.dockerignore
diff --git a/README.md b/README.md
index 3a667ee4..3d627b0c 100644
--- a/README.md
+++ b/README.md
@@ -133,7 +133,7 @@ There's a dedicated Web UI for the server, which allows managing the streams, to
## Docker
-The official images can be found [in Docker Hub](https://hub.docker.com/r/apache/iggy), simply type `docker pull apache/iggy` to pull the image.
+The official images can be found in [Docker Hub](https://hub.docker.com/r/apache/iggy), simply type `docker pull apache/iggy` to pull the image.
Please note that the images tagged as `latest` are based on the official, stable releases, while the `edge` ones are updated directly from latest version of the `master` branch.
@@ -299,7 +299,7 @@ while let Some(message) = consumer.next().await {
**Benchmarks should be the first-class citizens**. We believe that performance is crucial for any system, and we strive to provide the best possible performance for our users. Please check, why we believe that the **[transparent
benchmarking](https://iggy.apache.org/blogs/2025/02/17/transparent-benchmarks)** is so important.
-We've also built the **[benchmarking platform](https://benchmarks.iggy.rs)** where anyone can upload the benchmarks and compare the results with others. Source code for the platform is available in the `core/bench/dashboard` directory.
+We've also built the **[benchmarking platform](https://benchmarks.iggy.apache.org)** where anyone can upload the benchmarks and compare the results with others. Source code for the platform is available in the `core/bench/dashboard` directory.

@@ -365,7 +365,7 @@ Depending on the hardware, transport protocol (`quic`, `tcp` or `http`) and payl
**Iggy is already capable of processing millions of messages per second at the microseconds range for p99+ latency**, and with the upcoming optimizations related to the io_uring support along with the shared-nothing design, it will only get better.
-Please refer to the mentioned [benchmarking platform](https://benchmarks.iggy.rs) where you can browse the results achieved on the different hardware configurations, using the different Iggy server versions.
+Please refer to the mentioned [benchmarking platform](https://benchmarks.iggy.apache.org) where you can browse the results achieved on the different hardware configurations, using the different Iggy server versions.
---
diff --git a/bdd/go/tests/tcp_test/messages_feature_send.go b/bdd/go/tests/tcp_test/messages_feature_send.go
index 00dd5835..919e9162 100644
--- a/bdd/go/tests/tcp_test/messages_feature_send.go
+++ b/bdd/go/tests/tcp_test/messages_feature_send.go
@@ -81,7 +81,7 @@ var _ = ginkgo.Describe("SEND MESSAGES:", func() {
err := client.SendMessages(
streamIdentifier,
topicIdentifier,
- iggcon.PartitionId(int(createRandomUInt32())),
+ iggcon.PartitionId(createRandomUInt32()),
messages,
)
itShouldReturnSpecificError(err, "partition_not_found")
@@ -97,7 +97,7 @@ var _ = ginkgo.Describe("SEND MESSAGES:", func() {
err := client.SendMessages(
streamIdentifier,
topicIdentifier,
- iggcon.PartitionId(int(createRandomUInt32())),
+ iggcon.PartitionId(createRandomUInt32()),
[]iggcon.IggyMessage{},
)
itShouldReturnSpecificError(err, "messages_count_should_be_greater_than_zero")
diff --git a/bdd/go/tests/tcp_test/messages_steps.go b/bdd/go/tests/tcp_test/messages_steps.go
index b169c0c8..e364f622 100644
--- a/bdd/go/tests/tcp_test/messages_steps.go
+++ b/bdd/go/tests/tcp_test/messages_steps.go
@@ -48,10 +48,7 @@ func itShouldSuccessfullyPublishMessages(streamId uint32, topicId uint32, messag
result, err := client.PollMessages(
streamIdentifier,
topicIdentifier,
- iggcon.Consumer{
- Kind: iggcon.ConsumerKindSingle,
- Id: randomU32Identifier(),
- },
+ iggcon.NewSingleConsumer(randomU32Identifier()),
iggcon.FirstPollingStrategy(),
uint32(len(messages)),
true,
diff --git a/core/ai/README.md b/core/ai/README.md
new file mode 100644
index 00000000..c87875ab
--- /dev/null
+++ b/core/ai/README.md
@@ -0,0 +1,5 @@
+# Apache Iggy AI
+
+This module contains the AI-related components of the Apache Iggy message streaming infrastructure.
+
+Please check the **[MCP Server](https://github.com/apache/iggy/tree/master/core/ai/mcp)** for the details about Iggy MCP (Model Context Protocol) server.
diff --git a/core/ai/mcp/Cargo.toml b/core/ai/mcp/Cargo.toml
new file mode 100644
index 00000000..a8674373
--- /dev/null
+++ b/core/ai/mcp/Cargo.toml
@@ -0,0 +1,25 @@
+[package]
+name = "iggy-mcp"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+axum = { workspace = true }
+axum-server = { workspace = true }
+config = { workspace = true }
+dotenvy = { workspace = true }
+figlet-rs = { workspace = true }
+iggy = { workspace = true }
+rmcp = { version = "0.3.0", features = [
+ "server",
+ "transport-io",
+ "transport-sse-server",
+ "transport-streamable-http-server",
+] }
+serde = { workspace = true }
+strum = { workspace = true }
+thiserror = { workspace = true }
+tokio = { workspace = true }
+tower-http = { workspace = true }
+tracing = { workspace = true }
+tracing-subscriber = { workspace = true }
diff --git a/docker-compose.yml b/core/ai/mcp/Dockerfile
similarity index 68%
copy from docker-compose.yml
copy to core/ai/mcp/Dockerfile
index 347bef1b..8422eedc 100644
--- a/docker-compose.yml
+++ b/core/ai/mcp/Dockerfile
@@ -15,26 +15,17 @@
# specific language governing permissions and limitations
# under the License.
-version: '3.5'
-services:
+FROM rust:latest AS builder
+WORKDIR /build
+COPY . /build
+RUN cargo build --bin iggy-mcp --release
- iggy-server:
- build: .
- container_name: iggy-server
- restart: unless-stopped
- networks:
- - iggy
- ports:
- - 3000:3000
- - 8080:8080
- - 8090:8090
- volumes:
- - iggy-server:/local_data
+FROM debian:bookworm-slim
+RUN apt-get update && apt-get install -y \
+ ca-certificates \
+ liblzma5 \
+ && rm -rf /var/lib/apt/lists/*
+COPY ./core/ai/mcp/config.toml ./config.toml
+COPY --from=builder /build/target/release/iggy-mcp .
-volumes:
- iggy-server:
- driver: local
-
-networks:
- iggy:
- name: iggy-network
+CMD ["/iggy-mcp"]
diff --git a/core/ai/mcp/README.md b/core/ai/mcp/README.md
new file mode 100644
index 00000000..dcec8b03
--- /dev/null
+++ b/core/ai/mcp/README.md
@@ -0,0 +1,62 @@
+# Apache Iggy MCP Server
+
+The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) is an open protocol that standardizes how applications provide context to LLMs. The Apache Iggy MCP Server is an implementation of the MCP protocol for the message streaming infrastructure.
+
+To start the MCP server, simply run `cargo run --bin iggy-mcp`.
+
+The minimal viable configuration requires at least the Iggy credentials, to create the connection with the running Iggy server using TCP with which the MCP server will communicate. You can choose between HTTP and STDIO transports (e.g. for the local usage with tools such as [Claude Desktop](https://claude.ai/download) choose `stdio`).
+
+```toml
+transport = "stdio" # http or stdio are supported
+
+[iggy]
+address = "localhost:8090" # TCP address of the Iggy server
+username = "iggy"
+password = "iggy"
+# token = "secret" # Personal Access Token (PAT) can be used instead of username and password
+# consumer = "iggy-mcp" # Optional consumer name
+
+[http] # Optional HTTP API configuration
+address = "127.0.0.1:8082"
+path = "/mcp"
+
+[http.cors] # Optional CORS configuration for HTTP API
+enabled = false
+allowed_methods = ["GET", "POST", "PUT", "DELETE"]
+allowed_origins = ["*"]
+allowed_headers = ["content-type"]
+exposed_headers = [""]
+allow_credentials = false
+allow_private_network = false
+
+[http.tls] # Optional TLS configuration for HTTP API
+enabled = false
+cert = "core/certs/iggy_cert.pem"
+key = "core/certs/iggy_key.pem"
+
+[permissions]
+create = true
+read = true
+update = true
+delete = true
+```
+
+Keep in mind that either of `toml`, `yaml`, or `json` formats are supported for the configuration file. The path to the configuration can be overriden by `IGGY_MCP_CONFIG_PATH` environment variable. Each configuration section can be also additionally updated by using the following convention `IGGY_MCP_SECTION_NAME.KEY_NAME` e.g. `IGGY_MCP_IGGY_USERNAME` and so on.
+
+Here's the example configuration to be used with Claude Desktop:
+
+```json
+{
+ "mcpServers": {
+ "iggy": {
+ "command": "/path/to/iggy-mcp",
+ "args": [],
+ "env": {
+ "IGGY_MCP_TRANSPORT": "stdio"
+ }
+ }
+ }
+}
+```
+
+**Remember to use the appropriate Iggy account credentials for your environment** (e.g. create the user with read-only permissions to avoid modifying the data). On top of this, you can also configure the `permissions` for the MCP server to control which operations are allowed (this will be checked first, before forwarding the actual request to the Iggy server).
diff --git a/core/ai/mcp/config.toml b/core/ai/mcp/config.toml
new file mode 100644
index 00000000..357502cd
--- /dev/null
+++ b/core/ai/mcp/config.toml
@@ -0,0 +1,49 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+transport = "http" # http or stdio are supported
+
+[http] # Optional HTTP API configuration
+address = "127.0.0.1:8082"
+path = "/mcp"
+
+[http.cors] # Optional CORS configuration for HTTP API
+enabled = false
+allowed_methods = ["GET", "POST", "PUT", "DELETE"]
+allowed_origins = ["*"]
+allowed_headers = ["content-type"]
+exposed_headers = [""]
+allow_credentials = false
+allow_private_network = false
+
+[http.tls] # Optional TLS configuration for HTTP API
+enabled = false
+cert = "core/certs/iggy_cert.pem"
+key = "core/certs/iggy_key.pem"
+
+[iggy]
+address = "localhost:8090"
+username = "iggy"
+password = "iggy"
+# token = "secret" # Personal Access Token (PAT) can be used instead of username and password
+# consumer = "iggy-mcp" # Optional consumer name
+
+[permissions]
+create = true
+read = true
+update = true
+delete = true
diff --git a/core/connectors/runtime/src/api/mod.rs b/core/ai/mcp/src/api.rs
similarity index 55%
copy from core/connectors/runtime/src/api/mod.rs
copy to core/ai/mcp/src/api.rs
index b6987d1d..7008927d 100644
--- a/core/connectors/runtime/src/api/mod.rs
+++ b/core/ai/mcp/src/api.rs
@@ -16,43 +16,60 @@
* under the License.
*/
-use crate::context::RuntimeContext;
-use auth::resolve_api_key;
-use axum::{Json, Router, middleware, routing::get};
+use crate::{
+ Permissions,
+ configs::{HttpApiConfig, configure_cors},
+ error::McpRuntimeError,
+ service::IggyService,
+};
+use axum::{Json, Router, routing::get};
use axum_server::tls_rustls::RustlsConfig;
-use config::{HttpApiConfig, configure_cors};
+use iggy::prelude::{Consumer, IggyClient};
+use rmcp::{
+ serde_json,
+ transport::{
+ StreamableHttpService, streamable_http_server::session::local::LocalSessionManager,
+ },
+};
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
use tokio::spawn;
use tracing::{error, info};
-mod auth;
-pub mod config;
-mod error;
-mod models;
-mod sink;
-mod source;
+pub async fn init(
+ config: HttpApiConfig,
+ iggy_client: Arc<IggyClient>,
+ iggy_consumer: Arc<Consumer>,
+ permissions: Permissions,
+) -> Result<(), McpRuntimeError> {
+ let service = StreamableHttpService::new(
+ move || {
+ Ok(IggyService::new(
+ iggy_client.clone(),
+ iggy_consumer.clone(),
+ permissions,
+ ))
+ },
+ LocalSessionManager::default().into(),
+ Default::default(),
+ );
-const NAME: &str = env!("CARGO_PKG_NAME");
+ if !config.path.starts_with("/") {
+ error!("HTTP API path must start with '/'");
+ return Err(McpRuntimeError::InvalidApiPath);
+ }
-pub async fn init(config: &HttpApiConfig, context: Arc<RuntimeContext>) {
- if !config.enabled {
- info!("{NAME} HTTP API is disabled");
- return;
+ if config.path == "/" {
+ error!("HTTP API path cannot be '/'");
+ return Err(McpRuntimeError::InvalidApiPath);
}
let mut app = Router::new()
- .route("/", get(|| async { "Connector Runtime API" }))
+ .route("/", get(|| async { "Iggy MCP Server" }))
.route(
"/health",
get(|| async { Json(serde_json::json!({ "status": "healthy" })) }),
)
- .merge(sink::router(context.clone()))
- .merge(source::router(context.clone()));
-
- app = app.layer(middleware::from_fn_with_state(
- context.clone(),
- resolve_api_key,
- ));
+ .nest_service(&config.path, service);
if let Some(cors) = &config.cors {
if cors.enabled {
@@ -65,14 +82,21 @@ pub async fn init(config: &HttpApiConfig, context: Arc<RuntimeContext>) {
.as_ref()
.map(|tls| tls.enabled)
.unwrap_or_default();
+
if !tls_enabled {
let listener = tokio::net::TcpListener::bind(&config.address)
.await
- .unwrap_or_else(|_| panic!("Failed to bind to HTTP address {}", config.address));
+ .map_err(|error| {
+ error!("Failed to bind TCP listener: {:?}", error);
+ McpRuntimeError::FailedToStartHttpServer
+ })?;
let address = listener
.local_addr()
.expect("Failed to get local address for HTTP server");
- info!("Started {NAME} on: {address}");
+ info!(
+ "HTTP API listening on: {address}, MCP path: {}",
+ config.path
+ );
spawn(async move {
if let Err(error) = axum::serve(
listener,
@@ -80,31 +104,35 @@ pub async fn init(config: &HttpApiConfig, context: Arc<RuntimeContext>) {
)
.await
{
- error!("Failed to start {NAME} server, error {}", error);
+ error!("Failed to start MCP server, error: {error}");
}
});
- return;
+ return Ok(());
}
let tls = config.tls.as_ref().expect("TLS configuration is required");
- let tls_config =
- RustlsConfig::from_pem_file(PathBuf::from(&tls.cert_file), PathBuf::from(&tls.key_file))
- .await
- .unwrap();
+ let tls_config = RustlsConfig::from_pem_file(PathBuf::from(&tls.cert), PathBuf::from(&tls.key))
+ .await
+ .unwrap();
let listener = std::net::TcpListener::bind(&config.address).unwrap();
let address = listener
.local_addr()
.expect("Failed to get local address for HTTPS / TLS server");
- info!("Started {NAME} on: {address}");
+ info!(
+ "HTTP API (TLS) listening on: {address}, MCP path: {}",
+ config.path
+ );
spawn(async move {
if let Err(error) = axum_server::from_tcp_rustls(listener, tls_config)
.serve(app.into_make_service_with_connect_info::<SocketAddr>())
.await
{
- error!("Failed to start {NAME} server, error: {}", error);
+ error!("Failed to start MCP server, error: {error}");
}
});
+
+ Ok(())
}
diff --git a/core/ai/mcp/src/configs.rs b/core/ai/mcp/src/configs.rs
new file mode 100644
index 00000000..332910ed
--- /dev/null
+++ b/core/ai/mcp/src/configs.rs
@@ -0,0 +1,178 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use axum::http::Method;
+use iggy::prelude::{DEFAULT_ROOT_PASSWORD, DEFAULT_ROOT_USERNAME};
+use serde::{Deserialize, Serialize};
+use strum::Display;
+use tower_http::cors::{AllowOrigin, CorsLayer};
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct McpServerConfig {
+ pub http: Option<HttpApiConfig>,
+ pub iggy: IggyConfig,
+ pub permissions: PermissionsConfig,
+ pub transport: McpTransport,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct IggyConfig {
+ pub address: String,
+ pub username: Option<String>,
+ pub password: Option<String>,
+ pub token: Option<String>,
+ pub consumer: Option<String>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct HttpApiConfig {
+ pub address: String,
+ pub path: String,
+ pub cors: Option<HttpCorsConfig>,
+ pub tls: Option<HttpTlsConfig>,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct PermissionsConfig {
+ pub create: bool,
+ pub read: bool,
+ pub update: bool,
+ pub delete: bool,
+}
+
+#[derive(Debug, Default, Deserialize, Serialize, Clone)]
+pub struct HttpTlsConfig {
+ pub enabled: bool,
+ pub cert: String,
+ pub key: String,
+}
+
+#[derive(Debug, Default, Deserialize, Serialize, Clone)]
+pub struct HttpCorsConfig {
+ pub enabled: bool,
+ pub allowed_methods: Vec<String>,
+ pub allowed_origins: Vec<String>,
+ pub allowed_headers: Vec<String>,
+ pub exposed_headers: Vec<String>,
+ pub allow_credentials: bool,
+ pub allow_private_network: bool,
+}
+
+#[derive(Clone, Copy, Debug, Default, Display, PartialEq, Eq, Serialize, Deserialize)]
+#[strum(serialize_all = "snake_case")]
+#[serde(rename_all = "snake_case")]
+pub enum McpTransport {
+ #[default]
+ #[strum(to_string = "http")]
+ Http,
+ #[strum(to_string = "stdio")]
+ Stdio,
+}
+
+impl Default for McpServerConfig {
+ fn default() -> Self {
+ Self {
+ http: Some(HttpApiConfig::default()),
+ iggy: IggyConfig::default(),
+ permissions: PermissionsConfig::default(),
+ transport: McpTransport::Http,
+ }
+ }
+}
+
+impl Default for IggyConfig {
+ fn default() -> Self {
+ Self {
+ address: "localhost:8090".to_owned(),
+ username: Some(DEFAULT_ROOT_USERNAME.to_owned()),
+ password: Some(DEFAULT_ROOT_PASSWORD.to_owned()),
+ token: None,
+ consumer: None,
+ }
+ }
+}
+
+impl Default for HttpApiConfig {
+ fn default() -> Self {
+ Self {
+ address: "localhost:8082".to_owned(),
+ path: "/mcp".to_owned(),
+ tls: None,
+ cors: None,
+ }
+ }
+}
+
+impl Default for PermissionsConfig {
+ fn default() -> Self {
+ Self {
+ create: true,
+ read: true,
+ update: true,
+ delete: true,
+ }
+ }
+}
+
+pub fn configure_cors(config: &HttpCorsConfig) -> CorsLayer {
+ let allowed_origins = match &config.allowed_origins {
+ origins if origins.is_empty() => AllowOrigin::default(),
+ origins if origins.first().unwrap() == "*" => AllowOrigin::any(),
+ origins => AllowOrigin::list(origins.iter().map(|s| s.parse().unwrap())),
+ };
+
+ let allowed_headers = config
+ .allowed_headers
+ .iter()
+ .filter(|s| !s.is_empty())
+ .map(|s| s.parse().unwrap())
+ .collect::<Vec<_>>();
+
+ let exposed_headers = config
+ .exposed_headers
+ .iter()
+ .filter(|s| !s.is_empty())
+ .map(|s| s.parse().unwrap())
+ .collect::<Vec<_>>();
+
+ let allowed_methods = config
+ .allowed_methods
+ .iter()
+ .filter(|s| !s.is_empty())
+ .map(|s| match s.to_uppercase().as_str() {
+ "GET" => Method::GET,
+ "POST" => Method::POST,
+ "PUT" => Method::PUT,
+ "DELETE" => Method::DELETE,
+ "HEAD" => Method::HEAD,
+ "OPTIONS" => Method::OPTIONS,
+ "CONNECT" => Method::CONNECT,
+ "PATCH" => Method::PATCH,
+ "TRACE" => Method::TRACE,
+ _ => panic!("Invalid HTTP method: {s}"),
+ })
+ .collect::<Vec<_>>();
+
+ CorsLayer::new()
+ .allow_methods(allowed_methods)
+ .allow_origin(allowed_origins)
+ .allow_headers(allowed_headers)
+ .expose_headers(exposed_headers)
+ .allow_credentials(config.allow_credentials)
+ .allow_private_network(config.allow_private_network)
+}
diff --git a/foreign/python/src/lib.rs b/core/ai/mcp/src/error.rs
similarity index 56%
copy from foreign/python/src/lib.rs
copy to core/ai/mcp/src/error.rs
index 092cf954..0344cfac 100644
--- a/foreign/python/src/lib.rs
+++ b/core/ai/mcp/src/error.rs
@@ -16,27 +16,24 @@
* under the License.
*/
-pub mod client;
-mod receive_message;
-mod send_message;
-mod stream;
-mod topic;
+use thiserror::Error;
-use client::IggyClient;
-use pyo3::prelude::*;
-use receive_message::{PollingStrategy, ReceiveMessage};
-use send_message::SendMessage;
-use stream::StreamDetails;
-use topic::TopicDetails;
-
-/// A Python module implemented in Rust.
-#[pymodule]
-fn iggy_py(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
- m.add_class::<SendMessage>()?;
- m.add_class::<ReceiveMessage>()?;
- m.add_class::<IggyClient>()?;
- m.add_class::<StreamDetails>()?;
- m.add_class::<TopicDetails>()?;
- m.add_class::<PollingStrategy>()?;
- Ok(())
+#[derive(Debug, Error)]
+pub enum McpRuntimeError {
+ #[error("Failed to create service")]
+ FailedToCreateService,
+ #[error("Missing configuration")]
+ MissingConfig,
+ #[error("Failed to start HTTP server")]
+ FailedToStartHttpServer,
+ #[error("Iggy client error")]
+ IggyClient(#[from] iggy::prelude::ClientError),
+ #[error("Iggy error")]
+ IggyError(#[from] iggy::prelude::IggyError),
+ #[error("Missing Iggy credentials")]
+ MissingIggyCredentials,
+ #[error("Failed to create Iggy consumer ID")]
+ FailedToCreateConsumerId,
+ #[error("Invalid API path")]
+ InvalidApiPath,
}
diff --git a/core/ai/mcp/src/main.rs b/core/ai/mcp/src/main.rs
new file mode 100644
index 00000000..1337ce0b
--- /dev/null
+++ b/core/ai/mcp/src/main.rs
@@ -0,0 +1,198 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use config::{Config, Environment, File};
+use configs::{McpServerConfig, McpTransport};
+use dotenvy::dotenv;
+use error::McpRuntimeError;
+use figlet_rs::FIGfont;
+use iggy::prelude::{Client, Identifier};
+use rmcp::{ServiceExt, model::ErrorData, transport::stdio};
+use service::IggyService;
+use std::{env, sync::Arc};
+use tracing::{error, info};
+use tracing_subscriber::{EnvFilter, Registry, layer::SubscriberExt, util::SubscriberInitExt};
+
+mod api;
+mod configs;
+mod error;
+mod service;
+mod stream;
+
+#[tokio::main]
+async fn main() -> Result<(), McpRuntimeError> {
+ let standard_font = FIGfont::standard().unwrap();
+ let figure = standard_font.convert("Iggy MCP Server");
+ eprintln!("{}", figure.unwrap());
+
+ if let Ok(env_path) = std::env::var("IGGY_MCP_ENV_PATH") {
+ if dotenvy::from_path(&env_path).is_ok() {
+ eprintln!("Loaded environment variables from path: {env_path}");
+ }
+ } else if let Ok(path) = dotenv() {
+ eprintln!(
+ "Loaded environment variables from .env file at path: {}",
+ path.display()
+ );
+ }
+
+ let config_path = env::var("IGGY_MCP_CONFIG_PATH").unwrap_or_else(|_| "config".to_string());
+ eprintln!("Configuration file path: {config_path}");
+ let config: McpServerConfig = Config::builder()
+ .add_source(Config::try_from(&McpServerConfig::default()).expect("Failed to init config"))
+ .add_source(File::with_name(&config_path).required(false))
+ .add_source(Environment::with_prefix("IGGY_MCP").separator("_"))
+ .build()
+ .expect("Failed to build runtime config")
+ .try_deserialize()
+ .expect("Failed to deserialize runtime config");
+
+ let transport = config.transport;
+ if transport == McpTransport::Stdio {
+ tracing_subscriber::fmt()
+ .with_env_filter(EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("DEBUG")))
+ .with_writer(std::io::stderr)
+ .with_ansi(false)
+ .init();
+ } else {
+ Registry::default()
+ .with(tracing_subscriber::fmt::layer())
+ .with(EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("INFO")))
+ .init();
+ }
+
+ info!("Starting Iggy MCP Server, transport: {transport}...");
+
+ let consumer_id = Identifier::from_str_value(
+ config.iggy.consumer.as_deref().unwrap_or("iggy-mcp"),
+ )
+ .map_err(|error| {
+ error!("Failed to create Iggy consumer ID: {:?}", error);
+ McpRuntimeError::FailedToCreateConsumerId
+ })?;
+ let iggy_consumer = Arc::new(iggy::prelude::Consumer::new(consumer_id));
+ let iggy_client = Arc::new(stream::init(config.iggy).await?);
+ let client_to_shutdown = iggy_client.clone();
+ let permissions = Permissions {
+ create: config.permissions.create,
+ read: config.permissions.read,
+ update: config.permissions.update,
+ delete: config.permissions.delete,
+ };
+
+ if transport == McpTransport::Stdio {
+ let Ok(service) = IggyService::new(iggy_client, iggy_consumer, permissions)
+ .serve(stdio())
+ .await
+ .inspect_err(|e| {
+ error!("Serving error: {:?}", e);
+ })
+ else {
+ error!("Failed to create service");
+ return Err(McpRuntimeError::FailedToCreateService);
+ };
+
+ if let Err(error) = service.waiting().await {
+ error!("waiting error: {:?}", error);
+ }
+ } else {
+ let Some(http_config) = config.http else {
+ error!("HTTP API configuration not found");
+ return Err(McpRuntimeError::MissingConfig);
+ };
+
+ api::init(http_config, iggy_client, iggy_consumer, permissions).await?;
+ }
+
+ #[cfg(unix)]
+ let (mut ctrl_c, mut sigterm) = {
+ use tokio::signal::unix::{SignalKind, signal};
+ (
+ signal(SignalKind::interrupt()).expect("Failed to create SIGINT signal"),
+ signal(SignalKind::terminate()).expect("Failed to create SIGTERM signal"),
+ )
+ };
+
+ #[cfg(unix)]
+ tokio::select! {
+ _ = ctrl_c.recv() => {
+ info!("Received SIGINT. Shutting down Iggy MCP Server...");
+ },
+ _ = sigterm.recv() => {
+ info!("Received SIGTERM. Shutting down Iggy MCP Server...");
+ }
+ }
+
+ client_to_shutdown.shutdown().await?;
+ info!("Iggy MCP Server stopped successfully");
+ Ok(())
+}
+
+#[derive(Debug, Copy, Clone)]
+pub struct Permissions {
+ create: bool,
+ read: bool,
+ update: bool,
+ delete: bool,
+}
+
+impl Permissions {
+ pub fn ensure_read(&self) -> Result<(), ErrorData> {
+ if self.read {
+ Ok(())
+ } else {
+ Err(ErrorData::invalid_request(
+ "Insufficient 'read' permissions",
+ None,
+ ))
+ }
+ }
+
+ pub fn ensure_create(&self) -> Result<(), ErrorData> {
+ if self.create {
+ Ok(())
+ } else {
+ Err(ErrorData::invalid_request(
+ "Insufficient 'create' permissions",
+ None,
+ ))
+ }
+ }
+
+ pub fn ensure_update(&self) -> Result<(), ErrorData> {
+ if self.update {
+ Ok(())
+ } else {
+ Err(ErrorData::invalid_request(
+ "Insufficient 'update' permissions",
+ None,
+ ))
+ }
+ }
+
+ pub fn ensure_delete(&self) -> Result<(), ErrorData> {
+ if self.delete {
+ Ok(())
+ } else {
+ Err(ErrorData::invalid_request(
+ "Insufficient 'delete' permissions",
+ None,
+ ))
+ }
+ }
+}
diff --git a/core/ai/mcp/src/service/mod.rs b/core/ai/mcp/src/service/mod.rs
new file mode 100644
index 00000000..109adee7
--- /dev/null
+++ b/core/ai/mcp/src/service/mod.rs
@@ -0,0 +1,773 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use iggy::prelude::{
+ Consumer, ConsumerGroupClient, ConsumerOffsetClient, Identifier, IggyClient, IggyError,
+ IggyMessage, IggyTimestamp, MessageClient, PartitionClient, Partitioning,
+ PersonalAccessTokenClient, PollingKind, PollingStrategy, SegmentClient, StreamClient,
+ SystemClient, SystemSnapshotType, TopicClient, UserClient, UserStatus,
+};
+use requests::*;
+use rmcp::{
+ ServerHandler,
+ handler::server::{router::tool::ToolRouter, tool::Parameters},
+ model::{CallToolResult, Content, ErrorData, ServerCapabilities, ServerInfo},
+ tool, tool_handler, tool_router,
+};
+use serde::Serialize;
+use std::sync::Arc;
+use tracing::error;
+
+use crate::Permissions;
+mod requests;
+
+#[derive(Debug, Clone)]
+pub struct IggyService {
+ tool_router: ToolRouter<Self>,
+ client: Arc<IggyClient>,
+ consumer: Arc<Consumer>,
+ permissions: Permissions,
+}
+
+#[tool_router]
+impl IggyService {
+ pub fn new(client: Arc<IggyClient>, consumer: Arc<Consumer>, permissions: Permissions) -> Self {
+ Self {
+ tool_router: Self::tool_router(),
+ client,
+ consumer,
+ permissions,
+ }
+ }
+
+ #[tool(description = "Ping")]
+ pub async fn ping(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.ping().await)
+ }
+
+ #[tool(description = "Get stream")]
+ pub async fn get_stream(
+ &self,
+ Parameters(GetStream { stream_id }): Parameters<GetStream>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_stream(&id(&stream_id)?).await)
+ }
+
+ #[tool(description = "Get streams")]
+ pub async fn get_streams(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_streams().await)
+ }
+
+ #[tool(description = "Create stream")]
+ pub async fn create_stream(
+ &self,
+ Parameters(CreateStream { name, stream_id }): Parameters<CreateStream>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_create()?;
+ request(self.client.create_stream(&name, stream_id).await)
+ }
+
+ #[tool(description = "Update stream")]
+ pub async fn update_stream(
+ &self,
+ Parameters(UpdateStream { stream_id, name }): Parameters<UpdateStream>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_update()?;
+ request(self.client.update_stream(&id(&stream_id)?, &name).await)
+ }
+
+ #[tool(description = "Delete stream")]
+ pub async fn delete_stream(
+ &self,
+ Parameters(DeleteStream { stream_id }): Parameters<DeleteStream>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(self.client.delete_stream(&id(&stream_id)?).await)
+ }
+
+ #[tool(description = "Purge stream")]
+ pub async fn purge_stream(
+ &self,
+ Parameters(PurgeStream { stream_id }): Parameters<PurgeStream>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(self.client.purge_stream(&id(&stream_id)?).await)
+ }
+
+ #[tool(description = "Get topics")]
+ pub async fn get_topics(
+ &self,
+ Parameters(GetTopics { stream_id }): Parameters<GetTopics>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_topics(&id(&stream_id)?).await)
+ }
+
+ #[tool(description = "Get topic")]
+ pub async fn get_topic(
+ &self,
+ Parameters(GetTopic {
+ stream_id,
+ topic_id,
+ }): Parameters<GetTopic>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(
+ self.client
+ .get_topic(&id(&stream_id)?, &id(&topic_id)?)
+ .await,
+ )
+ }
+
+ #[tool(description = "Create topic")]
+ pub async fn create_topic(
+ &self,
+ Parameters(CreateTopic {
+ stream_id,
+ name,
+ partitions_count,
+ compression_algorithm,
+ replication_factor,
+ topic_id,
+ message_expiry,
+ max_size,
+ }): Parameters<CreateTopic>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_create()?;
+ let compression_algorithm = compression_algorithm
+ .and_then(|ca| ca.parse().ok())
+ .unwrap_or_default();
+ let message_expiry = message_expiry
+ .and_then(|me| me.parse().ok())
+ .unwrap_or_default();
+ let max_size = max_size.and_then(|ms| ms.parse().ok()).unwrap_or_default();
+ request(
+ self.client
+ .create_topic(
+ &id(&stream_id)?,
+ &name,
+ partitions_count,
+ compression_algorithm,
+ replication_factor,
+ topic_id,
+ message_expiry,
+ max_size,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Update topic")]
+ pub async fn update_topic(
+ &self,
+ Parameters(UpdateTopic {
+ stream_id,
+ topic_id,
+ name,
+ compression_algorithm,
+ replication_factor,
+ message_expiry,
+ max_size,
+ }): Parameters<UpdateTopic>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_update()?;
+ let compression_algorithm = compression_algorithm
+ .and_then(|ca| ca.parse().ok())
+ .unwrap_or_default();
+ let message_expiry = message_expiry
+ .and_then(|me| me.parse().ok())
+ .unwrap_or_default();
+ let max_size = max_size.and_then(|ms| ms.parse().ok()).unwrap_or_default();
+ request(
+ self.client
+ .update_topic(
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ &name,
+ compression_algorithm,
+ replication_factor,
+ message_expiry,
+ max_size,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete topic")]
+ pub async fn delete_topic(
+ &self,
+ Parameters(DeleteTopic {
+ stream_id,
+ topic_id,
+ }): Parameters<DeleteTopic>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(
+ self.client
+ .delete_topic(&id(&stream_id)?, &id(&topic_id)?)
+ .await,
+ )
+ }
+
+ #[tool(description = "Purge topic")]
+ pub async fn purge_topic(
+ &self,
+ Parameters(PurgeTopic {
+ stream_id,
+ topic_id,
+ }): Parameters<PurgeTopic>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(
+ self.client
+ .purge_topic(&id(&stream_id)?, &id(&topic_id)?)
+ .await,
+ )
+ }
+
+ #[tool(description = "Create partitions")]
+ pub async fn create_partitions(
+ &self,
+ Parameters(CreatePartitions {
+ stream_id,
+ topic_id,
+ partitions_count,
+ }): Parameters<CreatePartitions>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_create()?;
+ request(
+ self.client
+ .create_partitions(&id(&stream_id)?, &id(&topic_id)?, partitions_count)
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete partitions")]
+ pub async fn delete_partitions(
+ &self,
+ Parameters(DeletePartitions {
+ stream_id,
+ topic_id,
+ partitions_count,
+ }): Parameters<DeletePartitions>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(
+ self.client
+ .delete_partitions(&id(&stream_id)?, &id(&topic_id)?, partitions_count)
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete segments")]
+ pub async fn delete_segments(
+ &self,
+ Parameters(DeleteSegments {
+ stream_id,
+ topic_id,
+ partition_id,
+ segments_count,
+ }): Parameters<DeleteSegments>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(
+ self.client
+ .delete_segments(
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ partition_id,
+ segments_count,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Poll messages")]
+ pub async fn poll_messages(
+ &self,
+ Parameters(PollMessages {
+ stream_id,
+ topic_id,
+ partition_id,
+ strategy,
+ offset,
+ timestamp,
+ count,
+ auto_commit,
+ }): Parameters<PollMessages>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ let offset = offset.unwrap_or(0);
+ let count = count.unwrap_or(10);
+ let mut auto_commit = auto_commit.unwrap_or(false);
+ let strategy = if let Some(strategy) = strategy {
+ match strategy.as_str() {
+ "offset" => PollingStrategy::offset(offset),
+ "first" => PollingStrategy::first(),
+ "last" => PollingStrategy::last(),
+ "next" => PollingStrategy::next(),
+ "timestamp" => PollingStrategy::timestamp(IggyTimestamp::from(
+ timestamp.unwrap_or(IggyTimestamp::now().as_micros()),
+ )),
+ _ => PollingStrategy::offset(offset),
+ }
+ } else {
+ PollingStrategy::offset(offset)
+ };
+ if strategy.kind == PollingKind::Next {
+ auto_commit = true;
+ }
+
+ request(
+ self.client
+ .poll_messages(
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ partition_id,
+ &self.consumer,
+ &strategy,
+ count,
+ auto_commit,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Send messages")]
+ pub async fn send_messages(
+ &self,
+ Parameters(SendMessages {
+ stream_id,
+ topic_id,
+ partition_id,
+ partitioning,
+ messages_key,
+ messages,
+ }): Parameters<SendMessages>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_create()?;
+ let partitioning = if let Some(partitioning) = partitioning {
+ match partitioning.as_str() {
+ "balanced" => Partitioning::balanced(),
+ "key" => {
+ let key = messages_key.unwrap_or_default().as_bytes().to_vec();
+ if key.is_empty() {
+ return Err(ErrorData::invalid_request(
+ "Messages key cannot be empty",
+ None,
+ ));
+ }
+
+ Partitioning::messages_key(&key).map_err(|error| {
+ ErrorData::invalid_request(format!("Invalid messages key: {error}"), None)
+ })?
+ }
+ "partition" => Partitioning::partition_id(partition_id.unwrap_or(1)),
+ _ => Partitioning::balanced(),
+ }
+ } else {
+ Partitioning::balanced()
+ };
+
+ let mut messages = messages
+ .into_iter()
+ .flat_map(|message| {
+ if let Some(id) = message.id {
+ return IggyMessage::builder()
+ .id(id)
+ .payload(message.payload.into())
+ .build();
+ }
+
+ IggyMessage::builder()
+ .payload(message.payload.into())
+ .build()
+ })
+ .collect::<Vec<_>>();
+
+ request(
+ self.client
+ .send_messages(
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ &partitioning,
+ &mut messages,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Get stats")]
+ pub async fn get_stats(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_stats().await)
+ }
+
+ #[tool(description = "Get me")]
+ pub async fn get_me(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_me().await)
+ }
+
+ #[tool(description = "Get client")]
+ pub async fn get_client(
+ &self,
+ Parameters(GetClient { client_id }): Parameters<GetClient>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_client(client_id).await)
+ }
+
+ #[tool(description = "Get clients")]
+ pub async fn get_clients(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_clients().await)
+ }
+
+ #[tool(description = "Snapshot")]
+ pub async fn snapshot(
+ &self,
+ Parameters(Snapshot { compression, types }): Parameters<Snapshot>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ let compression = compression.and_then(|c| c.parse().ok()).unwrap_or_default();
+ let mut types = types
+ .into_iter()
+ .flatten()
+ .flat_map(|t| t.parse().ok())
+ .collect::<Vec<_>>();
+ if types.is_empty() {
+ types = SystemSnapshotType::all_snapshot_types();
+ }
+
+ request(self.client.snapshot(compression, types).await)
+ }
+
+ #[tool(description = "Get consumer groups")]
+ pub async fn get_consumer_groups(
+ &self,
+ Parameters(GetConsumerGroups {
+ stream_id,
+ topic_id,
+ }): Parameters<GetConsumerGroups>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(
+ self.client
+ .get_consumer_groups(&id(&stream_id)?, &id(&topic_id)?)
+ .await,
+ )
+ }
+
+ #[tool(description = "Get consumer group")]
+ pub async fn get_consumer_group(
+ &self,
+ Parameters(GetConsumerGroup {
+ stream_id,
+ topic_id,
+ group_id,
+ }): Parameters<GetConsumerGroup>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(
+ self.client
+ .get_consumer_group(&id(&stream_id)?, &id(&topic_id)?, &id(&group_id)?)
+ .await,
+ )
+ }
+
+ #[tool(description = "Create consumer group")]
+ pub async fn create_consumer_group(
+ &self,
+ Parameters(CreateConsumerGroup {
+ stream_id,
+ topic_id,
+ name,
+ group_id,
+ }): Parameters<CreateConsumerGroup>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_create()?;
+ request(
+ self.client
+ .create_consumer_group(&id(&stream_id)?, &id(&topic_id)?, &name, group_id)
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete consumer group")]
+ pub async fn delete_consumer_group(
+ &self,
+ Parameters(DeleteConsumerGroup {
+ stream_id,
+ topic_id,
+ group_id,
+ }): Parameters<DeleteConsumerGroup>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(
+ self.client
+ .delete_consumer_group(&id(&stream_id)?, &id(&topic_id)?, &id(&group_id)?)
+ .await,
+ )
+ }
+
+ #[tool(description = "Get consumer offset")]
+ pub async fn get_consumer_offset(
+ &self,
+ Parameters(GetConsumerOffset {
+ stream_id,
+ topic_id,
+ partition_id,
+ }): Parameters<GetConsumerOffset>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(
+ self.client
+ .get_consumer_offset(
+ &self.consumer,
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ partition_id,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Store consumer offset")]
+ pub async fn store_consumer_offset(
+ &self,
+ Parameters(StoreConsumerOffset {
+ stream_id,
+ topic_id,
+ partition_id,
+ offset,
+ }): Parameters<StoreConsumerOffset>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(
+ self.client
+ .store_consumer_offset(
+ &self.consumer,
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ partition_id,
+ offset,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete consumer offset")]
+ pub async fn delete_consumer_offset(
+ &self,
+ Parameters(DeleteConsumerOffset {
+ stream_id,
+ topic_id,
+ partition_id,
+ }): Parameters<DeleteConsumerOffset>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(
+ self.client
+ .delete_consumer_offset(
+ &self.consumer,
+ &id(&stream_id)?,
+ &id(&topic_id)?,
+ partition_id,
+ )
+ .await,
+ )
+ }
+
+ #[tool(description = "Get personal access tokens")]
+ pub async fn get_personal_access_tokens(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_personal_access_tokens().await)
+ }
+
+ #[tool(description = "Create personal access token")]
+ pub async fn create_personal_access_token(
+ &self,
+ Parameters(CreatePersonalAccessToken { name, expiry }): Parameters<
+ CreatePersonalAccessToken,
+ >,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ let expiry = expiry
+ .and_then(|expiry| expiry.parse().ok())
+ .unwrap_or_default();
+ request(
+ self.client
+ .create_personal_access_token(&name, expiry)
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete personal access token")]
+ pub async fn delete_personal_access_token(
+ &self,
+ Parameters(DeletePersonalAccessToken { name }): Parameters<DeletePersonalAccessToken>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.delete_personal_access_token(&name).await)
+ }
+
+ #[tool(description = "Get users")]
+ pub async fn get_users(&self) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_users().await)
+ }
+
+ #[tool(description = "Get user")]
+ pub async fn get_user(
+ &self,
+ Parameters(GetUser { user_id }): Parameters<GetUser>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_read()?;
+ request(self.client.get_user(&id(&user_id)?).await)
+ }
+
+ #[tool(description = "Create user")]
+ pub async fn create_user(
+ &self,
+ Parameters(CreateUser {
+ username,
+ password,
+ active,
+ permissions,
+ }): Parameters<CreateUser>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_create()?;
+ let status = if active.unwrap_or_default() {
+ UserStatus::Active
+ } else {
+ UserStatus::Inactive
+ };
+ let permissions = permissions.map(|p| p.into());
+ request(
+ self.client
+ .create_user(&username, &password, status, permissions)
+ .await,
+ )
+ }
+
+ #[tool(description = "Update user")]
+ pub async fn update_user(
+ &self,
+ Parameters(UpdateUser {
+ user_id,
+ username,
+ active,
+ }): Parameters<UpdateUser>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_update()?;
+ let status = active.map(|active| {
+ if active {
+ UserStatus::Active
+ } else {
+ UserStatus::Inactive
+ }
+ });
+ request(
+ self.client
+ .update_user(&id(&user_id)?, username.as_deref(), status)
+ .await,
+ )
+ }
+
+ #[tool(description = "Delete user")]
+ pub async fn delete_user(
+ &self,
+ Parameters(DeleteUser { user_id }): Parameters<DeleteUser>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_delete()?;
+ request(self.client.delete_user(&id(&user_id)?).await)
+ }
+
+ #[tool(description = "Update permissions")]
+ pub async fn update_permissions(
+ &self,
+ Parameters(UpdatePermissions {
+ user_id,
+ permissions,
+ }): Parameters<UpdatePermissions>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_update()?;
+ let permissions = permissions.map(|p| p.into());
+ request(
+ self.client
+ .update_permissions(&id(&user_id)?, permissions)
+ .await,
+ )
+ }
+
+ #[tool(description = "Change password")]
+ pub async fn change_password(
+ &self,
+ Parameters(ChangePassword {
+ user_id,
+ current_password,
+ new_password,
+ }): Parameters<ChangePassword>,
+ ) -> Result<CallToolResult, ErrorData> {
+ self.permissions.ensure_update()?;
+ request(
+ self.client
+ .change_password(&id(&user_id)?, ¤t_password, &new_password)
+ .await,
+ )
+ }
+}
+
+#[tool_handler]
+impl ServerHandler for IggyService {
+ fn get_info(&self) -> ServerInfo {
+ ServerInfo {
+ instructions: Some("Iggy service".into()),
+ capabilities: ServerCapabilities::builder().enable_tools().build(),
+ ..Default::default()
+ }
+ }
+}
+
+fn id(id: &str) -> Result<Identifier, ErrorData> {
+ Identifier::from_str_value(id).map_err(|e| {
+ let message = format!("Failed to parse identifier. {e}");
+ error!(message);
+ ErrorData::invalid_request(message, None)
+ })
+}
+
+fn request(result: Result<impl Sized + Serialize, IggyError>) -> Result<CallToolResult, ErrorData> {
+ let result = result.map_err(|e| {
+ let message = format!("There was an error when invoking the method. {e}");
+ error!(message);
+ ErrorData::invalid_request(message, None)
+ })?;
+
+ let content = Content::json(result).map_err(|error| {
+ let message = format!("Failed to serialize result. {error}");
+ error!(message);
+ ErrorData::internal_error(message, None)
+ })?;
+
+ Ok(CallToolResult::success(vec![content]))
+}
diff --git a/core/ai/mcp/src/service/requests.rs b/core/ai/mcp/src/service/requests.rs
new file mode 100644
index 00000000..1a8aea5c
--- /dev/null
+++ b/core/ai/mcp/src/service/requests.rs
@@ -0,0 +1,559 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use std::collections::HashMap;
+
+use iggy::prelude;
+use rmcp::schemars::{self, JsonSchema};
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetStream {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct CreateStream {
+ #[schemars(description = "stream name (required, must be unique)")]
+ pub name: String,
+ #[schemars(description = "stream identifier (numeric, optional)")]
+ pub stream_id: Option<u32>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct UpdateStream {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+ #[schemars(description = "stream name (required, must be unique)")]
+ pub name: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeleteStream {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct PurgeStream {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetTopics {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetTopic {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct CreateTopic {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "name (required, must be unique)")]
+ pub name: String,
+
+ #[schemars(description = "partitions count (required, must be greater than 0)")]
+ pub partitions_count: u32,
+
+ #[schemars(description = "compression algorithm (optional, can be one of 'none', 'gzip')")]
+ pub compression_algorithm: Option<String>,
+
+ #[schemars(description = "replication factor (optional, must be greater than 0)")]
+ pub replication_factor: Option<u8>,
+
+ #[schemars(description = "topic identifier (numeric, optional)")]
+ pub topic_id: Option<u32>,
+
+ #[schemars(description = "message expiry (optional)")]
+ pub message_expiry: Option<String>,
+
+ #[schemars(description = "maximum size (optional)")]
+ pub max_size: Option<String>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct UpdateTopic {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "name (required, must be unique)")]
+ pub name: String,
+
+ #[schemars(description = "compression algorithm (optional, can be one of 'none', 'gzip')")]
+ pub compression_algorithm: Option<String>,
+
+ #[schemars(description = "replication factor (optional, must be greater than 0)")]
+ pub replication_factor: Option<u8>,
+
+ #[schemars(description = "message expiry (optional)")]
+ pub message_expiry: Option<String>,
+
+ #[schemars(description = "maximum size (optional)")]
+ pub max_size: Option<String>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeleteTopic {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct PurgeTopic {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct CreatePartitions {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partitions count (required, must be greater than 0)")]
+ pub partitions_count: u32,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeletePartitions {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partitions count (required, must be greater than 0)")]
+ pub partitions_count: u32,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeleteSegments {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partition identifier (number)")]
+ pub partition_id: u32,
+
+ #[schemars(description = "segments count (required, must be greater than 0)")]
+ pub segments_count: u32,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct PollMessages {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partition identifier (optional, number)")]
+ pub partition_id: Option<u32>,
+
+ #[schemars(description = "strategy (optional, string)")]
+ pub strategy: Option<String>,
+
+ #[schemars(description = "offset to start from (optional)")]
+ pub offset: Option<u64>,
+
+ #[schemars(description = "timestamp to start from (optional, microseconds from Unix Epoch)")]
+ pub timestamp: Option<u64>,
+
+ #[schemars(description = "count (optional, must be greater than 0)")]
+ pub count: Option<u32>,
+
+ #[schemars(description = "auto commit (optional, boolean)")]
+ pub auto_commit: Option<bool>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct SendMessages {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partition identifier (optional, number)")]
+ pub partition_id: Option<u32>,
+
+ #[schemars(description = "partitioning (optional, string)")]
+ pub partitioning: Option<String>,
+
+ #[schemars(description = "messages key (optional, string)")]
+ pub messages_key: Option<String>,
+
+ #[schemars(description = "messages collection")]
+ pub messages: Vec<Message>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct Message {
+ #[schemars(description = "message identifier (optional, number)")]
+ pub id: Option<u128>,
+
+ #[schemars(description = "message payload, base64 encoded string")]
+ pub payload: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetClient {
+ #[schemars(description = "client identifier (number)")]
+ pub client_id: u32,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct Snapshot {
+ #[schemars(description = "compression (optional, string)")]
+ pub compression: Option<String>,
+
+ #[schemars(description = "types")]
+ pub types: Option<Vec<String>>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetConsumerGroup {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "consumer group identifier (name or number)")]
+ pub group_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetConsumerGroups {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct CreateConsumerGroup {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "consumer group name (required, must be unique)")]
+ pub name: String,
+
+ #[schemars(description = "consumer group identifier (optional, number)")]
+ pub group_id: Option<u32>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeleteConsumerGroup {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "consumer group identifier (name or number)")]
+ pub group_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetConsumerOffset {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partition identifier (optional, number)")]
+ pub partition_id: Option<u32>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct StoreConsumerOffset {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partition identifier (optional, number)")]
+ pub partition_id: Option<u32>,
+
+ #[schemars(description = "offset (required, number)")]
+ pub offset: u64,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeleteConsumerOffset {
+ #[schemars(description = "stream identifier (name or number)")]
+ pub stream_id: String,
+
+ #[schemars(description = "topic identifier (name or number)")]
+ pub topic_id: String,
+
+ #[schemars(description = "partition identifier (optional, number)")]
+ pub partition_id: Option<u32>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct CreatePersonalAccessToken {
+ #[schemars(description = "personal access token name")]
+ pub name: String,
+
+ #[schemars(description = "personal access token expiry(optional)")]
+ pub expiry: Option<String>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeletePersonalAccessToken {
+ #[schemars(description = "personal access token name")]
+ pub name: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GetUser {
+ #[schemars(description = "user identifier (name or number)")]
+ pub user_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct CreateUser {
+ #[schemars(description = "username")]
+ pub username: String,
+
+ #[schemars(description = "password")]
+ pub password: String,
+
+ #[schemars(description = "active (optional)")]
+ pub active: Option<bool>,
+
+ #[schemars(description = "permissions (optional)")]
+ pub permissions: Option<Permissions>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct UpdateUser {
+ #[schemars(description = "user identifier (name or number)")]
+ pub user_id: String,
+
+ #[schemars(description = "username (optional)")]
+ pub username: Option<String>,
+
+ #[schemars(description = "active (optional)")]
+ pub active: Option<bool>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct UpdatePermissions {
+ #[schemars(description = "user identifier (name or number)")]
+ pub user_id: String,
+
+ #[schemars(description = "permissions (optional)")]
+ pub permissions: Option<Permissions>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct DeleteUser {
+ #[schemars(description = "user identifier (name or number)")]
+ pub user_id: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct ChangePassword {
+ #[schemars(description = "user identifier (name or number)")]
+ pub user_id: String,
+
+ #[schemars(description = "current password")]
+ pub current_password: String,
+
+ #[schemars(description = "new password")]
+ pub new_password: String,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct Permissions {
+ #[schemars(description = "global permissions (optional)")]
+ pub global: Option<GlobalPermissions>,
+
+ #[schemars(description = "stream permissions (optional)")]
+ pub streams: Option<HashMap<u32, StreamPermissions>>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct GlobalPermissions {
+ #[schemars(description = "manage servers (optional)")]
+ pub manage_servers: Option<bool>,
+
+ #[schemars(description = "read servers (optional)")]
+ pub read_servers: Option<bool>,
+
+ #[schemars(description = "manage users (optional)")]
+ pub manage_users: Option<bool>,
+
+ #[schemars(description = "read users (optional)")]
+ pub read_users: Option<bool>,
+
+ #[schemars(description = "manage streams (optional)")]
+ pub manage_streams: Option<bool>,
+
+ #[schemars(description = "read streams (optional)")]
+ pub read_streams: Option<bool>,
+
+ #[schemars(description = "manage topics (optional)")]
+ pub manage_topics: Option<bool>,
+
+ #[schemars(description = "read topics (optional)")]
+ pub read_topics: Option<bool>,
+
+ #[schemars(description = "poll messages (optional)")]
+ pub poll_messages: Option<bool>,
+
+ #[schemars(description = "send messages (optional)")]
+ pub send_messages: Option<bool>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct StreamPermissions {
+ #[schemars(description = "manage stream (optional)")]
+ pub manage_stream: Option<bool>,
+
+ #[schemars(description = "read stream (optional)")]
+ pub read_stream: Option<bool>,
+
+ #[schemars(description = "manage topics (optional)")]
+ pub manage_topics: Option<bool>,
+
+ #[schemars(description = "read topics (optional)")]
+ pub read_topics: Option<bool>,
+
+ #[schemars(description = "poll messages (optional)")]
+ pub poll_messages: Option<bool>,
+
+ #[schemars(description = "send messages (optional)")]
+ pub send_messages: Option<bool>,
+
+ #[schemars(description = "topics permissions (optional)")]
+ pub topics: Option<HashMap<u32, TopicPermissions>>,
+}
+
+#[derive(Debug, Deserialize, JsonSchema)]
+pub struct TopicPermissions {
+ #[schemars(description = "manage topic (optional)")]
+ pub manage_topic: Option<bool>,
+
+ #[schemars(description = "read topic (optional)")]
+ pub read_topic: Option<bool>,
+
+ #[schemars(description = "poll messages (optional)")]
+ pub poll_messages: Option<bool>,
+
+ #[schemars(description = "send messages (optional)")]
+ pub send_messages: Option<bool>,
+}
+
+impl From<Permissions> for prelude::Permissions {
+ fn from(permissions: Permissions) -> Self {
+ prelude::Permissions {
+ global: permissions
+ .global
+ .map(|global| global.into())
+ .unwrap_or_default(),
+ streams: permissions.streams.map(|streams| {
+ streams
+ .into_iter()
+ .map(|(id, stream)| (id, stream.into()))
+ .collect()
+ }),
+ }
+ }
+}
+
+impl From<GlobalPermissions> for prelude::GlobalPermissions {
+ fn from(permissions: GlobalPermissions) -> Self {
+ prelude::GlobalPermissions {
+ manage_servers: permissions.manage_servers.unwrap_or_default(),
+ read_servers: permissions.read_servers.unwrap_or_default(),
+ manage_users: permissions.manage_users.unwrap_or_default(),
+ read_users: permissions.read_users.unwrap_or_default(),
+ manage_streams: permissions.manage_streams.unwrap_or_default(),
+ read_streams: permissions.read_streams.unwrap_or_default(),
+ manage_topics: permissions.manage_topics.unwrap_or_default(),
+ read_topics: permissions.read_topics.unwrap_or_default(),
+ poll_messages: permissions.poll_messages.unwrap_or_default(),
+ send_messages: permissions.send_messages.unwrap_or_default(),
+ }
+ }
+}
+
+impl From<StreamPermissions> for prelude::StreamPermissions {
+ fn from(permissions: StreamPermissions) -> Self {
+ prelude::StreamPermissions {
+ manage_stream: permissions.manage_stream.unwrap_or_default(),
+ read_stream: permissions.read_stream.unwrap_or_default(),
+ manage_topics: permissions.manage_topics.unwrap_or_default(),
+ read_topics: permissions.read_topics.unwrap_or_default(),
+ poll_messages: permissions.poll_messages.unwrap_or_default(),
+ send_messages: permissions.send_messages.unwrap_or_default(),
+ topics: permissions.topics.map(|topics| {
+ topics
+ .into_iter()
+ .map(|(id, topic)| (id, topic.into()))
+ .collect()
+ }),
+ }
+ }
+}
+
+impl From<TopicPermissions> for prelude::TopicPermissions {
+ fn from(permissions: TopicPermissions) -> Self {
+ prelude::TopicPermissions {
+ manage_topic: permissions.manage_topic.unwrap_or_default(),
+ read_topic: permissions.read_topic.unwrap_or_default(),
+ poll_messages: permissions.poll_messages.unwrap_or_default(),
+ send_messages: permissions.send_messages.unwrap_or_default(),
+ }
+ }
+}
diff --git a/core/ai/mcp/src/stream.rs b/core/ai/mcp/src/stream.rs
new file mode 100644
index 00000000..da47faeb
--- /dev/null
+++ b/core/ai/mcp/src/stream.rs
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::{configs::IggyConfig, error::McpRuntimeError};
+use iggy::prelude::{Client, IggyClient, IggyClientBuilder};
+use tracing::{error, info};
+
+pub async fn init(config: IggyConfig) -> Result<IggyClient, McpRuntimeError> {
+ let address = config.address;
+ let username = config.username;
+ let password = config.password;
+ let token = config.token;
+
+ let connection_string = if let Some(token) = token {
+ if token.is_empty() {
+ error!("Iggy token cannot be empty (if username and password are not provided)");
+ return Err(McpRuntimeError::MissingIggyCredentials);
+ }
+
+ let redacted_token = token.chars().take(3).collect::<String>();
+ info!("Using token: {redacted_token}*** for Iggy authentication");
+ format!("iggy://{token}@{address}")
+ } else {
+ info!("Using username and password for Iggy authentication");
+ let username = username.ok_or(McpRuntimeError::MissingIggyCredentials)?;
+ if username.is_empty() {
+ error!("Iggy password cannot be empty (if token is not provided)");
+ return Err(McpRuntimeError::MissingIggyCredentials);
+ }
+
+ let password = password.ok_or(McpRuntimeError::MissingIggyCredentials)?;
+ if password.is_empty() {
+ error!("Iggy password cannot be empty (if token is not provided)");
+ return Err(McpRuntimeError::MissingIggyCredentials);
+ }
+
+ let redacted_username = username.chars().take(3).collect::<String>();
+ let redacted_password = password.chars().take(3).collect::<String>();
+ info!(
+ "Using username: {redacted_username}***, password: {redacted_password}*** for Iggy authentication"
+ );
+ format!("iggy://{username}:{password}@{address}")
+ };
+
+ let client = IggyClientBuilder::from_connection_string(&connection_string)?.build()?;
+ client.connect().await?;
+ Ok(client)
+}
diff --git a/core/bench/dashboard/frontend/index.prod.html b/core/bench/dashboard/frontend/index.prod.html
index dd398c9e..de430f33 100644
--- a/core/bench/dashboard/frontend/index.prod.html
+++ b/core/bench/dashboard/frontend/index.prod.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -19,36 +19,42 @@
-->
<html>
-
-<head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <meta http-equiv="Content-Security-Policy" content="default-src 'self' https://benchmarks.iggy.rs;
- connect-src 'self' https://benchmarks.iggy.rs;
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
+ <meta
+ http-equiv="Content-Security-Policy"
+ content="default-src 'self' https://benchmarks.iggy.apache.org;
+ connect-src 'self' https://benchmarks.iggy.apache.org;
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net;
script-src-elem 'self' 'unsafe-inline' https://cdn.jsdelivr.net;
style-src 'self' 'unsafe-inline';
- img-src 'self' data:;">
- <base href="/">
- <title>Apache Iggy Benchmarks Dashboard</title>
- <link data-trunk rel="copy-dir" href="assets" />
- <link data-trunk rel="rust" data-wasm-opt="z" />
- <link data-trunk rel="css" href="assets/style.css" />
- <script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/echarts-gl@2.0.9/dist/echarts-gl.min.js"></script>
- <script async src="https://www.googletagmanager.com/gtag/js?id=G-0972B5SEN0"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag() { dataLayer.push(arguments); }
- gtag('js', new Date());
-
- gtag('config', 'G-0972B5SEN0');
- </script>
-</head>
+ img-src 'self' data:;"
+ />
+ <base href="/" />
+ <title>Apache Iggy Benchmarks Dashboard</title>
+ <link data-trunk rel="copy-dir" href="assets" />
+ <link data-trunk rel="rust" data-wasm-opt="z" />
+ <link data-trunk rel="css" href="assets/style.css" />
+ <script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/echarts-gl@2.0.9/dist/echarts-gl.min.js"></script>
+ <script
+ async
+ src="https://www.googletagmanager.com/gtag/js?id=G-0972B5SEN0"
+ ></script>
+ <script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag() {
+ dataLayer.push(arguments);
+ }
+ gtag("js", new Date());
-<body>
- <div id="app"></div>
-</body>
+ gtag("config", "G-0972B5SEN0");
+ </script>
+ </head>
+ <body>
+ <div id="app"></div>
+ </body>
</html>
diff --git a/core/bench/dashboard/frontend/src/config.rs b/core/bench/dashboard/frontend/src/config.rs
index 75523e78..07e2e4f8 100644
--- a/core/bench/dashboard/frontend/src/config.rs
+++ b/core/bench/dashboard/frontend/src/config.rs
@@ -33,7 +33,7 @@ pub fn get_api_base_url() -> String {
// In release mode, try to get from window.API_BASE_URL if it exists
let window = match web_sys::window() {
Some(win) => win,
- None => return "https://benchmarks.iggy.rs".to_string(),
+ None => return "https://benchmarks.iggy.apache.org".to_string(),
};
if let Some(api_url) = Reflect::get(&window, &JsValue::from_str("API_BASE_URL"))
@@ -52,5 +52,5 @@ pub fn get_api_base_url() -> String {
}
// Fallback to production URL
- "https://benchmarks.iggy.rs".to_string()
+ "https://benchmarks.iggy.apache.org".to_string()
}
diff --git a/core/bench/dashboard/server/Cargo.toml b/core/bench/dashboard/server/Cargo.toml
index d7792b10..42f20670 100644
--- a/core/bench/dashboard/server/Cargo.toml
+++ b/core/bench/dashboard/server/Cargo.toml
@@ -13,8 +13,8 @@ bench-report = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
clap = { workspace = true }
dashmap = { workspace = true }
-file-operation = "0.5.12"
-notify = "8.0.0"
+file-operation = "0.5.16"
+notify = "8.1.0"
octocrab = "0.44.1"
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
diff --git a/core/bench/src/analytics/time_series/processors/moving_average.rs b/core/bench/src/analytics/time_series/processors/moving_average.rs
index 292fbba1..5aa881b9 100644
--- a/core/bench/src/analytics/time_series/processors/moving_average.rs
+++ b/core/bench/src/analytics/time_series/processors/moving_average.rs
@@ -43,14 +43,19 @@ impl TimeSeriesProcessor for MovingAverageProcessor {
let mut window: VecDeque<f64> = VecDeque::with_capacity(self.window_size);
let mut points = Vec::with_capacity(data.points.len());
+ let mut sum = 0.0;
for point in &data.points {
window.push_back(point.value);
+ sum += point.value;
+
if window.len() > self.window_size {
- window.pop_front();
+ if let Some(old_value) = window.pop_front() {
+ sum -= old_value;
+ }
}
- let avg = window.iter().sum::<f64>() / window.len() as f64;
+ let avg = sum / window.len() as f64;
let rounded_avg = (avg * 1000.0).round() / 1000.0;
points.push(TimePoint::new(point.time_s, rounded_avg));
}
diff --git a/core/cli/Cargo.toml b/core/cli/Cargo.toml
index 7b9c3fbc..7491954d 100644
--- a/core/cli/Cargo.toml
+++ b/core/cli/Cargo.toml
@@ -39,7 +39,7 @@ login-session = ["dep:keyring"]
ahash = { workspace = true }
anyhow = { workspace = true }
clap = { workspace = true }
-clap_complete = "4.5.54"
+clap_complete = "4.5.55"
figlet-rs = { workspace = true }
iggy = { workspace = true }
iggy_binary_protocol = { workspace = true }
diff --git a/core/common/Cargo.toml b/core/common/Cargo.toml
index 443b0150..80f92ebc 100644
--- a/core/common/Cargo.toml
+++ b/core/common/Cargo.toml
@@ -46,7 +46,7 @@ crc32fast = { workspace = true }
derive_more = { workspace = true }
fast-async-mutex = { version = "0.6.7", optional = true }
humantime = { workspace = true }
-rcgen = "0.13.2"
+rcgen = "0.14.3"
rustls = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
diff --git a/core/common/src/certificates.rs b/core/common/src/certificates.rs
index 03056e99..f697b776 100644
--- a/core/common/src/certificates.rs
+++ b/core/common/src/certificates.rs
@@ -25,7 +25,7 @@ pub fn generate_self_signed_certificate(
) -> Result<(Vec<CertificateDer<'static>>, PrivateKeyDer<'static>), Box<dyn std::error::Error>> {
let cert = rcgen::generate_simple_self_signed(vec![domain.to_string()])?;
let cert_der = cert.cert.der();
- let key_der = cert.key_pair.serialize_der();
+ let key_der = cert.signing_key.serialize_der();
let key = PrivateKeyDer::try_from(key_der)?;
Ok((vec![cert_der.clone()], key))
}
diff --git a/docker-compose.yml b/core/connectors/runtime/Dockerfile
similarity index 67%
copy from docker-compose.yml
copy to core/connectors/runtime/Dockerfile
index 347bef1b..8ce273db 100644
--- a/docker-compose.yml
+++ b/core/connectors/runtime/Dockerfile
@@ -15,26 +15,17 @@
# specific language governing permissions and limitations
# under the License.
-version: '3.5'
-services:
+FROM rust:latest AS builder
+WORKDIR /build
+COPY . /build
+RUN cargo build --bin iggy-connectors --release
- iggy-server:
- build: .
- container_name: iggy-server
- restart: unless-stopped
- networks:
- - iggy
- ports:
- - 3000:3000
- - 8080:8080
- - 8090:8090
- volumes:
- - iggy-server:/local_data
+FROM debian:bookworm-slim
+RUN apt-get update && apt-get install -y \
+ ca-certificates \
+ liblzma5 \
+ && rm -rf /var/lib/apt/lists/*
+COPY ./core/connectors/runtime/config.toml ./config.toml
+COPY --from=builder /build/target/release/iggy-connectors .
-volumes:
- iggy-server:
- driver: local
-
-networks:
- iggy:
- name: iggy-network
+CMD ["/iggy-connectors"]
diff --git a/core/connectors/runtime/src/api/mod.rs b/core/connectors/runtime/src/api/mod.rs
index b6987d1d..3c875836 100644
--- a/core/connectors/runtime/src/api/mod.rs
+++ b/core/connectors/runtime/src/api/mod.rs
@@ -80,7 +80,7 @@ pub async fn init(config: &HttpApiConfig, context: Arc<RuntimeContext>) {
)
.await
{
- error!("Failed to start {NAME} server, error {}", error);
+ error!("Failed to start {NAME} server, error: {error}");
}
});
return;
@@ -104,7 +104,7 @@ pub async fn init(config: &HttpApiConfig, context: Arc<RuntimeContext>) {
.serve(app.into_make_service_with_connect_info::<SocketAddr>())
.await
{
- error!("Failed to start {NAME} server, error: {}", error);
+ error!("Failed to start {NAME} server, error: {error}");
}
});
}
diff --git a/core/connectors/sdk/Cargo.toml b/core/connectors/sdk/Cargo.toml
index fa5804a1..120491a6 100644
--- a/core/connectors/sdk/Cargo.toml
+++ b/core/connectors/sdk/Cargo.toml
@@ -36,14 +36,14 @@ async-trait = { workspace = true }
base64 = "0.22.1"
chrono = { workspace = true }
dashmap = { workspace = true }
-flatbuffers = "24.3.25"
+flatbuffers = "25.2.10"
iggy = { workspace = true }
once_cell = { workspace = true }
postcard = { workspace = true }
-prost = "0.13.5"
-prost-types = "0.13.5"
-protox = "0.8.0"
-protox-parse = "0.8.0"
+prost = "0.14.1"
+prost-types = "0.14.1"
+protox = "0.9.0"
+protox-parse = "0.9.0"
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
diff --git a/core/integration/Cargo.toml b/core/integration/Cargo.toml
index bd195275..f9982bff 100644
--- a/core/integration/Cargo.toml
+++ b/core/integration/Cargo.toml
@@ -45,7 +45,14 @@ lazy_static = { workspace = true }
libc = "0.2.174"
log = { workspace = true }
predicates = { workspace = true }
-rcgen = "0.13.2"
+rand = { workspace = true }
+rcgen = "0.14.3"
+reqwest = { workspace = true }
+rmcp = { version = "0.3.0", features = [
+ "client",
+ "reqwest",
+ "transport-streamable-http-client",
+] }
serial_test = { workspace = true }
server = { workspace = true }
tempfile = { workspace = true }
diff --git a/core/integration/src/lib.rs b/core/integration/src/lib.rs
index 1f65508b..88c51ac1 100644
--- a/core/integration/src/lib.rs
+++ b/core/integration/src/lib.rs
@@ -25,5 +25,7 @@ pub mod quic_client;
#[allow(deprecated)]
pub mod tcp_client;
#[allow(deprecated)]
+pub mod test_mcp_server;
+#[allow(deprecated)]
pub mod test_server;
pub mod test_tls_utils;
diff --git a/core/integration/src/quic_client.rs b/core/integration/src/quic_client.rs
index 2899af37..7769a46d 100644
--- a/core/integration/src/quic_client.rs
+++ b/core/integration/src/quic_client.rs
@@ -19,7 +19,7 @@
use crate::test_server::{ClientFactory, Transport};
use async_trait::async_trait;
use iggy::prelude::{Client, ClientWrapper, QuicClientConfig};
-use iggy::quic::quick_client::QuicClient;
+use iggy::quic::quic_client::QuicClient;
use std::sync::Arc;
#[derive(Debug, Clone)]
diff --git a/core/integration/src/test_mcp_server.rs b/core/integration/src/test_mcp_server.rs
new file mode 100644
index 00000000..8334e5f8
--- /dev/null
+++ b/core/integration/src/test_mcp_server.rs
@@ -0,0 +1,232 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use assert_cmd::prelude::CommandCargoExt;
+use rand::Rng;
+use rmcp::{
+ RoleClient, ServiceExt,
+ model::{ClientCapabilities, ClientInfo, Implementation, InitializeRequestParam},
+ service::RunningService,
+ transport::StreamableHttpClientTransport,
+};
+use std::fs::OpenOptions;
+use std::io::Write;
+use std::net::{Ipv4Addr, SocketAddr};
+use std::path::PathBuf;
+use std::process::{Child, Command};
+use std::time::Duration;
+use std::{collections::HashMap, net::TcpListener};
+use tokio::time::sleep;
+
+pub const CONSUMER_NAME: &str = "mcp";
+const MCP_PATH: &str = "/mcp";
+
+pub type McpClient = RunningService<RoleClient, InitializeRequestParam>;
+
+#[derive(Debug)]
+pub struct TestMcpServer {
+ envs: HashMap<String, String>,
+ child_handle: Option<Child>,
+ server_address: SocketAddr,
+ stdout_file_path: Option<PathBuf>,
+ stderr_file_path: Option<PathBuf>,
+ server_executable_path: Option<String>,
+}
+
+impl TestMcpServer {
+ pub fn with_iggy_address(iggy_tcp_server_address: &str) -> Self {
+ Self::new(iggy_tcp_server_address, None, None)
+ }
+
+ pub fn new(
+ iggy_tcp_server_address: &str,
+ extra_envs: Option<HashMap<String, String>>,
+ server_executable_path: Option<String>,
+ ) -> Self {
+ let mut envs = HashMap::new();
+ if let Some(extra) = extra_envs {
+ for (key, value) in extra {
+ envs.insert(key, value);
+ }
+ }
+
+ envs.insert("IGGY_MCP_HTTP_PATH".to_string(), MCP_PATH.to_string());
+ envs.insert(
+ "IGGY_MCP_IGGY_ADDRESS".to_string(),
+ iggy_tcp_server_address.to_string(),
+ );
+ envs.insert(
+ "IGGY_MCP_IGGY_CONSUMER".to_string(),
+ CONSUMER_NAME.to_string(),
+ );
+ envs.insert("IGGY_MCP_TRANSPORT".to_string(), "http".to_string());
+ Self::create(envs, server_executable_path)
+ }
+
+ pub fn create(envs: HashMap<String, String>, server_executable_path: Option<String>) -> Self {
+ let server_address = Self::get_random_server_address();
+
+ Self {
+ envs,
+ child_handle: None,
+ server_address,
+ stdout_file_path: None,
+ stderr_file_path: None,
+ server_executable_path,
+ }
+ }
+
+ pub fn start(&mut self) {
+ self.envs
+ .entry("IGGY_MCP_HTTP_ADDRESS".to_string())
+ .or_insert(self.server_address.to_string());
+ let mut command = if let Some(server_executable_path) = &self.server_executable_path {
+ Command::new(server_executable_path)
+ } else {
+ Command::cargo_bin("iggy-mcp").unwrap()
+ };
+ command.envs(self.envs.clone());
+ let child = command.spawn().unwrap();
+ self.child_handle = Some(child);
+ }
+
+ pub fn stop(&mut self) {
+ #[allow(unused_mut)]
+ if let Some(mut child_handle) = self.child_handle.take() {
+ #[cfg(unix)]
+ unsafe {
+ use libc::SIGTERM;
+ use libc::kill;
+ kill(child_handle.id() as libc::pid_t, SIGTERM);
+ }
+
+ #[cfg(not(unix))]
+ child_handle.kill().unwrap();
+
+ if let Ok(output) = child_handle.wait_with_output() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ if let Some(stderr_file_path) = &self.stderr_file_path {
+ OpenOptions::new()
+ .append(true)
+ .create(true)
+ .open(stderr_file_path)
+ .unwrap()
+ .write_all(stderr.as_bytes())
+ .unwrap();
+ }
+
+ if let Some(stdout_file_path) = &self.stdout_file_path {
+ OpenOptions::new()
+ .append(true)
+ .create(true)
+ .open(stdout_file_path)
+ .unwrap()
+ .write_all(stdout.as_bytes())
+ .unwrap();
+ }
+ }
+ }
+ }
+
+ pub fn is_started(&self) -> bool {
+ self.child_handle.is_some()
+ }
+
+ pub fn pid(&self) -> u32 {
+ self.child_handle.as_ref().unwrap().id()
+ }
+
+ fn get_http_mcp_api_address(&self) -> String {
+ format!("{}{MCP_PATH}", self.get_http_api_address())
+ }
+
+ fn get_http_api_address(&self) -> String {
+ format!(
+ "http://{}:{}",
+ self.server_address.ip(),
+ self.server_address.port()
+ )
+ }
+
+ pub async fn ensure_started(&self) {
+ let http_api_address = self.get_http_api_address();
+ let client = reqwest::Client::new();
+ let max_retries = 3000;
+ let mut retries = 0;
+ while let Err(error) = client.get(&http_api_address).send().await {
+ sleep(Duration::from_millis(20)).await;
+ retries += 1;
+ if retries >= max_retries {
+ panic!(
+ "Failed to ping MCP server: {http_api_address} after {max_retries} retries. {error}"
+ );
+ }
+ }
+ println!("MCP server address started at: {http_api_address}");
+ }
+
+ pub async fn get_client(&self) -> McpClient {
+ let mcp_http_api_address = self.get_http_mcp_api_address();
+ let transport = StreamableHttpClientTransport::from_uri(mcp_http_api_address);
+ let client_info = ClientInfo {
+ protocol_version: Default::default(),
+ capabilities: ClientCapabilities::default(),
+ client_info: Implementation {
+ name: "test-mcp-client".to_string(),
+ version: "1.0.0".to_string(),
+ },
+ };
+ client_info
+ .serve(transport)
+ .await
+ .inspect_err(|error| {
+ eprintln!("MCP client error: {error}");
+ })
+ .expect("Failed to create MCP client")
+ }
+
+ fn get_random_server_address() -> SocketAddr {
+ let mut rng = rand::thread_rng();
+ let max_retries = 100;
+
+ for _ in 0..max_retries {
+ #[cfg(target_os = "linux")]
+ let port = rng.gen_range(20000..=29999);
+
+ #[cfg(target_os = "macos")]
+ let port = rng.gen_range(20000..=49151);
+
+ #[cfg(target_os = "windows")]
+ let port = rng.gen_range(20000..=49151);
+
+ let addr = SocketAddr::new(Ipv4Addr::LOCALHOST.into(), port);
+ if TcpListener::bind(addr).is_ok() {
+ return addr;
+ }
+ }
+
+ panic!("Failed to find a free port after {max_retries} retries");
+ }
+}
+
+impl Drop for TestMcpServer {
+ fn drop(&mut self) {
+ self.stop();
+ }
+}
diff --git a/core/integration/src/test_tls_utils.rs b/core/integration/src/test_tls_utils.rs
index 53dd44c6..75b75abc 100644
--- a/core/integration/src/test_tls_utils.rs
+++ b/core/integration/src/test_tls_utils.rs
@@ -38,7 +38,7 @@ pub fn generate_test_certificates(cert_dir: &str) -> Result<(), Box<dyn std::err
let key_path = Path::new(cert_dir).join("test_key.pem");
let mut key_file = File::create(&key_path)?;
- key_file.write_all(cert.key_pair.serialize_pem().as_bytes())?;
+ key_file.write_all(cert.signing_key.serialize_pem().as_bytes())?;
Ok(())
}
diff --git a/core/integration/tests/mcp/mod.rs b/core/integration/tests/mcp/mod.rs
new file mode 100644
index 00000000..88134d72
--- /dev/null
+++ b/core/integration/tests/mcp/mod.rs
@@ -0,0 +1,701 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use iggy::prelude::{Client, DEFAULT_ROOT_PASSWORD, DEFAULT_ROOT_USERNAME, IggyClient};
+use iggy_binary_protocol::{
+ ConsumerGroupClient, ConsumerOffsetClient, MessageClient, PersonalAccessTokenClient,
+ StreamClient, TopicClient, UserClient,
+};
+use iggy_common::{
+ ClientInfo, ClientInfoDetails, Consumer, ConsumerGroup, ConsumerGroupDetails,
+ ConsumerOffsetInfo, Identifier, IggyExpiry, IggyMessage, MaxTopicSize, Partitioning,
+ PersonalAccessTokenExpiry, PersonalAccessTokenInfo, PolledMessages, RawPersonalAccessToken,
+ Snapshot, Stats, Stream, StreamDetails, Topic, TopicDetails, UserInfo, UserInfoDetails,
+ UserStatus,
+};
+use integration::{
+ test_mcp_server::{CONSUMER_NAME, McpClient, TestMcpServer},
+ test_server::{IpAddrKind, TestServer},
+};
+use lazy_static::lazy_static;
+use rmcp::{
+ ServiceError,
+ model::{CallToolRequestParam, CallToolResult, ListToolsResult},
+ serde::de::DeserializeOwned,
+ serde_json::{self, json},
+};
+use serial_test::parallel;
+use std::collections::HashMap;
+
+const STREAM_NAME: &str = "test_stream";
+const TOPIC_NAME: &str = "test_topic";
+const MESSAGE_PAYLOAD: &str = "test_message";
+const CONSUMER_GROUP_NAME: &str = "test_consumer_group";
+const PERSONAL_ACCESS_TOKEN_NAME: &str = "test_personal_access_token";
+const USER_NAME: &str = "test_user";
+const USER_PASSWORD: &str = "secret";
+
+lazy_static! {
+ static ref STREAM_ID: Identifier =
+ Identifier::from_str_value(STREAM_NAME).expect("Failed to create stream ID");
+ static ref TOPIC_ID: Identifier =
+ Identifier::from_str_value(TOPIC_NAME).expect("Failed to create topic ID");
+ static ref CONSUMER_GROUP_ID: Identifier =
+ Identifier::from_str_value(CONSUMER_GROUP_NAME).expect("Failed to create group ID");
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_list_tools() {
+ let infra = setup().await;
+ let client = infra.mcp_client;
+ let tools = client.list_tools().await.expect("Failed to list tools");
+
+ assert!(!tools.tools.is_empty());
+ let tools_count = tools.tools.len();
+ assert_eq!(tools_count, 40);
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_handle_ping() {
+ assert_empty_response("ping", None).await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_list_of_streams() {
+ assert_response::<Vec<Stream>>("get_streams", None, |streams| {
+ assert_eq!(streams.len(), 1);
+ let stream = &streams[0];
+ assert_eq!(&stream.name, STREAM_NAME);
+ assert_eq!(&stream.topics_count, &1);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_stream_details() {
+ assert_response::<StreamDetails>(
+ "get_stream",
+ Some(json!({"stream_id": STREAM_NAME})),
+ |stream| {
+ assert_eq!(stream.name, STREAM_NAME);
+ assert_eq!(stream.topics_count, 1);
+ assert_eq!(stream.messages_count, 1);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_create_stream() {
+ let name = "new_stream";
+ assert_response::<StreamDetails>("create_stream", Some(json!({ "name": name})), |stream| {
+ assert_eq!(stream.name, name);
+ assert_eq!(stream.topics_count, 0);
+ assert_eq!(stream.messages_count, 0);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_update_stream() {
+ let name = "updated_stream";
+ assert_empty_response(
+ "update_stream",
+ Some(json!({"stream_id": STREAM_NAME, "name": name})),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_stream() {
+ assert_empty_response("delete_stream", Some(json!({"stream_id": STREAM_NAME}))).await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_purge_stream() {
+ assert_empty_response("purge_stream", Some(json!({"stream_id": STREAM_NAME}))).await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_list_of_topics() {
+ assert_response::<Vec<Topic>>(
+ "get_topics",
+ Some(json!({"stream_id": STREAM_NAME})),
+ |topics| {
+ assert_eq!(topics.len(), 1);
+ let topic = &topics[0];
+ assert_eq!(topic.name, TOPIC_NAME);
+ assert_eq!(topic.partitions_count, 1);
+ assert_eq!(topic.messages_count, 1);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_topic_details() {
+ assert_response::<TopicDetails>(
+ "get_topic",
+ Some(json!({"stream_id": STREAM_NAME, "topic_id": TOPIC_NAME})),
+ |topic| {
+ assert_eq!(topic.id, 1);
+ assert_eq!(topic.name, TOPIC_NAME);
+ assert_eq!(topic.messages_count, 1);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_create_topic() {
+ let name = "new_topic";
+ assert_response::<TopicDetails>(
+ "create_topic",
+ Some(json!({ "stream_id": STREAM_NAME, "name": name, "partitions_count": 1})),
+ |topic| {
+ assert_eq!(topic.id, 2);
+ assert_eq!(topic.name, name);
+ assert_eq!(topic.partitions_count, 1);
+ assert_eq!(topic.messages_count, 0);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_update_topic() {
+ let name = "updated_topic";
+ assert_empty_response(
+ "update_topic",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "name": name})),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_topic() {
+ assert_empty_response(
+ "delete_topic",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_purge_topic() {
+ assert_empty_response(
+ "purge_topic",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_create_partitions() {
+ assert_empty_response(
+ "create_partitions",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partitions_count": 3 })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_partitions() {
+ assert_empty_response(
+ "delete_partitions",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partitions_count": 1 })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_segments() {
+ assert_empty_response(
+ "delete_segments",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partition_id": 1, "segments_count": 1 })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_poll_messages() {
+ assert_response::<PolledMessages>(
+ "poll_messages",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partition_id": 1, "offset": 0 })),
+ |messages| {
+ assert_eq!(messages.messages.len(), 1);
+ let message = &messages.messages[0];
+ assert_eq!(message.header.offset, 0);
+ let payload = message.payload_as_string().expect("Failed to parse message payload");
+ assert_eq!(payload, MESSAGE_PAYLOAD);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_send_messages() {
+ assert_empty_response(
+ "send_messages",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partition_id": 1, "messages": [
+ {
+ "payload": "test"
+ }
+ ] })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_stats() {
+ assert_response::<Stats>("get_stats", None, |stats| {
+ assert!(!stats.hostname.is_empty());
+ assert_eq!(stats.messages_count, 1);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_me() {
+ assert_response::<ClientInfoDetails>("get_me", None, |client| {
+ assert!(client.client_id > 0);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_clients() {
+ assert_response::<Vec<ClientInfo>>("get_clients", None, |clients| {
+ assert!(!clients.is_empty());
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_handle_snapshot() {
+ assert_response::<Snapshot>("snapshot", None, |snapshot| {
+ assert!(!snapshot.0.is_empty());
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_consumer_groups() {
+ assert_response::<Vec<ConsumerGroup>>(
+ "get_consumer_groups",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME})),
+ |groups| {
+ assert!(!groups.is_empty());
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_consumer_group_details() {
+ assert_response::<ConsumerGroupDetails>("get_consumer_group", Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "group_id": CONSUMER_GROUP_NAME })), |group| {
+ assert_eq!(group.name, CONSUMER_GROUP_NAME);
+ assert_eq!(group.partitions_count, 1);
+ assert_eq!(group.members_count, 0);
+ assert!(group.members.is_empty());
+
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_create_consumer_group() {
+ let name = "test";
+ assert_response::<ConsumerGroupDetails>(
+ "create_consumer_group",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "name": name })),
+ |group| {
+ assert_eq!(group.name, name);
+ assert_eq!(group.partitions_count, 1);
+ assert_eq!(group.members_count, 0);
+ assert!(group.members.is_empty());
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_consumer_group() {
+ assert_empty_response(
+ "delete_consumer_group",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "group_id": CONSUMER_GROUP_NAME })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_consumer_offset() {
+ assert_response::<Option<ConsumerOffsetInfo>>(
+ "get_consumer_offset",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partition_id": 1 })),
+ |offset| {
+ assert!(offset.is_some());
+ let offset = offset.unwrap();
+ assert_eq!(offset.partition_id, 1);
+ assert_eq!(offset.stored_offset, 0);
+ assert_eq!(offset.current_offset, 0);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_store_consumer_offset() {
+ assert_empty_response(
+ "store_consumer_offset",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partition_id": 1, "offset": 0 })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_consumer_offset() {
+ assert_empty_response(
+ "delete_consumer_offset",
+ Some(json!({ "stream_id": STREAM_NAME, "topic_id": TOPIC_NAME, "partition_id": 1, "offset": 0 })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_personal_access_tokens() {
+ assert_response::<Vec<PersonalAccessTokenInfo>>("get_personal_access_tokens", None, |tokens| {
+ assert_eq!(tokens.len(), 1);
+ assert_eq!(tokens[0].name, PERSONAL_ACCESS_TOKEN_NAME);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_create_personal_access_token() {
+ let name = "test_token";
+ let expiry = PersonalAccessTokenExpiry::NeverExpire.to_string();
+ assert_response::<RawPersonalAccessToken>(
+ "create_personal_access_token",
+ Some(json!({ "name": name, "expiry": expiry })),
+ |token| {
+ assert!(!token.token.is_empty());
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_personal_access_token() {
+ assert_empty_response(
+ "delete_personal_access_token",
+ Some(json!({ "name": PERSONAL_ACCESS_TOKEN_NAME})),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_users() {
+ assert_response::<Vec<UserInfo>>("get_users", None, |users| {
+ assert_eq!(users.len(), 2);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_return_user_details() {
+ assert_response::<UserInfoDetails>("get_user", Some(json!({ "user_id": USER_NAME})), |user| {
+ assert_eq!(user.username, USER_NAME);
+ })
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_create_user() {
+ let username = "test-mcp-user";
+ assert_response::<UserInfoDetails>(
+ "create_user",
+ Some(json!({ "username": username, "password": "secret"})),
+ |user| {
+ assert_eq!(user.username, username);
+ },
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_update_user() {
+ assert_empty_response(
+ "update_user",
+ Some(json!({ "user_id": USER_NAME, "username": "test-mcp-user", "active": false})),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_delete_user() {
+ assert_empty_response("delete_user", Some(json!({ "user_id": USER_NAME}))).await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_update_permissions() {
+ let permissions = json!({
+ "global": {
+ "manage_servers": true,
+ "read_users": true,
+ },
+ "streams": {
+ "1": {
+ "manage_stream": true,
+ "manage_topics": true,
+ "topics": {
+ "1": {
+ "manage_topic": true,
+ "read_topic": true,
+ "poll_messages": true,
+ "send_messages": true,
+ }
+ }
+ }
+ }
+ });
+
+ assert_empty_response(
+ "update_permissions",
+ Some(json!({ "user_id": USER_NAME, "permissions": permissions })),
+ )
+ .await;
+}
+
+#[tokio::test]
+#[parallel]
+async fn mcp_server_should_change_password() {
+ assert_empty_response(
+ "change_password",
+ Some(json!({ "user_id": USER_NAME, "current_password": USER_PASSWORD, "new_password": "secret2"})),
+ )
+ .await;
+}
+
+async fn assert_empty_response(method: &str, data: Option<serde_json::Value>) {
+ assert_response::<()>(method, data, |()| {}).await
+}
+
+async fn assert_response<T: DeserializeOwned>(
+ method: &str,
+ data: Option<serde_json::Value>,
+ assert_response: impl FnOnce(T),
+) {
+ let infra = setup().await;
+ let client = infra.mcp_client;
+ let result = invoke_request(&client, method, data).await;
+ assert_response(result)
+}
+
+async fn invoke_request<T: DeserializeOwned>(
+ client: &TestMcpClient,
+ method: &str,
+ data: Option<serde_json::Value>,
+) -> T {
+ let error_message = format!("Failed to invoke MCP method: {method}",);
+ let mut result = client.invoke(method, data).await.expect(&error_message);
+
+ if result.content.is_empty() {
+ panic!("No content returned from MCP for method: {method}");
+ }
+
+ let result = result.content.remove(0);
+ let Some(text) = result.as_text() else {
+ panic!("Expected text response for MCP method: {method}");
+ };
+
+ serde_json::from_str::<T>(&text.text).expect("Failed to parse JSON")
+}
+
+async fn setup() -> McpInfra {
+ let mut iggy_envs = HashMap::new();
+ iggy_envs.insert("IGGY_QUIC_ENABLED".to_owned(), "false".to_owned());
+ let mut test_server = TestServer::new(Some(iggy_envs), true, None, IpAddrKind::V4);
+ test_server.start();
+ let iggy_server_address = test_server
+ .get_raw_tcp_addr()
+ .expect("Failed to get Iggy TCP address");
+ seed_data(&iggy_server_address).await;
+
+ let mut test_mcp_server = TestMcpServer::with_iggy_address(&iggy_server_address);
+ test_mcp_server.start();
+ test_mcp_server.ensure_started().await;
+ let mcp_client = test_mcp_server.get_client().await;
+
+ McpInfra {
+ _iggy_server: test_server,
+ _mcp_server: test_mcp_server,
+ mcp_client: TestMcpClient { mcp_client },
+ }
+}
+
+async fn seed_data(iggy_server_address: &str) {
+ let iggy_port = iggy_server_address
+ .split(':')
+ .next_back()
+ .unwrap()
+ .parse::<u16>()
+ .unwrap();
+
+ let iggy_client = IggyClient::from_connection_string(&format!(
+ "iggy://{DEFAULT_ROOT_USERNAME}:{DEFAULT_ROOT_PASSWORD}@localhost:{iggy_port}"
+ ))
+ .expect("Failed to create Iggy client");
+
+ iggy_client
+ .connect()
+ .await
+ .expect("Failed to initialize Iggy client");
+
+ iggy_client
+ .create_stream(STREAM_NAME, None)
+ .await
+ .expect("Failed to create stream");
+
+ iggy_client
+ .create_topic(
+ &STREAM_ID,
+ TOPIC_NAME,
+ 1,
+ iggy_common::CompressionAlgorithm::None,
+ None,
+ None,
+ IggyExpiry::ServerDefault,
+ MaxTopicSize::ServerDefault,
+ )
+ .await
+ .expect("Failed to create topic");
+
+ let mut messages = vec![
+ IggyMessage::builder()
+ .payload(MESSAGE_PAYLOAD.into())
+ .build()
+ .expect("Failed to build message"),
+ ];
+
+ iggy_client
+ .send_messages(
+ &STREAM_ID,
+ &TOPIC_ID,
+ &Partitioning::partition_id(1),
+ &mut messages,
+ )
+ .await
+ .expect("Failed to send messages");
+
+ let consumer =
+ Consumer::new(Identifier::named(CONSUMER_NAME).expect("Failed to create consumer"));
+
+ iggy_client
+ .store_consumer_offset(&consumer, &STREAM_ID, &TOPIC_ID, Some(1), 0)
+ .await
+ .expect("Failed to store consumer offset");
+
+ iggy_client
+ .create_consumer_group(&STREAM_ID, &TOPIC_ID, CONSUMER_GROUP_NAME, None)
+ .await
+ .expect("Failed to create consumer group");
+
+ iggy_client
+ .create_user(USER_NAME, USER_PASSWORD, UserStatus::Active, None)
+ .await
+ .expect("Failed to create user");
+
+ iggy_client
+ .create_personal_access_token(
+ PERSONAL_ACCESS_TOKEN_NAME,
+ PersonalAccessTokenExpiry::NeverExpire,
+ )
+ .await
+ .expect("Failed to create personal access token");
+}
+
+#[derive(Debug)]
+struct McpInfra {
+ _iggy_server: TestServer,
+ _mcp_server: TestMcpServer,
+ mcp_client: TestMcpClient,
+}
+
+#[derive(Debug)]
+struct TestMcpClient {
+ mcp_client: McpClient,
+}
+
+impl TestMcpClient {
+ pub async fn list_tools(&self) -> Result<ListToolsResult, ServiceError> {
+ self.mcp_client.list_tools(Default::default()).await
+ }
+
+ pub async fn invoke(
+ &self,
+ method: &str,
+ data: Option<serde_json::Value>,
+ ) -> Result<CallToolResult, ServiceError> {
+ self.mcp_client
+ .call_tool(CallToolRequestParam {
+ name: method.to_owned().into(),
+ arguments: data.and_then(|value| value.as_object().cloned()),
+ })
+ .await
+ }
+}
diff --git a/core/integration/tests/mod.rs b/core/integration/tests/mod.rs
index df7e3a1a..7dbf56bd 100644
--- a/core/integration/tests/mod.rs
+++ b/core/integration/tests/mod.rs
@@ -29,6 +29,7 @@ mod archiver;
mod cli;
mod config_provider;
mod data_integrity;
+mod mcp;
mod sdk;
mod server;
mod state;
diff --git a/core/sdk/src/client_provider.rs b/core/sdk/src/client_provider.rs
index 798f0d6f..ab9d329a 100644
--- a/core/sdk/src/client_provider.rs
+++ b/core/sdk/src/client_provider.rs
@@ -24,7 +24,7 @@ use crate::prelude::{
ClientError, HttpClientConfig, IggyDuration, QuicClientConfig, QuicClientReconnectionConfig,
TcpClientConfig, TcpClientReconnectionConfig,
};
-use crate::quic::quick_client::QuicClient;
+use crate::quic::quic_client::QuicClient;
use crate::tcp::tcp_client::TcpClient;
use iggy_binary_protocol::Client;
use iggy_common::{AutoLogin, Credentials};
diff --git a/core/sdk/src/clients/client.rs b/core/sdk/src/clients/client.rs
index 6189a8da..2f3445d0 100644
--- a/core/sdk/src/clients/client.rs
+++ b/core/sdk/src/clients/client.rs
@@ -19,17 +19,19 @@
use crate::clients::client_builder::IggyClientBuilder;
use iggy_common::locking::{IggyRwLock, IggyRwLockFn};
+use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::http::http_client::HttpClient;
use crate::prelude::EncryptorKind;
use crate::prelude::IggyConsumerBuilder;
use crate::prelude::IggyError;
use crate::prelude::IggyProducerBuilder;
-use crate::quic::quick_client::QuicClient;
+use crate::quic::quic_client::QuicClient;
use crate::tcp::tcp_client::TcpClient;
use async_broadcast::Receiver;
use async_trait::async_trait;
use iggy_binary_protocol::{Client, SystemClient};
+use iggy_binary_protocol::{Client, SystemClient};
use iggy_common::{
ConnectionStringUtils, Consumer, DiagnosticEvent, Partitioner, TransportProtocol,
};
@@ -82,12 +84,15 @@ impl IggyClient {
pub fn from_connection_string(connection_string: &str) -> Result<Self, IggyError> {
match ConnectionStringUtils::parse_protocol(connection_string)? {
+ TransportProtocol::Tcp => Ok(IggyClient::new(ClientWrapper::Tcp(
TransportProtocol::Tcp => Ok(IggyClient::new(ClientWrapper::Tcp(
TcpClient::from_connection_string(connection_string)?,
))),
+ TransportProtocol::Quic => Ok(IggyClient::new(ClientWrapper::Quic(
TransportProtocol::Quic => Ok(IggyClient::new(ClientWrapper::Quic(
QuicClient::from_connection_string(connection_string)?,
))),
+ TransportProtocol::Http => Ok(IggyClient::new(ClientWrapper::Http(
TransportProtocol::Http => Ok(IggyClient::new(ClientWrapper::Http(
HttpClient::from_connection_string(connection_string)?,
))),
@@ -96,6 +101,7 @@ impl IggyClient {
/// Creates a new `IggyClient` with the provided client implementation for the specific transport and the optional implementations for the `partitioner` and `encryptor`.
pub fn create(
+ client: ClientWrapper,
client: ClientWrapper,
partitioner: Option<Arc<dyn Partitioner>>,
encryptor: Option<Arc<EncryptorKind>>,
diff --git a/core/sdk/src/clients/client_builder.rs b/core/sdk/src/clients/client_builder.rs
index 8a82e16d..4f5ed798 100644
--- a/core/sdk/src/clients/client_builder.rs
+++ b/core/sdk/src/clients/client_builder.rs
@@ -23,7 +23,7 @@ use crate::prelude::{
AutoLogin, EncryptorKind, HttpClientConfigBuilder, IggyDuration, IggyError, Partitioner,
QuicClientConfigBuilder, TcpClientConfigBuilder,
};
-use crate::quic::quick_client::QuicClient;
+use crate::quic::quic_client::QuicClient;
use crate::tcp::tcp_client::TcpClient;
use iggy_common::{ConnectionStringUtils, TransportProtocol};
use std::sync::Arc;
diff --git a/core/sdk/src/clients/consumer.rs b/core/sdk/src/clients/consumer.rs
index 8a5c12b6..a0d946b4 100644
--- a/core/sdk/src/clients/consumer.rs
+++ b/core/sdk/src/clients/consumer.rs
@@ -16,6 +16,7 @@
* under the License.
*/
+use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::client_wrappers::client_wrapper::ClientWrapper;
use bytes::Bytes;
use dashmap::DashMap;
@@ -770,6 +771,14 @@ impl IggyConsumer {
}
let now: u64 = IggyTimestamp::now().into();
+ if now < last_sent_at {
+ warn!(
+ "Returned monotonic time went backwards, now < last_sent_at: ({now} < {last_sent_at})"
+ );
+ sleep(Duration::from_micros(interval)).await;
+ return;
+ }
+
let elapsed = now - last_sent_at;
if elapsed >= interval {
trace!("No need to wait before polling messages. {now} - {last_sent_at} = {elapsed}");
diff --git a/core/sdk/src/clients/consumer_builder.rs b/core/sdk/src/clients/consumer_builder.rs
index 3246b06e..97d42cfd 100644
--- a/core/sdk/src/clients/consumer_builder.rs
+++ b/core/sdk/src/clients/consumer_builder.rs
@@ -16,6 +16,7 @@
* under the License.
*/
+use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::prelude::{AutoCommit, AutoCommitWhen, IggyConsumer};
use iggy_binary_protocol::Client;
diff --git a/core/sdk/src/clients/producer.rs b/core/sdk/src/clients/producer.rs
index 6cd7f03a..b99c35be 100644
--- a/core/sdk/src/clients/producer.rs
+++ b/core/sdk/src/clients/producer.rs
@@ -17,6 +17,7 @@
*/
use super::ORDERING;
use crate::client_wrappers::client_wrapper::ClientWrapper;
+use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::clients::MAX_BATCH_LENGTH;
use crate::clients::producer_builder::SendMode;
use crate::clients::producer_config::DirectConfig;
diff --git a/core/sdk/src/clients/producer_builder.rs b/core/sdk/src/clients/producer_builder.rs
index 576bbe9a..b7c128d4 100644
--- a/core/sdk/src/clients/producer_builder.rs
+++ b/core/sdk/src/clients/producer_builder.rs
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::client_wrappers::client_wrapper::ClientWrapper;
use crate::clients::producer_config::{BackgroundConfig, DirectConfig};
use crate::prelude::IggyProducer;
diff --git a/core/sdk/src/consumer_ext/consumer_message_ext.rs b/core/sdk/src/consumer_ext/consumer_message_ext.rs
index 4ad53fde..f26a7354 100644
--- a/core/sdk/src/consumer_ext/consumer_message_ext.rs
+++ b/core/sdk/src/consumer_ext/consumer_message_ext.rs
@@ -25,7 +25,7 @@ use tokio::sync::oneshot;
use tracing::{error, info, trace};
#[async_trait]
-impl IggyConsumerMessageExt for IggyConsumer {
+impl<'a> IggyConsumerMessageExt<'a> for IggyConsumer {
/// Consume messages from the stream and process them with the given message consumer.
///
/// # Arguments
@@ -46,8 +46,8 @@ impl IggyConsumerMessageExt for IggyConsumer {
/// * `IggyError::ClientShutdown`: The client has been shut down.
///
async fn consume_messages<P>(
- mut self,
- message_consumer: &'static P,
+ &mut self,
+ message_consumer: &'a P,
mut shutdown_rx: oneshot::Receiver<()>,
) -> Result<(), IggyError>
where
diff --git a/core/sdk/src/consumer_ext/consumer_message_trait.rs b/core/sdk/src/consumer_ext/consumer_message_trait.rs
index e0d063f0..3e88f956 100644
--- a/core/sdk/src/consumer_ext/consumer_message_trait.rs
+++ b/core/sdk/src/consumer_ext/consumer_message_trait.rs
@@ -22,7 +22,7 @@ use async_trait::async_trait;
use tokio::sync::oneshot;
#[async_trait]
-pub trait IggyConsumerMessageExt {
+pub trait IggyConsumerMessageExt<'a> {
/// This function starts an event loop that consumes messages from the stream and
/// applies the provided consumer. The loop will exit when the shutdown receiver is triggered.
///
@@ -34,8 +34,8 @@ pub trait IggyConsumerMessageExt {
/// * `shutdown_rx`: The receiver to listen to for shutdown.
///
async fn consume_messages<P>(
- mut self,
- message_consumer: &'static P,
+ &mut self,
+ message_consumer: &'a P,
shutdown_rx: oneshot::Receiver<()>,
) -> Result<(), IggyError>
where
diff --git a/core/sdk/src/quic/mod.rs b/core/sdk/src/quic/mod.rs
index 0ffce248..27e3229a 100644
--- a/core/sdk/src/quic/mod.rs
+++ b/core/sdk/src/quic/mod.rs
@@ -16,5 +16,5 @@
* under the License.
*/
-pub mod quick_client;
+pub mod quic_client;
mod skip_server_verification;
diff --git a/core/sdk/src/quic/quick_client.rs b/core/sdk/src/quic/quic_client.rs
similarity index 92%
rename from core/sdk/src/quic/quick_client.rs
rename to core/sdk/src/quic/quic_client.rs
index 7d0211ae..d031b368 100644
--- a/core/sdk/src/quic/quick_client.rs
+++ b/core/sdk/src/quic/quic_client.rs
@@ -49,7 +49,7 @@ const NAME: &str = "Iggy";
#[derive(Debug)]
pub struct QuicClient {
pub(crate) endpoint: Endpoint,
- pub(crate) connection: Mutex<Option<Connection>>,
+ pub(crate) connection: Arc<Mutex<Option<Connection>>>,
pub(crate) config: Arc<QuicClientConfig>,
pub(crate) server_address: SocketAddr,
pub(crate) state: Mutex<ClientState>,
@@ -196,7 +196,7 @@ impl QuicClient {
config,
endpoint,
server_address,
- connection: Mutex::new(None),
+ connection: Arc::new(Mutex::new(None)),
state: Mutex::new(ClientState::Disconnected),
events: broadcast(1000),
connected_at: Mutex::new(None),
@@ -214,9 +214,12 @@ impl QuicClient {
))
}
- async fn handle_response(&self, recv: &mut RecvStream) -> Result<Bytes, IggyError> {
+ async fn handle_response(
+ recv: &mut RecvStream,
+ response_buffer_size: usize,
+ ) -> Result<Bytes, IggyError> {
let buffer = recv
- .read_to_end(self.config.response_buffer_size as usize)
+ .read_to_end(response_buffer_size)
.await
.map_err(|error| {
error!("Failed to read response data: {error}");
@@ -450,38 +453,48 @@ impl QuicClient {
_ => {}
}
- let connection = self.connection.lock().await;
- if let Some(connection) = connection.as_ref() {
- let payload_length = payload.len() + REQUEST_INITIAL_BYTES_LENGTH;
- let (mut send, mut recv) = connection.open_bi().await.map_err(|error| {
- error!("Failed to open a bidirectional stream: {error}");
- IggyError::QuicError
- })?;
- trace!("Sending a QUIC request with code: {code}");
- send.write_all(&(payload_length as u32).to_le_bytes())
- .await
- .map_err(|error| {
- error!("Failed to write payload length: {error}");
+ let connection = self.connection.clone();
+ let response_buffer_size = self.config.response_buffer_size;
+ // SAFETY: we run code holding the `connection` lock in a task so we can't be cancelled while holding the lock.
+ tokio::spawn(async move {
+ let connection = connection.lock().await;
+ if let Some(connection) = connection.as_ref() {
+ let payload_length = payload.len() + REQUEST_INITIAL_BYTES_LENGTH;
+ let (mut send, mut recv) = connection.open_bi().await.map_err(|error| {
+ error!("Failed to open a bidirectional stream: {error}");
IggyError::QuicError
})?;
- send.write_all(&code.to_le_bytes()).await.map_err(|error| {
- error!("Failed to write payload code: {error}");
- IggyError::QuicError
- })?;
- send.write_all(&payload).await.map_err(|error| {
- error!("Failed to write payload: {error}");
- IggyError::QuicError
- })?;
- send.finish().map_err(|error| {
- error!("Failed to finish sending data: {error}");
- IggyError::QuicError
- })?;
- trace!("Sent a QUIC request with code: {code}, waiting for a response...");
- return self.handle_response(&mut recv).await;
- }
+ trace!("Sending a QUIC request with code: {code}");
+ send.write_all(&(payload_length as u32).to_le_bytes())
+ .await
+ .map_err(|error| {
+ error!("Failed to write payload length: {error}");
+ IggyError::QuicError
+ })?;
+ send.write_all(&code.to_le_bytes()).await.map_err(|error| {
+ error!("Failed to write payload code: {error}");
+ IggyError::QuicError
+ })?;
+ send.write_all(&payload).await.map_err(|error| {
+ error!("Failed to write payload: {error}");
+ IggyError::QuicError
+ })?;
+ send.finish().map_err(|error| {
+ error!("Failed to finish sending data: {error}");
+ IggyError::QuicError
+ })?;
+ trace!("Sent a QUIC request with code: {code}, waiting for a response...");
+ return QuicClient::handle_response(&mut recv, response_buffer_size as usize).await;
+ }
- error!("Cannot send data. Client is not connected.");
- Err(IggyError::NotConnected)
+ error!("Cannot send data. Client is not connected.");
+ Err(IggyError::NotConnected)
+ })
+ .await
+ .map_err(|e| {
+ error!("Task execution failed during QUIC request: {}", e);
+ IggyError::QuicError
+ })?
}
}
diff --git a/core/sdk/src/tcp/tcp_client.rs b/core/sdk/src/tcp/tcp_client.rs
index 2bab2efb..9d7dd8cd 100644
--- a/core/sdk/src/tcp/tcp_client.rs
+++ b/core/sdk/src/tcp/tcp_client.rs
@@ -49,7 +49,7 @@ const NAME: &str = "Iggy";
/// It requires a valid server address.
#[derive(Debug)]
pub struct TcpClient {
- pub(crate) stream: Mutex<Option<ConnectionStreamKind>>,
+ pub(crate) stream: Arc<Mutex<Option<ConnectionStreamKind>>>,
pub(crate) config: Arc<TcpClientConfig>,
pub(crate) state: Mutex<ClientState>,
client_address: Mutex<Option<SocketAddr>>,
@@ -194,7 +194,7 @@ impl TcpClient {
Ok(Self {
config,
client_address: Mutex::new(None),
- stream: Mutex::new(None),
+ stream: Arc::new(Mutex::new(None)),
state: Mutex::new(ClientState::Disconnected),
events: broadcast(1000),
connected_at: Mutex::new(None),
@@ -202,7 +202,6 @@ impl TcpClient {
}
async fn handle_response(
- &self,
status: u32,
length: u32,
stream: &mut ConnectionStreamKind,
@@ -490,45 +489,54 @@ impl TcpClient {
_ => {}
}
- let mut stream = self.stream.lock().await;
- if let Some(stream) = stream.as_mut() {
- let payload_length = payload.len() + REQUEST_INITIAL_BYTES_LENGTH;
- trace!("Sending a TCP request of size {payload_length} with code: {code}");
- stream.write(&(payload_length as u32).to_le_bytes()).await?;
- stream.write(&code.to_le_bytes()).await?;
- stream.write(&payload).await?;
- stream.flush().await?;
- trace!("Sent a TCP request with code: {code}, waiting for a response...");
- let mut response_buffer = [0u8; RESPONSE_INITIAL_BYTES_LENGTH];
- let read_bytes = stream.read(&mut response_buffer).await.map_err(|error| {
- error!(
- "Failed to read response for TCP request with code: {code}: {error}",
- code = code,
- error = error
- );
- IggyError::Disconnected
- })?;
+ let stream = self.stream.clone();
+ // SAFETY: we run code holding the `stream` lock in a task so we can't be cancelled while holding the lock.
+ tokio::spawn(async move {
+ let mut stream = stream.lock().await;
+ if let Some(stream) = stream.as_mut() {
+ let payload_length = payload.len() + REQUEST_INITIAL_BYTES_LENGTH;
+ trace!("Sending a TCP request of size {payload_length} with code: {code}");
+ stream.write(&(payload_length as u32).to_le_bytes()).await?;
+ stream.write(&code.to_le_bytes()).await?;
+ stream.write(&payload).await?;
+ stream.flush().await?;
+ trace!("Sent a TCP request with code: {code}, waiting for a response...");
+ let mut response_buffer = [0u8; RESPONSE_INITIAL_BYTES_LENGTH];
+ let read_bytes = stream.read(&mut response_buffer).await.map_err(|error| {
+ error!(
+ "Failed to read response for TCP request with code: {code}: {error}",
+ code = code,
+ error = error
+ );
+ IggyError::Disconnected
+ })?;
- if read_bytes != RESPONSE_INITIAL_BYTES_LENGTH {
- error!("Received an invalid or empty response.");
- return Err(IggyError::EmptyResponse);
- }
+ if read_bytes != RESPONSE_INITIAL_BYTES_LENGTH {
+ error!("Received an invalid or empty response.");
+ return Err(IggyError::EmptyResponse);
+ }
- let status = u32::from_le_bytes(
- response_buffer[..4]
- .try_into()
- .map_err(|_| IggyError::InvalidNumberEncoding)?,
- );
- let length = u32::from_le_bytes(
- response_buffer[4..]
- .try_into()
- .map_err(|_| IggyError::InvalidNumberEncoding)?,
- );
- return self.handle_response(status, length, stream).await;
- }
+ let status = u32::from_le_bytes(
+ response_buffer[..4]
+ .try_into()
+ .map_err(|_| IggyError::InvalidNumberEncoding)?,
+ );
+ let length = u32::from_le_bytes(
+ response_buffer[4..]
+ .try_into()
+ .map_err(|_| IggyError::InvalidNumberEncoding)?,
+ );
+ return TcpClient::handle_response(status, length, stream).await;
+ }
- error!("Cannot send data. Client is not connected.");
- Err(IggyError::NotConnected)
+ error!("Cannot send data. Client is not connected.");
+ Err(IggyError::NotConnected)
+ })
+ .await
+ .map_err(|e| {
+ error!("Task execution failed during TCP request: {}", e);
+ IggyError::TcpError
+ })?
}
async fn get_client_address_value(&self) -> String {
diff --git a/core/server/src/shard/system/topics.rs b/core/server/src/shard/system/topics.rs
index bfe974cf..0b216333 100644
--- a/core/server/src/shard/system/topics.rs
+++ b/core/server/src/shard/system/topics.rs
@@ -256,6 +256,7 @@ impl IggyShard {
replication_factor: Option<u8>,
) -> Result<(), IggyError> {
self.ensure_authenticated(session)?;
+ let topic_numeric_id;
{
let stream = self.get_stream(stream_id).with_error_context(|error| {
format!("{COMPONENT} (error: {error}) - failed to get stream with ID: {stream_id}")
diff --git a/core/server/src/streaming/streams/topics.rs b/core/server/src/streaming/streams/topics.rs
index b2b716fa..4e481dda 100644
--- a/core/server/src/streaming/streams/topics.rs
+++ b/core/server/src/streaming/streams/topics.rs
@@ -137,8 +137,6 @@ impl Stream {
};
{
- self.topics_ids.remove(&old_topic_name.clone());
- self.topics_ids.insert(name.to_owned(), topic_id);
let topic = self.get_topic_mut(id).with_error_context(|error| {
format!("{COMPONENT} (error: {error}) - failed to get mutable reference to topic with id {id}")
})?;
@@ -149,6 +147,12 @@ impl Stream {
topic.max_topic_size = max_topic_size;
topic.replication_factor = replication_factor;
}
+
+ {
+ self.topics_ids.borrow_mut().remove(&old_topic_name.clone());
+ self.topics_ids.borrow_mut().insert(name.to_owned(), topic_id);
+ }
+
Ok(())
}
diff --git a/docker-compose.yml b/docker-compose.yml
index 347bef1b..48da4ee0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,9 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-version: '3.5'
services:
-
iggy-server:
build: .
container_name: iggy-server
diff --git a/examples/rust/src/stream-builder/stream-basic/main.rs b/examples/rust/src/stream-builder/stream-basic/main.rs
index e90baaff..33d6ee8a 100644
--- a/examples/rust/src/stream-builder/stream-basic/main.rs
+++ b/examples/rust/src/stream-builder/stream-basic/main.rs
@@ -31,7 +31,7 @@ async fn main() -> Result<(), IggyError> {
println!("Build iggy producer & consumer");
// For customization, use the `new` or `from_stream_topic` constructor
let stream_config = IggyStreamConfig::default();
- let (producer, consumer) = IggyStream::build(&client, &stream_config).await?;
+ let (producer, mut consumer) = IggyStream::build(&client, &stream_config).await?;
println!("Start message stream");
let (sender, receiver) = oneshot::channel();
diff --git a/examples/rust/src/stream-builder/stream-consumer-config/main.rs b/examples/rust/src/stream-builder/stream-consumer-config/main.rs
index 84e86c65..7bf1b25c 100644
--- a/examples/rust/src/stream-builder/stream-consumer-config/main.rs
+++ b/examples/rust/src/stream-builder/stream-consumer-config/main.rs
@@ -84,7 +84,8 @@ async fn main() -> Result<(), IggyError> {
// .encryptor(Arc::new(EncryptorKind::Aes256Gcm(Aes256GcmEncryptor::new(&[1; 32])?)))
.build();
- let (client, consumer) = IggyStreamConsumer::with_client_from_url(IGGY_URL, &config).await?;
+ let (client, mut consumer) =
+ IggyStreamConsumer::with_client_from_url(IGGY_URL, &config).await?;
println!("Start message stream");
let (tx, rx) = oneshot::channel();
diff --git a/examples/rust/src/stream-builder/stream-consumer/main.rs b/examples/rust/src/stream-builder/stream-consumer/main.rs
index f3faa47d..08695796 100644
--- a/examples/rust/src/stream-builder/stream-consumer/main.rs
+++ b/examples/rust/src/stream-builder/stream-consumer/main.rs
@@ -27,7 +27,8 @@ async fn main() -> Result<(), IggyError> {
println!("Build iggy client & consumer");
//For customization, use the `new` or `from_stream_topic` constructor
let config = IggyConsumerConfig::default();
- let (client, consumer) = IggyStreamConsumer::with_client_from_url(IGGY_URL, &config).await?;
+ let (client, mut consumer) =
+ IggyStreamConsumer::with_client_from_url(IGGY_URL, &config).await?;
println!("Start message stream");
let (tx, rx) = oneshot::channel();
diff --git a/foreign/csharp/Iggy_SDK/Iggy_SDK.csproj b/foreign/csharp/Iggy_SDK/Iggy_SDK.csproj
index daa94fde..7c89f103 100644
--- a/foreign/csharp/Iggy_SDK/Iggy_SDK.csproj
+++ b/foreign/csharp/Iggy_SDK/Iggy_SDK.csproj
@@ -7,8 +7,9 @@
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>Apache.Iggy</AssemblyName>
<RootNamespace>Apache.Iggy</RootNamespace>
+ <PackageVersion>0.5.0</PackageVersion>
</PropertyGroup>
-
+
<PropertyGroup>
<Description>C# SDK for Apache Iggy</Description>
<Authors>Apache Iggy</Authors>
@@ -18,11 +19,11 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
-
+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
-
+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
@@ -46,5 +47,5 @@
<Link>Properties\DEPENDENCIES.md</Link>
</Content>
</ItemGroup>
-
+
</Project>
diff --git a/foreign/go/binary_serialization/fetch_messages_request_serializer_test.go b/foreign/go/binary_serialization/fetch_messages_request_serializer_test.go
index 4b3f721b..10412601 100644
--- a/foreign/go/binary_serialization/fetch_messages_request_serializer_test.go
+++ b/foreign/go/binary_serialization/fetch_messages_request_serializer_test.go
@@ -30,10 +30,7 @@ func TestSerialize_TcpFetchMessagesRequest(t *testing.T) {
topicId, _ := iggcon.NewIdentifier("test_topic_id")
// Create a sample TcpFetchMessagesRequest
request := TcpFetchMessagesRequest{
- Consumer: iggcon.Consumer{
- Kind: iggcon.ConsumerKindSingle,
- Id: consumerId,
- },
+ Consumer: iggcon.NewSingleConsumer(consumerId),
StreamId: streamId,
TopicId: topicId,
PartitionId: &partitionId,
diff --git a/foreign/go/contracts/consumer.go b/foreign/go/contracts/consumer.go
index af49df1d..72b204ec 100644
--- a/foreign/go/contracts/consumer.go
+++ b/foreign/go/contracts/consumer.go
@@ -28,3 +28,27 @@ type Consumer struct {
Kind ConsumerKind
Id Identifier
}
+
+func DefaultConsumer() Consumer {
+ defaultID, _ := NewIdentifier(uint32(1))
+ return Consumer{
+ Kind: ConsumerKindSingle,
+ Id: defaultID,
+ }
+}
+
+// NewSingleConsumer create a new Consumer whose kind is ConsumerKindSingle from the Identifier
+func NewSingleConsumer(id Identifier) Consumer {
+ return Consumer{
+ Kind: ConsumerKindSingle,
+ Id: id,
+ }
+}
+
+// NewGroupConsumer create a new Consumer whose kind is ConsumerKindGroup from the Identifier
+func NewGroupConsumer(id Identifier) Consumer {
+ return Consumer{
+ Kind: ConsumerKindGroup,
+ Id: id,
+ }
+}
diff --git a/foreign/go/contracts/partitions.go b/foreign/go/contracts/partitions.go
index 5b74effc..ff32a170 100644
--- a/foreign/go/contracts/partitions.go
+++ b/foreign/go/contracts/partitions.go
@@ -67,9 +67,9 @@ func None() Partitioning {
}
}
-func PartitionId(value int) Partitioning {
+func PartitionId(value uint32) Partitioning {
bytes := make([]byte, 4)
- binary.LittleEndian.PutUint32(bytes, uint32(value))
+ binary.LittleEndian.PutUint32(bytes, value)
return Partitioning{
Kind: PartitionIdKind,
diff --git a/foreign/go/samples/consumer/consumer.go b/foreign/go/samples/consumer/consumer.go
index b548da69..9a8bbb2e 100644
--- a/foreign/go/samples/consumer/consumer.go
+++ b/foreign/go/samples/consumer/consumer.go
@@ -112,10 +112,7 @@ func ConsumeMessages(cli iggycli.Client) error {
messagesWrapper, err := cli.PollMessages(
streamIdentifier,
topicIdentifier,
- iggcon.Consumer{
- Kind: iggcon.ConsumerKindSingle,
- Id: consumerIdentifier,
- },
+ iggcon.NewSingleConsumer(consumerIdentifier),
iggcon.NextPollingStrategy(),
1,
true,
diff --git a/foreign/node/README.md b/foreign/node/README.md
index f7d08535..700c5f3f 100644
--- a/foreign/node/README.md
+++ b/foreign/node/README.md
@@ -4,30 +4,30 @@ Apache Iggy Node.js client written in typescript, it currently only supports tcp
diclaimer: although all iggy commands & basic client/stream are implemented this is still a WIP, provided as is, and has still a long way to go to be considered "battle tested".
-note: This lib started as _iggy-bin_ ( [github](https://github.com/T1B0/iggy-bin) / [npm](https://www.npmjs.com/package/iggy-bin)) before migrating under iggy-rs org. package iggy-bin@v1.3.4 is equivalent to @iggy.rs/sdk@v1.0.3 and migrating again under apache iggy monorepo ( [github](https://github.com/apache/iggy/tree/master/foreign/node) and is now published on npmjs as @apache-iggy/node-sdk
+note: This lib started as _iggy-bin_ ( [github](https://github.com/T1B0/iggy-bin) / [npm](https://www.npmjs.com/package/iggy-bin)) before migrating under iggy-rs org. package iggy-bin@v1.3.4 is equivalent to @iggy.rs/sdk@v1.0.3 and migrating again under apache iggy monorepo ( [github](https://github.com/apache/iggy/tree/master/foreign/node) and is now published on npmjs as apache-iggy
note: previous works on node.js http client has been moved to [iggy-node-http-client](<https://github.com/iggy-rs/iggy-node-http-client>) (moved on 04 July 2024)
## install
```bash
-npm i --save @apache-iggy/node-sdk
+npm i --save apache-iggy
```
## basic usage
```ts
-import { Client } from "@apache-iggy/node-sdk";
+import { Client } from "apache-iggy";
const credentials = { username: "iggy", password: "iggy" };
-const c = new Client({
+const client = new Client({
transport: "TCP",
options: { port: 8090, host: "127.0.0.1" },
credentials,
});
-const stats = await c.system.getStats();
+const stats = await client.system.getStats();
```
## use sources
diff --git a/foreign/node/package-lock.json b/foreign/node/package-lock.json
index 328472cb..d5f4df94 100644
--- a/foreign/node/package-lock.json
+++ b/foreign/node/package-lock.json
@@ -1,12 +1,12 @@
{
- "name": "@apache-iggy/node-sdk",
- "version": "0.5.0",
+ "name": "apache-iggy",
+ "version": "0.5.0-edge.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "@apache-iggy/node-sdk",
- "version": "0.5.0",
+ "name": "apache-iggy",
+ "version": "0.5.0-edge.1",
"license": "Apache-2.0",
"dependencies": {
"debug": "4.3.7",
diff --git a/foreign/node/package.json b/foreign/node/package.json
index aacf8eeb..039a73d9 100644
--- a/foreign/node/package.json
+++ b/foreign/node/package.json
@@ -1,11 +1,15 @@
{
- "name": "@apache-iggy/node-sdk",
+ "name": "apache-iggy",
"type": "module",
"version": "0.5.0",
- "description": "Official apache iggy nodejs binary client",
+ "description": "Official Apache Iggy NodeJS SDK",
"keywords": [
"iggy",
"driver",
+ "sdk",
+ "apache",
+ "messaging",
+ "streaming",
"client",
"protocol"
],
@@ -22,7 +26,9 @@
"files": [
"dist/**/*.js",
"dist/**/*.d.ts",
- "dist/index.d.ts"
+ "dist/index.d.ts",
+ "!dist/bdd/",
+ "!dist/examples/"
],
"types": "dist/index.d.ts",
"main": "dist/index.js",
diff --git a/foreign/node/src/bdd/message.ts b/foreign/node/src/bdd/message.ts
index f26d1c00..e0eac293 100644
--- a/foreign/node/src/bdd/message.ts
+++ b/foreign/node/src/bdd/message.ts
@@ -20,7 +20,7 @@
import assert from 'node:assert/strict';
import { When, Then } from "@cucumber/cucumber";
-import { ConsumerKind, PollingStrategy, Partitioning } from '../wire/index.js';
+import { Consumer, PollingStrategy, Partitioning } from '../wire/index.js';
import { someMessageContent } from '../tcp.sm.utils.js';
import type { TestWorld } from './world.js';
@@ -67,7 +67,7 @@ When(
const pollReq = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Single, id: 1 },
+ consumer: Consumer.Single,
partitionId,
pollingStrategy: PollingStrategy.Offset(BigInt(offset)),
count: 100,
diff --git a/foreign/node/src/client/client.connection.ts b/foreign/node/src/client/client.connection.ts
new file mode 100644
index 00000000..2f54db5e
--- /dev/null
+++ b/foreign/node/src/client/client.connection.ts
@@ -0,0 +1,221 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import { EventEmitter } from 'node:events';
+import type { Socket } from 'node:net';
+import { createConnection } from 'node:net';
+import { connect as TLSConnect } from 'node:tls';
+import type { ClientConfig, TlsOption, TcpOption, ReconnectOption } from "./client.type.js"
+import { serializeCommand } from './client.utils.js';
+import { debug } from './client.debug.js';
+
+
+const createTcpSocket = (options: TcpOption): Socket => {
+ return createConnection(options);
+};
+
+const createTlsSocket = ({ port, ...options }: TlsOption): Socket => {
+ const socket = TLSConnect(port, options);
+ return socket;
+};
+
+const getTransport = (config: ClientConfig): Socket => {
+ const { transport, options } = config;
+ switch (transport) {
+ case 'TLS': return createTlsSocket(options);
+ case 'TCP':
+ default:
+ return createTcpSocket(options);
+ }
+};
+
+const DefaultReconnectOption: ReconnectOption = {
+ enabled: true,
+ interval: 5 * 1000,
+ maxRetries: 12
+}
+
+function recreate(option: ClientConfig, timer = 1000): Promise<Socket> {
+ return new Promise((resolve) => {
+ setTimeout(() => {
+ resolve(getTransport(option));
+ }, timer);
+ });
+}
+
+type SocketError = Error & { code?: string };
+
+export class IggyConnection extends EventEmitter {
+ public config: ClientConfig
+ public socket: Socket;
+
+ public connected: boolean;
+ public connecting: boolean;
+ public ending: boolean;
+ private waitingResponseEnd: boolean;
+ private reconnectOption: ReconnectOption;
+ private reconnectCount: number;
+
+ private readBuffers: Buffer;
+
+ constructor(config: ClientConfig) {
+ super();
+ this.config = config;
+ this.socket = getTransport(config);
+ this.connected = false;
+ this.connecting = false;
+ this.ending = false;
+ this.waitingResponseEnd = false;
+ this.reconnectOption = { ...DefaultReconnectOption, ...config.reconnect };
+ this.reconnectCount = 0;
+ this.readBuffers = Buffer.allocUnsafe(0);
+ }
+
+ connect() {
+ this.connecting = true;
+
+ this.socket.on('data', this._onData.bind(this));
+
+ this.socket.on('error', async (err: SocketError) => {
+ debug('socket/error event', err, err.code, this.ending);
+ // errors about disconnections should be ignored during disconnect
+ if (this.ending && (err?.code === 'ECONNRESET' || err?.code === 'EPIPE'))
+ return
+
+ this.reconnect(err);
+ });
+
+ this.socket.once('end', async (hadError?: boolean) => {
+ debug('socket/close#END event', hadError);
+ this.connected = false;
+ this.emit('disconnected', hadError);
+ this.reconnect();
+ });
+
+
+ return new Promise((resolve /**, reject*/) => {
+ this.socket.once('connect', () => {
+ debug('socket/connect event');
+ this.connected = true;
+ this.connecting = false;
+ this.reconnectCount = 0;
+ this.emit('connect');
+ resolve(this);
+ });
+ });
+ }
+
+ async reconnect(err?: Error) {
+ const { enabled, interval, maxRetries } = this.reconnectOption
+ debug(
+ 'reconnect# event/reconnect?', {
+ reconnect: { enabled, interval, maxRetries },
+ count: this.reconnectCount,
+ lastError: err
+ }
+ );
+
+ if (!enabled || this.reconnectCount > maxRetries) {
+ debug(`reconnect reached maxRetries of ${maxRetries}`, err);
+ return this.emit(
+ 'error',
+ new Error(
+ `reconnect maxRetries exceeded (count: ${this.reconnectCount})`,
+ { cause: err }
+ ));
+ }
+
+ /** recreate socket */
+ this.connecting = true;
+ this.reconnectCount += 1;
+ this.socket = await recreate(this.config, interval);
+ this.connect();
+ }
+
+ _destroy() {
+ this.ending = true;
+ this.socket.destroy();
+ }
+
+ _endResponseWait() {
+ this.readBuffers = Buffer.allocUnsafe(0);
+ this.waitingResponseEnd = false;
+ }
+
+ _onData(data: Buffer) {
+ debug(
+ 'ONDATA',
+ typeof data,
+ Buffer.isBuffer(data),
+ data?.length,
+ this.waitingResponseEnd
+ );
+
+ if (this.waitingResponseEnd) {
+ data = Buffer.concat([this.readBuffers, data]);
+ }
+
+ if (data.length < 8) {
+ this.socket.unshift(data);
+ return;
+ }
+
+ /**
+ * data[0:4] hold response status code
+ * const status = data.readUInt32LE(0);
+ * data[4:8] hold response length
+ */
+ const responseSize = data.readUInt32LE(4);
+
+ /** response is just head, no payload */
+ if (responseSize === 0 && data.length === 8) {
+ this.emit('response', data);
+ return;
+ }
+
+ const payloadLength = data.length - 8;
+
+ /** payload is complete */
+ if (payloadLength === responseSize) {
+ this.emit('response', data);
+ this._endResponseWait();
+ return;
+ }
+
+ /** payload is incomplete, buffering until next data event */
+ if (payloadLength < responseSize) {
+ this.waitingResponseEnd = true;
+ this.readBuffers = data;
+ return;
+ }
+
+ /** payload is bigger than expected, cut response and unshift extra data */
+ if (payloadLength > responseSize) {
+ this.emit('response', data.subarray(0, 8 + responseSize));
+ this._endResponseWait();
+ this.socket.unshift(data.subarray(8 + responseSize));
+ }
+ }
+
+ writeCommand(command: number, payload: Buffer): boolean {
+ const cmd = serializeCommand(command, payload);
+ return this.socket.write(cmd);
+ }
+}
diff --git a/foreign/node/src/client/client.socket.ts b/foreign/node/src/client/client.socket.ts
index 24af592c..08be5ce5 100644
--- a/foreign/node/src/client/client.socket.ts
+++ b/foreign/node/src/client/client.socket.ts
@@ -18,21 +18,18 @@
*/
-import { Duplex } from 'node:stream';
-
+import { EventEmitter } from 'node:events';
import type {
ClientConfig,
ClientCredentials, CommandResponse,
PasswordCredentials, RawClient, TokenCredentials
-} from './client.type.js';
-
-import { handleResponse, serializeCommand } from './client.utils.js';
+} from '../client/client.type.js';
+import { handleResponse } from './client.utils.js';
import { responseError } from '../wire/error.utils.js';
-import { LOGIN } from '../wire/session/login.command.js';
-import { LOGIN_WITH_TOKEN } from '../wire/session/login-with-token.command.js';
import { debug } from './client.debug.js';
-import { IggyTransport } from './client.transport.js';
-import { PING } from '../wire/index.js';
+import { IggyConnection } from './client.connection.js';
+import { LOGIN, LOGIN_WITH_TOKEN, PING } from '../wire/index.js';
+
const UNLOGGED_COMMAND_CODE = [
PING.code,
@@ -40,8 +37,6 @@ const UNLOGGED_COMMAND_CODE = [
LOGIN_WITH_TOKEN.code
];
-type WriteCb = ((error: Error | null | undefined) => void) | undefined
-
type Job = {
command: number,
payload: Buffer,
@@ -50,51 +45,47 @@ type Job = {
};
-export class CommandResponseStream extends Duplex {
+export class CommandResponseStream extends EventEmitter {
private options: ClientConfig;
- private transport: IggyTransport;
- private _readPaused: boolean;
+ private connection: IggyConnection;
private _execQueue: Job[];
public busy: boolean;
isAuthenticated: boolean;
userId?: number;
+ heartbeatIntervalHandler?: NodeJS.Timeout;
constructor(options: ClientConfig) {
super();
this.options = options;
- this.transport = new IggyTransport(options);
- this._readPaused = false;
+ this.connection = new IggyConnection(options);
this.busy = false;
this.isAuthenticated = false;
this._execQueue = [];
- this.wrapTransport();
- this.heartbeat(options.heartbeatInterval);
+ this._init();
};
-
- _destroy() {
- this.transport.socket.destroy();
- }
- _read(size: number): void {
- this._readPaused = false;
- debug('stream#_read', size);
- setImmediate(this._onReadable.bind(this));
+ _init() {
+ this.heartbeat(this.options.heartbeatInterval);
+ this.connection.on('disconnected', async () => {
+ this.isAuthenticated = false;
+ });
}
- _write(chunk: Buffer, encoding: BufferEncoding | undefined, cb?: WriteCb) {
- return this.transport.socket.write(chunk, encoding, cb);
- };
+ async sendCommand(
+ command: number,
+ payload: Buffer,
+ handleResponse = true,
+ last = true
+ ): Promise<CommandResponse> {
- writeCommand(command: number, payload: Buffer): boolean {
- const cmd = serializeCommand(command, payload);
- return this.transport.socket.write(cmd);
- }
+ if (!this.connection.connected)
+ await this.connection.connect()
- sendCommand(
- command: number, payload: Buffer, handleResponse = true, last = true
- ): Promise<CommandResponse> {
- return new Promise((resolve, reject) => {
- if(last)
+ if (!this.isAuthenticated && !UNLOGGED_COMMAND_CODE.includes(command))
+ await this.authenticate(this.options.credentials);
+
+ return new Promise(async (resolve, reject) => {
+ if (last)
this._execQueue.push({ command, payload, resolve, reject });
else
this._execQueue.unshift({ command, payload, resolve, reject });
@@ -106,7 +97,7 @@ export class CommandResponseStream extends Duplex {
if (this.busy)
return;
this.busy = true;
- while (this._execQueue.length > 0 && this.transport.socket.writable) {
+ while (this._execQueue.length > 0 && this.connection.socket.writable) {
const next = this._execQueue.shift();
if (!next) break;
const { command, payload, resolve, reject } = next;
@@ -125,15 +116,15 @@ export class CommandResponseStream extends Duplex {
payload: Buffer,
handleResp = true
): Promise<CommandResponse> {
- const lastWrite = this.writeCommand(command, payload);
+ const lastWrite = this.connection.writeCommand(command, payload);
debug('==> writeCommand', lastWrite);
return new Promise((resolve, reject) => {
- if(!lastWrite)
+ if (!lastWrite)
return reject(new Error('failed to write to socket'));
const errCb = (err: unknown) => reject(err);
- this.once('error', errCb);
- this.once('data', (resp) => {
- this.removeListener('error', errCb);
+ this.connection.once('error', errCb);
+ this.connection.once('response', (resp) => {
+ this.connection.removeListener('error', errCb);
if (!handleResp) return resolve(resp);
const r = handleResponse(resp);
if (r.status !== 0) {
@@ -147,98 +138,6 @@ export class CommandResponseStream extends Duplex {
_failQueue(err: Error) {
this._execQueue.forEach(({ reject }) => reject(err));
this._execQueue = [];
- }
-
- getReadStream() {
- return this;
- }
-
- wrapTransport() {
- this.transport.on('connect', () => {
- debug('socket#connect event');
- this.emit('connect');
- if(this._execQueue.length > 0) {
- if(!this.isAuthenticated) {
- const needAuth = this._execQueue.some(
- q => !UNLOGGED_COMMAND_CODE.includes(q.command)
- );
- if(needAuth)
- this.authenticate(this.options.credentials);
- }
- this._processQueue();
- }
- });
-
- this.transport.on('close', async (hadError?: boolean) => {
- console.log(
- 'socket#close',
- { hadError, connected: this.transport.connected },
- );
- this.emit('close');
- });
-
- this.transport.on('end', async () => {
- console.error('socket#end');
- this.emit('end');
- });
-
- this.transport.on('error', (err) => {
- console.error('socket#err', err);
- this._failQueue(err);
- this.emit('error', err);
- });
-
- this.transport.on('disconnected', async () => {
- this.isAuthenticated = false;
- });
-
- this.transport.on('drain', () => this.emit('drain'));
-
- this.transport.on(
- 'lookup',
- (err, address, family, host) => this.emit('lookup', err, address, family, host)
- );
- this.transport.on('ready', () => this.emit('ready'));
- this.transport.on('timeout', () => this.emit('timeout'));
-
- // customize data events
- this.transport.on('readable', () => this._onReadable());
- return this.transport;
- }
-
- _onReadable() {
- while (!this._readPaused) {
- const head = this.transport.socket.read(8);
- if (!head || head.length === 0) return;
- if (head.length < 8) {
- this.transport.socket.unshift(head);
- return;
- }
- /** first chunk[4:8] hold response length */
- const responseSize = head.readUInt32LE(4);
- /** response has no payload (create/update/delete ops...) */
- if (responseSize === 0) {
- this.push(head);
- return;
- }
-
- const payload = this.transport.socket.read(responseSize);
- debug('payload', payload, responseSize, head.readUInt32LE(0));
- if (!payload) {
- this.transport.socket.unshift(head);
- return;
- }
- /** payload is incomplete, unshift until next read */
- if (payload.length < responseSize) {
- this.transport.socket.unshift(Buffer.concat([head, payload]));
- return;
- }
-
- const pushOk = this.push(Buffer.concat([head, payload]));
- /** consumer is slower than producer */
- if (!pushOk)
- this._readPaused = true;
- }
}
async authenticate(creds: ClientCredentials) {
@@ -269,20 +168,29 @@ export class CommandResponseStream extends Duplex {
}
heartbeat(interval?: number) {
- if(!interval)
+ if (!interval)
return
-
- setInterval(async () => {
- if(this.transport.connected) {
+
+ this.heartbeatIntervalHandler = setInterval(async () => {
+ if (this.connection.connected) {
debug(`sending hearbeat ping (interval: ${interval} ms)`);
await this.ping()
}
}, interval);
}
-
+ getReadStream() {
+ return this.connection.socket;
+ }
+
+ destroy() {
+ if (this.heartbeatIntervalHandler)
+ clearInterval(this.heartbeatIntervalHandler);
+ return this.connection._destroy();
+ }
};
+
export function getRawClient(options: ClientConfig): RawClient {
return new CommandResponseStream(options);
}
diff --git a/foreign/node/src/client/client.transport.ts b/foreign/node/src/client/client.transport.ts
deleted file mode 100644
index 4614a12f..00000000
--- a/foreign/node/src/client/client.transport.ts
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-import { EventEmitter } from 'node:events';
-import { createConnection, type Socket } from 'node:net';
-import { connect as TLSConnect } from 'node:tls';
-import { debug } from './client.debug.js';
-import type { ClientConfig, TlsOption, TcpOption, ReconnectOption } from './client.type.js';
-
-
-const createTcpSocket = (options: TcpOption): Socket => {
- return createConnection(options);
-};
-
-const createTlsSocket = ({ port, ...options }: TlsOption): Socket => {
- const socket = TLSConnect(port, options);
- socket.setEncoding('utf8');
- return socket;
-};
-
-const getTransport = (config: ClientConfig): Socket => {
- const { transport, options } = config;
- switch (transport) {
- case 'TLS': return createTlsSocket(options);
- case 'TCP':
- default:
- return createTcpSocket(options);
- }
-};
-
-const DefaultReconnectOption: ReconnectOption = {
- enabled: true,
- interval: 5 * 1000,
- maxRetries: 12
-}
-
-function recreate(option: ClientConfig, timer=1000): Promise<Socket> {
- return new Promise((resolve) => {
- setTimeout(() => {
- resolve(getTransport(option));
- }, timer);
- });
-}
-
-export class IggyTransport extends EventEmitter {
- public socket: Socket;
- public connected: boolean;
- public connecting: boolean;
- private config: ClientConfig;
- private reconnectOption: ReconnectOption;
- private reconnectCount: number;
- private lastError: unknown[];
-
- constructor(config: ClientConfig) {
- super()
- this.config = config;
- this.reconnectOption = { ...DefaultReconnectOption, ...config.reconnect };
- this.reconnectCount = 0;
- this.connected = false;
- this.connecting = true;
- this.socket = getTransport(config);
- this.wrapSocket();
- this.lastError = [];
- }
-
- wrapSocket() {
- this.socket.on('connect', () => {
- debug('socket#connect event');
- this.connected = true;
- this.connecting = false;
- // const lastReconnectCount = this.reconnectCount;
- this.reconnectCount = 0;
- this.lastError = [];
- this.emit('connect');
- // if(lastReconnectCount > 0)
- // this.emit('connect');
- });
-
- this.socket.once('close', async (hadError?: boolean) => {
- this.connected = false;
- this.emit('disconnected', hadError);
- const { enabled, interval, maxRetries } = this.reconnectOption
- debug(
- 'socket#close event',
- {
- hadError,
- reconnect: { enabled, interval, maxRetries },
- count:this.reconnectCount
- }
- );
- if(!enabled)
- return this.emit('close', hadError);
-
- if(this.reconnectCount > maxRetries) {
- debug(`reconnect reached maxRetries of ${ maxRetries }`, this.lastError);
- this.emit('close', hadError);
- this.emit(
- 'error',
- new Error(
- `reconnect maxRetries exceeded (count: ${ this.reconnectCount })`,
- { cause: this.lastError.pop() }
- ));
- return;
- }
-
- this.connecting = true;
- this.reconnectCount += 1;
- this.socket = await recreate(this.config, interval);
- this.wrapSocket();
- // this.emit('close');
- });
-
- this.socket.on('end', async (err: unknown) => {
- console.error('Transport/socket#end', err);
- this.emit('end');
- });
-
- this.socket.on('drain', () => this.emit('drain'));
-
- this.socket.on('error', (err) => {
- console.error('Transport/socket#error !1/2-noemit', err);
- this.lastError.push(err);
- if(!this.connecting && !this.connected)
- this.emit('error', err);
- });
-
- this.socket.on(
- 'lookup',
- (err, address, family, host) => this.emit('lookup', err, address, family, host)
- );
- this.socket.on('ready', () => this.emit('ready'));
- this.socket.on('timeout', () => this.emit('timeout'));
- // customize data events
- this.socket.on('readable', () => this.emit('readable'));
- };
-
-};
diff --git a/foreign/node/src/client/client.ts b/foreign/node/src/client/client.ts
index e7ac472e..f373eee8 100644
--- a/foreign/node/src/client/client.ts
+++ b/foreign/node/src/client/client.ts
@@ -20,7 +20,7 @@
import { createPool, type Pool } from 'generic-pool';
import type { RawClient, ClientConfig } from "./client.type.js"
-import { getRawClient } from './client.socket.js';
+import { getRawClient } from '../client/client.socket.js';
import { CommandAPI } from '../wire/command-set.js';
import { debug } from './client.debug.js';
@@ -41,8 +41,6 @@ const poolClientProvider = (config: ClientConfig) => {
const pool = createPool(createPoolFactory(config), { min, max });
const poolClientProvider = async () => {
const c = await pool.acquire();
- if (!c.isAuthenticated)
- await c.authenticate(config.credentials);
debug('client acquired from pool. pool size is', pool.size);
c.once('finishQueue', () => {
pool.release(c)
@@ -58,7 +56,7 @@ const poolClientProvider = (config: ClientConfig) => {
export class Client extends CommandAPI {
_config: ClientConfig
_pool: Pool<RawClient>
-
+
constructor(config: ClientConfig) {
const pcp = poolClientProvider(config);
super(pcp);
@@ -76,9 +74,7 @@ export class Client extends CommandAPI {
const singleClientProvider = (config: ClientConfig) => {
const c = getRawClient(config);
- return async function singleClientProvider () {
- if (!c.isAuthenticated)
- await c.authenticate(config.credentials);
+ return async function singleClientProvider() {
return c;
}
}
@@ -102,7 +98,7 @@ export class SimpleClient extends CommandAPI {
constructor(client: RawClient) {
super(() => Promise.resolve(client));
}
-
+
async destroy() {
const s = await this.clientProvider();
s.destroy();
@@ -112,8 +108,5 @@ export class SimpleClient extends CommandAPI {
export const getClient = async (config: ClientConfig) => {
const cli = getRawClient(config);
- if (!cli.isAuthenticated)
- await cli.authenticate(config.credentials);
- const api = new SimpleClient(cli);
- return api;
+ return new SimpleClient(cli);
};
diff --git a/foreign/node/src/client/client.type.ts b/foreign/node/src/client/client.type.ts
index 6a39e112..4ddf6272 100644
--- a/foreign/node/src/client/client.type.ts
+++ b/foreign/node/src/client/client.type.ts
@@ -35,9 +35,9 @@ export type RawClient = {
sendCommand: (
code: number, payload: Buffer, handleResponse?: boolean
) => Promise<CommandResponse>,
- destroy: () => void,
isAuthenticated: boolean
authenticate: (c: ClientCredentials) => Promise<boolean>
+ destroy: () => void,
on: (ev: string, cb: (e?: unknown) => void) => void
once: (ev: string, cb: (e?: unknown) => void) => void
getReadStream: () => Readable
diff --git a/foreign/node/src/client/client.utils.ts b/foreign/node/src/client/client.utils.ts
index 981c6ffc..e1593634 100644
--- a/foreign/node/src/client/client.utils.ts
+++ b/foreign/node/src/client/client.utils.ts
@@ -52,27 +52,19 @@ const COMMAND_LENGTH = 4;
export const serializeCommand = (command: number, payload: Buffer) => {
const payloadSize = payload.length + COMMAND_LENGTH;
- const head = Buffer.allocUnsafe(8);
+ const data = Buffer.allocUnsafe(8 + payload.length);
- head.writeUint32LE(payloadSize, 0);
- head.writeUint32LE(command, 4);
+ data.writeUint32LE(payloadSize, 0);
+ data.writeUint32LE(command, 4);
+ data.fill(payload, 8);
debug(
'==> CMD', command,
translateCommandCode(command),
- head.subarray(4, 8).toString('hex'),
- 'LENGTH', payloadSize,
- head.subarray(0, 4).toString('hex')
+ 'LENGTH', payloadSize
);
- debug('message#HEAD', head.toString('hex'));
- debug('message#PAYLOAD', payload.toString('hex'));
+ debug('FullMessage#Base64', data.toString('base64'));
- const pl = Buffer.concat([head, payload])
-
- debug('FullMessage#Base64', pl.toString('base64'));
-
- return pl;
+ return data;
}
-
-
diff --git a/foreign/node/src/debug.ts b/foreign/node/src/debug.ts
index afabcf27..ed520288 100644
--- a/foreign/node/src/debug.ts
+++ b/foreign/node/src/debug.ts
@@ -73,7 +73,7 @@ const msg = {
};
try {
-
+
await c.stream.create(stream);
console.log('server stream CREATED::', { streamId });
await c.topic.create(topic);
diff --git a/foreign/node/src/e2e/tcp.consumer-group.e2e.ts b/foreign/node/src/e2e/tcp.consumer-group.e2e.ts
index 6a1f6d4d..94f762e8 100644
--- a/foreign/node/src/e2e/tcp.consumer-group.e2e.ts
+++ b/foreign/node/src/e2e/tcp.consumer-group.e2e.ts
@@ -21,7 +21,7 @@
import { after, describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { SingleClient } from '../client/client.js';
-import { ConsumerKind, PollingStrategy, Partitioning } from '../wire/index.js';
+import { Consumer, PollingStrategy, Partitioning } from '../wire/index.js';
import { generateMessages } from '../tcp.sm.utils.js';
import { getIggyAddress } from '../tcp.sm.utils.js';
@@ -86,7 +86,8 @@ describe('e2e -> consumer-group', async () => {
const mn = 200;
for (let i = 0; i <= ct; i += mn) {
assert.ok(await c.message.send({
- streamId, topicId,
+ streamId,
+ topicId,
messages: generateMessages(mn),
partition: Partitioning.MessageKey(`key-${ i % 300 }`)
}));
@@ -102,7 +103,7 @@ describe('e2e -> consumer-group', async () => {
const pollReq = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Group, id: groupId },
+ consumer: Consumer.Group(groupId),
partitionId: 0,
pollingStrategy: PollingStrategy.Next,
count: 100,
@@ -130,8 +131,6 @@ describe('e2e -> consumer-group', async () => {
});
after(async () => {
- // await c.group.leave({ streamId, topicId, groupId });
- // await c.group.delete({ streamId, topicId, groupId });
assert.ok(await c.stream.delete(stream));
assert.ok(await c.session.logout());
c.destroy();
diff --git a/foreign/node/src/e2e/tcp.send-message.e2e.ts b/foreign/node/src/e2e/tcp.send-message.e2e.ts
index 281a5f5a..595fc7f8 100644
--- a/foreign/node/src/e2e/tcp.send-message.e2e.ts
+++ b/foreign/node/src/e2e/tcp.send-message.e2e.ts
@@ -20,7 +20,7 @@
import { after, describe, it } from 'node:test';
import assert from 'node:assert/strict';
-import { ConsumerKind, PollingStrategy, Partitioning } from '../wire/index.js';
+import { Consumer, PollingStrategy, Partitioning } from '../wire/index.js';
import { generateMessages } from '../tcp.sm.utils.js';
import { getTestClient } from './test-client.utils.js';
@@ -64,7 +64,7 @@ describe('e2e -> message', async () => {
const pollReq = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Single, id: 12 },
+ consumer: Consumer.Single,
partitionId,
pollingStrategy: PollingStrategy.Last,
count: 10,
@@ -79,7 +79,7 @@ describe('e2e -> message', async () => {
const pollReq = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Single, id: 12 },
+ consumer: Consumer.Single,
partitionId,
pollingStrategy: PollingStrategy.First,
count: 10,
@@ -94,7 +94,7 @@ describe('e2e -> message', async () => {
const pollReq = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Single, id: 12 },
+ consumer: Consumer.Single,
partitionId,
pollingStrategy: PollingStrategy.Next,
count: 10,
@@ -109,7 +109,7 @@ describe('e2e -> message', async () => {
const pollReq = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Single, id: 12 },
+ consumer: Consumer.Single,
partitionId,
pollingStrategy: PollingStrategy.Next,
count: 10,
diff --git a/foreign/node/src/examples/stream-file-to-topic.ts b/foreign/node/src/examples/stream-file-to-topic.ts
new file mode 100644
index 00000000..076532d9
--- /dev/null
+++ b/foreign/node/src/examples/stream-file-to-topic.ts
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import { open } from 'node:fs/promises';
+import { resolve } from 'node:path';
+import { pipeline } from 'node:stream/promises';
+import { Writable, type TransformCallback } from 'node:stream';
+import { HeaderValue } from '../index.js';
+import { getClient, ensureStream, ensureTopic } from './utils.js';
+
+export const fileToTopic = async (
+ filepath: string,
+ streamId: number,
+ topicId: number,
+ highWaterMark = 512 * 1024
+) => {
+ const cli = getClient();
+ await ensureStream(cli, streamId);
+ await ensureTopic(cli, streamId, topicId);
+ const fd = await open(filepath);
+ const fname = filepath.split('/').pop() || filepath;
+ const st = await fd.stat();
+ console.log('FILE/STAT', fname, '~', (st.size / (1024 * 1024)).toFixed(2), 'mb', st);
+ const dStart = Date.now();
+
+ try {
+ let idx = 0;
+
+ await pipeline(
+ fd.createReadStream({highWaterMark}),
+
+ new Writable({
+ async write(chunks: Buffer, encoding: BufferEncoding, cb: TransformCallback) {
+ const messages = [{
+ headers: {
+ fileindex: HeaderValue.Uint32(idx++),
+ filename: HeaderValue.String(fname)
+ },
+ payload: chunks
+ }];
+
+ try {
+ await cli.message.send({ streamId, topicId, messages });
+ cb();
+ } catch (err) {
+ console.log('WRITE ERR', err, chunks);
+ cb(err as Error);
+ }
+ }
+ })
+ );
+
+ console.log(`Finished ! took ${Date.now() - dStart}ms`,);
+ } catch (err) {
+ console.error('Pipeline failed !', err);
+ throw err;
+ }
+};
+
+
+const argz = process.argv.slice(2);
+const [rPath, streamIdStr, topicIdStr] = argz;
+
+if (argz.length < 3 || ['-h', '--help', '?'].includes(argz[0])) {
+ console.log(`Usage: node stream-file-to-topic.js filePath streamId topicId`)
+ console.log('got', argz);
+ console.log('note: this script only accept numerical stream/topic id');
+ process.exit(1);
+}
+
+const filepath = resolve(rPath);
+const streamId = parseInt(streamIdStr);
+const topicId = parseInt(topicIdStr);
+
+console.log('running with params:', { filepath, streamId, topicId })
+
+try {
+ await fileToTopic(filepath, streamId, topicId, 512 * 1024);
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+} catch(err) {
+ process.exit(1);
+}
+
+process.exit(0);
diff --git a/foreign/node/src/examples/stream-topic-to-file.ts b/foreign/node/src/examples/stream-topic-to-file.ts
new file mode 100644
index 00000000..a7b66666
--- /dev/null
+++ b/foreign/node/src/examples/stream-topic-to-file.ts
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import { PollingStrategy, singleConsumerStream, Consumer } from '../index.js';
+import { open } from 'node:fs/promises';
+import { resolve } from 'node:path';
+import { getClient } from './utils.js';
+import type { PollMessagesResponse } from '../wire/index.js';
+
+
+export const topicToFile = async (
+ filepath: string,
+ streamId: number,
+ topicId: number,
+ partitionId = 1
+) => {
+ const cli = getClient();
+ const fd = await open(filepath, 'w+');
+
+ const t = await cli.topic.get({ streamId, topicId });
+ console.log('TOPIC/GET', t);
+
+ // reset consumer offset
+ try {
+ const offset = await cli.offset.get({
+ streamId, topicId, partitionId, consumer: Consumer.Single
+ });
+ if (offset)
+ await cli.offset.delete({ streamId, topicId, partitionId, consumer: Consumer.Single });
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (err) {}
+
+ const dStart = Date.now();
+ const consumer = singleConsumerStream(cli._config);
+ const stream = await consumer({
+ streamId,
+ topicId,
+ partitionId,
+ pollingStrategy: PollingStrategy.Next,
+ count: 1,
+ interval: 1000,
+ endOnLastOffset: true
+ });
+
+ stream.on('data', async (polled: PollMessagesResponse) => {
+ const { messages } = polled;
+ return await fd.write(Buffer.concat(messages.map(m => m.payload)));
+ });
+
+ stream.once('end', () => {
+ console.log('pollStream#end', `took ${Date.now() - dStart}ms`);
+ fd.datasync();
+ fd.close();
+ stream.destroy();
+ });
+
+ stream.on('error', (err) => {
+ console.log('pollStream#err', err);
+ stream.destroy();
+ });
+
+ return stream;
+};
+
+
+const argz = process.argv.slice(2);
+const [rPath, streamIdStr, topicIdStr] = argz;
+
+if (argz.length < 3 || ['-h', '--help', '?'].includes(argz[0])) {
+ console.log(`Usage: node stream-file-to-topic.js filePath streamId topicId`)
+ console.log('got', argz);
+ console.log('note: this script only accept numerical stream/topic id');
+ process.exit(1);
+}
+
+const filepath = resolve(rPath);
+const streamId = parseInt(streamIdStr);
+const topicId = parseInt(topicIdStr);
+
+console.log('running with params:', { filepath, streamId, topicId });
+
+const s = await topicToFile(filepath, streamId, topicId);
+
+s.on('end', () => {
+ console.log('end, exiting');
+ process.exit(0);
+});
+
+s.on('error', (err) => {
+ console.error('FAILED WITH ERROR', err, 'exiting...');
+ process.exit(1);
+});
diff --git a/foreign/node/src/examples/utils.ts b/foreign/node/src/examples/utils.ts
new file mode 100644
index 00000000..d17713a6
--- /dev/null
+++ b/foreign/node/src/examples/utils.ts
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import { Client } from '../index.js';
+import { getIggyAddress } from '../tcp.sm.utils.js';
+
+
+export const getClient = () => {
+ const [host, port] = getIggyAddress();
+ const credentials = { username: 'iggy', password: 'iggy' };
+
+ const opt = {
+ transport: 'TCP' as const,
+ options: { host, port },
+ credentials
+ };
+
+ return new Client(opt);
+}
+
+export const ensureStream = async (cli: Client, streamId: number) => {
+ try {
+ return !!await cli.stream.get({ streamId });
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (err) {
+ return cli.stream.create({ streamId, name: `ensure-stream-${streamId}` })
+ }
+}
+
+export const ensureTopic = async (
+ cli: Client,
+ streamId: number,
+ topicId: number,
+ partitionCount = 1,
+ compressionAlgorithm = 1
+) => {
+ try {
+ return !!await cli.topic.get({ streamId, topicId });
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ } catch (err) {
+ return cli.topic.create({
+ streamId,
+ topicId,
+ name: `ensure-topic-${streamId}-${topicId}`,
+ partitionCount,
+ compressionAlgorithm
+ });
+ }
+}
+
diff --git a/foreign/node/src/index.ts b/foreign/node/src/index.ts
index 9199da0e..687e4c5f 100644
--- a/foreign/node/src/index.ts
+++ b/foreign/node/src/index.ts
@@ -19,13 +19,12 @@
export {
+ type Id,
PollingStrategy,
- ConsumerKind,
+ Consumer,
Partitioning,
- HeaderValue
+ HeaderValue,
} from './wire/index.js';
-export { Id } from './wire/identifier.utils.js';
-
export * from './client/index.js';
export * from './stream/index.js';
diff --git a/foreign/node/src/quic.lib-test.js b/foreign/node/src/quic.lib-test.js
deleted file mode 100644
index 5ca47c67..00000000
--- a/foreign/node/src/quic.lib-test.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-import { WebTransport } from '@fails-components/webtransport';
-// import {
-// Http3WebTransportClient
-// } from '@fails-components/webtransport-transport-http3-quiche';
-
-
-const createQuicSocket = ({port, host, ...rest}) => {
- return new WebTransport({port, host, ...rest});
-};
-
-console.log(WebTransport);
-
-let isOpen = false;
-
-async function readData(reader) {
-
- reader.closed
- .catch((err) => console.error("Failed to close", err.toString()))
- .finally(() => isOpen = false);
-
- while (isOpen) {
- try {
- const { done, value } = await reader.read();
- if (done) { break; }
-
- console.log("Received:", value);
- } catch (err) {
- console.log("Failed to read...", err.toString());
- break;
- }
- }
-};
-
-
-
-/**
- * @param {string} [certHash]
- * @returns {Uint8Array}
- */
-export function readCertHash(certHash) {
- return Uint8Array.from(`${certHash}`.split(':').map((i) => parseInt(i, 16)))
-}
-
-const main = async () => {
-
- try {
- // const transport = new WebTransport("https://demo.web-transport.io:4433");
- const transport = new WebTransport("https://localhost:8080");
-
-
- // console.log('init', socket)
- console.dir(transport);
- // const wtOptions = {
- // serverCertificateHashes: [
- // {
- // algorithm: 'sha-256',
- // value: readCertHash(process.env.CERT_HASH)
- // }
- // ],
- // // @ts-ignore
- // forceReliable: true
- // }
-
- // const transport = new WebTransport("https://localhost:8080");
- // // console.dir(transport);
-
- // transport.ready.then((...arg) => console.log('READY !', arg));
-
- // const readableStream = transport.datagrams.readable.getReader();
- // console.dir(readableStream);
-
- // const writer = transport.datagrams.writable.getWriter();
- // console.dir(writer);
-
- // isOpen = true;
- // readData(readableStream);
- } catch (err) {
- console.error('connexion failed', err);
- isOpen = false;
- }
-
-
-};
-
-main();
diff --git a/foreign/node/src/stream/consumer-stream.ts b/foreign/node/src/stream/consumer-stream.ts
index 3e07afdc..8f572103 100644
--- a/foreign/node/src/stream/consumer-stream.ts
+++ b/foreign/node/src/stream/consumer-stream.ts
@@ -18,13 +18,16 @@
*/
-import { Readable, pipeline, PassThrough } from "node:stream";
-import type { ClientConfig, RawClient } from "../client/client.type.js";
-import { getRawClient } from '../client/client.socket.js';
+import { Readable } from "node:stream";
+import type { ClientConfig } from "../client/client.type.js";
import type { Id } from '../wire/identifier.utils.js';
import { getClient } from "../client/client.js";
-import { type PollMessages, POLL_MESSAGES } from "../wire/message/poll-messages.command.js";
-import { type PollingStrategy, ConsumerKind, type CommandAPI } from "../wire/index.js";
+import { type PollMessages } from "../wire/message/poll-messages.command.js";
+import {
+ type PollingStrategy,
+ type CommandAPI,
+ Consumer
+} from "../wire/index.js";
import { debug } from "../client/client.debug.js";
@@ -33,10 +36,11 @@ const wait = (interval: number, cb?: () => void): Promise<void> =>
setTimeout(() => resolve(cb ? cb() : undefined), interval)
});
-async function* genAutoCommitedPoll(
+async function* genEagerUntilPoll(
c: CommandAPI,
poll: PollMessages,
- interval = 1000
+ interval = 1000,
+ endOnLastOffset = false
) {
const state: Map<string, number> = new Map();
@@ -44,48 +48,64 @@ async function* genAutoCommitedPoll(
const r = await c.message.poll(poll);
yield r;
state.set(`${r.partitionId}`, r.count);
-
+
if (Array.from(state).every(([, last]) => last === 0)) {
- await wait(interval);
+ if( endOnLastOffset )
+ return;
+ else
+ await wait(interval);
}
}
};
-async function* genPoll(
- c: RawClient,
- poll: PollMessages,
-) {
- const pl = POLL_MESSAGES.serialize(poll);
- yield await c.sendCommand(POLL_MESSAGES.code, pl, false);
+
+export type ConsumerStreamRequest = {
+ streamId: Id,
+ topicId: Id,
+ pollingStrategy: PollingStrategy,
+ count: number,
+ interval?: number,
+ autocommit?: boolean
+ endOnLastOffset?: boolean
+}
+
+export type SingleConsumerStreamRequest = ConsumerStreamRequest & {
+ partitionId: number,
};
+export type GroupConsumerStreamRequest = ConsumerStreamRequest & { groupId: number };
export const singleConsumerStream = (config: ClientConfig) => async (
- poll: PollMessages,
- // interval: 1000
+ {
+ streamId,
+ topicId,
+ partitionId,
+ pollingStrategy,
+ count,
+ interval = 1000,
+ autocommit = true,
+ endOnLastOffset = false
+ }: SingleConsumerStreamRequest
): Promise<Readable> => {
- const c = getRawClient(config);
- if (!c.isAuthenticated)
- await c.authenticate(config.credentials);
- const ps = Readable.from(genPoll(c, poll), { objectMode: true });
- // const ps = Readable.from(genAutoCommitedPoll(c, poll, interval), { objectMode: true });
+ const c = await getClient(config);
+
+ const poll = {
+ streamId,
+ topicId,
+ partitionId,
+ consumer: Consumer.Single,
+ pollingStrategy,
+ count,
+ autocommit
+ };
- return pipeline(
- ps,
- new PassThrough({ objectMode: true }),
- (err) => console.error('pipeline error', err)
+ const ps = Readable.from(
+ genEagerUntilPoll(c, poll, interval, endOnLastOffset),
+ { objectMode: true }
);
+ return ps;
};
-export type ConsumerGroupStreamRequest = {
- groupId: number,
- streamId: Id,
- topicId: Id,
- pollingStrategy: PollingStrategy,
- count: number,
- interval?: number,
- autocommit?: boolean
-}
export const groupConsumerStream = (config: ClientConfig) =>
async function groupConsumerStream({
@@ -95,8 +115,9 @@ export const groupConsumerStream = (config: ClientConfig) =>
pollingStrategy,
count,
interval = 1000,
- autocommit = true
- }: ConsumerGroupStreamRequest): Promise<Readable> {
+ autocommit = true,
+ endOnLastOffset = false
+ }: GroupConsumerStreamRequest): Promise<Readable> {
const s = await getClient(config);
try {
@@ -113,24 +134,16 @@ export const groupConsumerStream = (config: ClientConfig) =>
const poll = {
streamId,
topicId,
- consumer: { kind: ConsumerKind.Group, id: groupId },
+ consumer: Consumer.Group(groupId),
partitionId: 0,
pollingStrategy,
count,
autocommit
}
- const ps = Readable.from(genAutoCommitedPoll(s, poll, interval), { objectMode: true });
- // return (await s.clientProvider()).getReadStream();
- // c.on('error', (err: unknown) => {
- // debug('groupConsumerStream::client error', err);
- // // ps.emit('error', err);
- // });
-
- // c.on('end', () => {
- // debug('groupConsumerStream::END');
- // // ps.emit('end');
- // });
+ const ps = Readable.from(
+ genEagerUntilPoll(s, poll, interval, endOnLastOffset),
+ { objectMode: true }
+ );
return ps;
};
-
diff --git a/foreign/node/src/wire/client/client.utils.ts b/foreign/node/src/wire/client/client.utils.ts
index 10a23a6a..c9e68b01 100644
--- a/foreign/node/src/wire/client/client.utils.ts
+++ b/foreign/node/src/wire/client/client.utils.ts
@@ -49,6 +49,8 @@ export const deserializeClient = (r: Buffer, pos = 0): ClientDeserialized => {
* 13 - x string - adress
* x - x+4 u32 - consumerGroupCount
*/
+ if(r.length < 17)
+ throw new Error('Client does not exist');
const addressLength = r.readUInt32LE(pos + 9);
diff --git a/foreign/node/src/wire/index.ts b/foreign/node/src/wire/index.ts
index c3b9c05e..400e2aad 100644
--- a/foreign/node/src/wire/index.ts
+++ b/foreign/node/src/wire/index.ts
@@ -30,3 +30,5 @@ export * from './token/index.js';
export * from './topic/index.js';
export * from './user/index.js';
export * from './command-set.js';
+export { type Id } from './identifier.utils.js';
+
diff --git a/foreign/node/src/wire/offset/get-offset.command.ts b/foreign/node/src/wire/offset/get-offset.command.ts
index ad347eb6..4a91fd8b 100644
--- a/foreign/node/src/wire/offset/get-offset.command.ts
+++ b/foreign/node/src/wire/offset/get-offset.command.ts
@@ -40,6 +40,9 @@ export const GET_OFFSET = {
},
deserialize: (r: CommandResponse): OffsetResponse => {
+ if(r.data.length < 20)
+ throw new Error('Offset not found');
+
const partitionId = r.data.readUInt32LE(0);
const currentOffset = r.data.readBigUInt64LE(4);
const storedOffset = r.data.readBigUInt64LE(12);
diff --git a/foreign/node/src/wire/offset/index.ts b/foreign/node/src/wire/offset/index.ts
index 8872713e..da9ef1d3 100644
--- a/foreign/node/src/wire/offset/index.ts
+++ b/foreign/node/src/wire/offset/index.ts
@@ -20,5 +20,4 @@
export * from './get-offset.command.js';
export * from './store-offset.command.js';
-
-export { ConsumerKind } from './offset.utils.js';
+export { Consumer } from './offset.utils.js';
diff --git a/foreign/node/src/wire/offset/offset.utils.ts b/foreign/node/src/wire/offset/offset.utils.ts
index 926df849..80529b79 100644
--- a/foreign/node/src/wire/offset/offset.utils.ts
+++ b/foreign/node/src/wire/offset/offset.utils.ts
@@ -37,6 +37,21 @@ export type Consumer = {
id: Id
}
+export const ConsumerSingle = {
+ kind: ConsumerKind.Single,
+ id: 0
+};
+
+export type ConsumerSingle = typeof ConsumerSingle;
+
+export const Consumer = {
+ Single: ConsumerSingle,
+ Group: (groupId: Id) => ({
+ kind: ConsumerKind.Group,
+ id: groupId
+ })
+}
+
export type OffsetResponse = {
partitionId: number,
currentOffset: bigint,
diff --git a/foreign/node/src/wire/stream/stream.utils.ts b/foreign/node/src/wire/stream/stream.utils.ts
index 7d88b03d..63863af2 100644
--- a/foreign/node/src/wire/stream/stream.utils.ts
+++ b/foreign/node/src/wire/stream/stream.utils.ts
@@ -35,6 +35,9 @@ type StreamDeserialized = {
};
export const deserializeToStream = (r: Buffer, pos = 0): StreamDeserialized => {
+ if (r.length === 0)
+ throw new Error('Steam does not exist');
+
const id = r.readUInt32LE(pos);
const createdAt = toDate(r.readBigUint64LE(pos + 4));
const topicsCount = r.readUInt32LE(pos + 12);
diff --git a/foreign/node/src/wire/topic/create-topic.command.ts b/foreign/node/src/wire/topic/create-topic.command.ts
index 4c311572..bb4e1e5a 100644
--- a/foreign/node/src/wire/topic/create-topic.command.ts
+++ b/foreign/node/src/wire/topic/create-topic.command.ts
@@ -23,10 +23,10 @@ import { serializeIdentifier, type Id } from '../identifier.utils.js';
import { wrapCommand } from '../command.utils.js';
import { COMMAND_CODE } from '../command.code.js';
import {
- isValidCompressionAlgorithm, CompressionAlgorithmKind,
+ isValidCompressionAlgorithm, CompressionAlgorithm,
deserializeTopic,
type Topic,
- type CompressionAlgorithm
+ type CompressionAlgorithm as CompressionAlgorithmT
} from './topic.utils.js';
@@ -35,7 +35,7 @@ export type CreateTopic = {
topicId: number,
name: string,
partitionCount: number,
- compressionAlgorithm: CompressionAlgorithm,
+ compressionAlgorithm: CompressionAlgorithmT,
messageExpiry?: bigint,
maxTopicSize?: bigint,
replicationFactor?: number
@@ -49,7 +49,7 @@ export const CREATE_TOPIC = {
topicId,
name,
partitionCount,
- compressionAlgorithm = CompressionAlgorithmKind.None,
+ compressionAlgorithm = CompressionAlgorithm.None,
messageExpiry = 0n,
maxTopicSize = 0n,
replicationFactor = 1
diff --git a/foreign/node/src/wire/topic/index.ts b/foreign/node/src/wire/topic/index.ts
index c4de7f1d..4c93c1c6 100644
--- a/foreign/node/src/wire/topic/index.ts
+++ b/foreign/node/src/wire/topic/index.ts
@@ -24,3 +24,4 @@ export * from './get-topic.command.js';
export * from './get-topics.command.js';
export * from './purge-topic.command.js';
export * from './update-topic.command.js';
+export { CompressionAlgorithm } from './topic.utils.js';
diff --git a/foreign/node/src/wire/topic/topic.utils.ts b/foreign/node/src/wire/topic/topic.utils.ts
index fe456514..9b886bda 100644
--- a/foreign/node/src/wire/topic/topic.utils.ts
+++ b/foreign/node/src/wire/topic/topic.utils.ts
@@ -53,23 +53,22 @@ type BaseTopicSerialized = { data: BaseTopic } & Serialized;
type TopicSerialized = { data: Topic } & Serialized;
-
-export const CompressionAlgorithmKind = {
+export const CompressionAlgorithm = {
None: 1,
Gzip: 2
};
-export type CompressionAlgorithmKind = typeof CompressionAlgorithmKind;
-export type CompressionAlgorithmKindId = keyof CompressionAlgorithmKind;
-export type CompressionAlgorithmKindValue = ValueOf<CompressionAlgorithmKind>;
+export type CompressionAlgorithmKind = typeof CompressionAlgorithm;
+export type CompressionAlgorithmKindId = keyof CompressionAlgorithm;
+export type CompressionAlgorithmKindValue = ValueOf<CompressionAlgorithm>;
export type CompressionAlgorithmNone = CompressionAlgorithmKind['None'];
export type CompressionAlgorithmGzip = CompressionAlgorithmKind['Gzip'];
export type CompressionAlgorithm = CompressionAlgorithmNone | CompressionAlgorithmGzip;
-export const isValidCompressionAlgorithm = (ca: number): ca is CompressionAlgorithm =>
- Object.values(CompressionAlgorithmKind).includes(ca);
+export const isValidCompressionAlgorithm = (ca: number): ca is CompressionAlgorithm =>
+ Object.values(CompressionAlgorithm).includes(ca);
export const deserializeBaseTopic = (p: Buffer, pos = 0): BaseTopicSerialized => {
const id = p.readUInt32LE(pos);
@@ -119,6 +118,9 @@ export const deserializePartition = (p: Buffer, pos = 0): PartitionSerialized =>
export const deserializeTopic = (p: Buffer, pos = 0): TopicSerialized => {
+ if (p.length === 0)
+ throw new Error('Topic does not exist');
+
const start = pos;
const { bytesRead, data } = deserializeBaseTopic(p, pos);
pos += bytesRead;
diff --git a/foreign/node/src/wire/topic/update-topic.command.ts b/foreign/node/src/wire/topic/update-topic.command.ts
index a5d5a72a..24f13726 100644
--- a/foreign/node/src/wire/topic/update-topic.command.ts
+++ b/foreign/node/src/wire/topic/update-topic.command.ts
@@ -23,7 +23,9 @@ import { deserializeVoidResponse } from '../../client/client.utils.js';
import { wrapCommand } from '../command.utils.js';
import { COMMAND_CODE } from '../command.code.js';
import {
- type CompressionAlgorithm, CompressionAlgorithmKind, isValidCompressionAlgorithm
+ type CompressionAlgorithm as CompressionAlgorithmT,
+ CompressionAlgorithm,
+ isValidCompressionAlgorithm
} from './topic.utils.js';
@@ -31,7 +33,7 @@ export type UpdateTopic = {
streamId: Id,
topicId: Id,
name: string,
- compressionAlgorithm?: CompressionAlgorithm,
+ compressionAlgorithm?: CompressionAlgorithmT,
messageExpiry?: bigint,
maxTopicSize?: bigint,
replicationFactor?: number,
@@ -44,7 +46,7 @@ export const UPDATE_TOPIC = {
streamId,
topicId,
name,
- compressionAlgorithm = CompressionAlgorithmKind.None,
+ compressionAlgorithm = CompressionAlgorithm.None,
messageExpiry = 0n,
maxTopicSize = 0n,
replicationFactor = 1,
diff --git a/foreign/node/src/wire/user/user.utils.ts b/foreign/node/src/wire/user/user.utils.ts
index bafa22f3..132eb30b 100644
--- a/foreign/node/src/wire/user/user.utils.ts
+++ b/foreign/node/src/wire/user/user.utils.ts
@@ -50,6 +50,9 @@ const statusString = (t: number): string => {
}
export const deserializeBaseUser = (p: Buffer, pos = 0): BaseUserDeserialized => {
+ if (p.length === 0)
+ throw new Error('User does not exist');
+
const id = p.readUInt32LE(pos);
const createdAt = toDate(p.readBigUInt64LE(pos + 4))
const status = statusString(p.readUInt8(pos + 12));
diff --git a/foreign/python/Cargo.toml b/foreign/python/Cargo.toml
index 018fc089..427cea89 100644
--- a/foreign/python/Cargo.toml
+++ b/foreign/python/Cargo.toml
@@ -1,8 +1,8 @@
[package]
name = "iggy-py"
-version = "0.4.0"
+version = "0.5.0"
edition = "2021"
-authors = ["Dario Lencina Talarico <da...@gmail.com>"]
+authors = ["Dario Lencina Talarico <da...@gmail.com>", "Albin Skott <al...@mattsson.io>"]
license = "Apache-2.0"
description = "Apache Iggy is the persistent message streaming platform written in Rust, supporting QUIC, TCP and HTTP transport protocols, capable of processing millions of messages per second."
documentation = "https://iggy.apache.org/docs/"
@@ -15,7 +15,8 @@ pyo3-async-runtimes = { version = "0.25.0", features = [
"attributes",
"tokio-runtime",
] }
-pyo3-stub-gen = "0.9.1"
+pyo3-stub-gen = "0.11.1"
+tokio = "1.40.0"
[lib]
name = "iggy_py"
diff --git a/foreign/python/iggy_py.pyi b/foreign/python/iggy_py.pyi
index 5c620853..f2459bce 100644
--- a/foreign/python/iggy_py.pyi
+++ b/foreign/python/iggy_py.pyi
@@ -18,9 +18,164 @@
# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401
+import asyncio
import builtins
+import collections.abc
+import datetime
import typing
-from enum import Enum
+
+class AutoCommit:
+ r"""
+ The auto-commit configuration for storing the offset on the server.
+ """
+ class Disabled(AutoCommit):
+ r"""
+ The auto-commit is disabled and the offset must be stored manually by the consumer.
+ """
+ __match_args__ = ((),)
+ def __new__(cls) -> AutoCommit.Disabled: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class Interval(AutoCommit):
+ r"""
+ The auto-commit is enabled and the offset is stored on the server after a certain interval.
+ """
+ __match_args__ = ("_0",)
+ @property
+ def _0(self) -> datetime.timedelta: ...
+ def __new__(cls, _0:datetime.timedelta) -> AutoCommit.Interval: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class IntervalOrWhen(AutoCommit):
+ r"""
+ The auto-commit is enabled and the offset is stored on the server after a certain interval or depending on the mode when consuming the messages.
+ """
+ __match_args__ = ("_0", "_1",)
+ @property
+ def _0(self) -> datetime.timedelta: ...
+ @property
+ def _1(self) -> AutoCommitWhen: ...
+ def __new__(cls, _0:datetime.timedelta, _1:AutoCommitWhen) -> AutoCommit.IntervalOrWhen: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class IntervalOrAfter(AutoCommit):
+ r"""
+ The auto-commit is enabled and the offset is stored on the server after a certain interval or depending on the mode after consuming the messages.
+ """
+ __match_args__ = ("_0", "_1",)
+ @property
+ def _0(self) -> datetime.timedelta: ...
+ @property
+ def _1(self) -> AutoCommitAfter: ...
+ def __new__(cls, _0:datetime.timedelta, _1:AutoCommitAfter) -> AutoCommit.IntervalOrAfter: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class When(AutoCommit):
+ r"""
+ The auto-commit is enabled and the offset is stored on the server depending on the mode when consuming the messages.
+ """
+ __match_args__ = ("_0",)
+ @property
+ def _0(self) -> AutoCommitWhen: ...
+ def __new__(cls, _0:AutoCommitWhen) -> AutoCommit.When: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class After(AutoCommit):
+ r"""
+ The auto-commit is enabled and the offset is stored on the server depending on the mode after consuming the messages.
+ """
+ __match_args__ = ("_0",)
+ @property
+ def _0(self) -> AutoCommitAfter: ...
+ def __new__(cls, _0:AutoCommitAfter) -> AutoCommit.After: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ ...
+
+class AutoCommitAfter:
+ r"""
+ The auto-commit mode for storing the offset on the server **after** receiving the messages.
+ """
+ class ConsumingAllMessages(AutoCommitAfter):
+ r"""
+ The offset is stored on the server after all the messages are consumed.
+ """
+ __match_args__ = ((),)
+ def __new__(cls) -> AutoCommitAfter.ConsumingAllMessages: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class ConsumingEachMessage(AutoCommitAfter):
+ r"""
+ The offset is stored on the server after consuming each message.
+ """
+ __match_args__ = ((),)
+ def __new__(cls) -> AutoCommitAfter.ConsumingEachMessage: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class ConsumingEveryNthMessage(AutoCommitAfter):
+ r"""
+ The offset is stored on the server after consuming every Nth message.
+ """
+ __match_args__ = ("_0",)
+ @property
+ def _0(self) -> builtins.int: ...
+ def __new__(cls, _0:builtins.int) -> AutoCommitAfter.ConsumingEveryNthMessage: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ ...
+
+class AutoCommitWhen:
+ r"""
+ The auto-commit mode for storing the offset on the server.
+ """
+ class PollingMessages(AutoCommitWhen):
+ r"""
+ The offset is stored on the server when the messages are received.
+ """
+ __match_args__ = ((),)
+ def __new__(cls) -> AutoCommitWhen.PollingMessages: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class ConsumingAllMessages(AutoCommitWhen):
+ r"""
+ The offset is stored on the server when all the messages are consumed.
+ """
+ __match_args__ = ((),)
+ def __new__(cls) -> AutoCommitWhen.ConsumingAllMessages: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class ConsumingEachMessage(AutoCommitWhen):
+ r"""
+ The offset is stored on the server when consuming each message.
+ """
+ __match_args__ = ((),)
+ def __new__(cls) -> AutoCommitWhen.ConsumingEachMessage: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ class ConsumingEveryNthMessage(AutoCommitWhen):
+ r"""
+ The offset is stored on the server when consuming every Nth message.
+ """
+ __match_args__ = ("_0",)
+ @property
+ def _0(self) -> builtins.int: ...
+ def __new__(cls, _0:builtins.int) -> AutoCommitWhen.ConsumingEveryNthMessage: ...
+ def __len__(self) -> builtins.int: ...
+ def __getitem__(self, key:builtins.int) -> typing.Any: ...
+
+ ...
class IggyClient:
r"""
@@ -90,6 +245,92 @@ class IggyClient:
Returns a list of received messages or a PyRuntimeError on failure.
"""
+ def consumer_group(self, name:builtins.str, stream:builtins.str, topic:builtins.str, partition_id:typing.Optional[builtins.int]=None, polling_strategy:typing.Optional[PollingStrategy]=None, batch_length:typing.Optional[builtins.int]=None, auto_commit:typing.Optional[AutoCommit]=None, create_consumer_group_if_not_exists:builtins.bool=True, auto_join_consumer_group:builtins.bool=True, poll_interval:typing.Optional[datetime.timedelta]=None, polling_retry_interval:typing.Optional[datetim [...]
+ r"""
+ Creates a new consumer group consumer.
+
+ Returns the consumer or a PyRuntimeError on failure.
+ """
+
+class IggyConsumer:
+ r"""
+ A Python class representing the Iggy consumer.
+ It wraps the RustIggyConsumer and provides asynchronous functionality
+ through the contained runtime.
+ """
+ def get_last_consumed_offset(self, partition_id:builtins.int) -> typing.Optional[builtins.int]:
+ r"""
+ Get the last consumed offset or `None` if no offset has been consumed yet.
+ """
+ def get_last_stored_offset(self, partition_id:builtins.int) -> typing.Optional[builtins.int]:
+ r"""
+ Get the last stored offset or `None` if no offset has been stored yet.
+ """
+ def name(self) -> builtins.str:
+ r"""
+ Gets the name of the consumer group.
+ """
+ def partition_id(self) -> builtins.int:
+ r"""
+ Gets the current partition id or `0` if no messages have been polled yet.
+ """
+ def stream(self) -> builtins.str | builtins.int:
+ r"""
+ Gets the name of the stream this consumer group is configured for.
+ """
+ def topic(self) -> builtins.str | builtins.int:
+ r"""
+ Gets the name of the topic this consumer group is configured for.
+ """
+ def store_offset(self, offset:builtins.int, partition_id:typing.Optional[builtins.int]) -> typing.Any:
+ r"""
+ Stores the provided offset for the provided partition id or if none is specified
+ uses the current partition id for the consumer group.
+
+ Returns `Ok(())` if the server responds successfully, or a `PyRuntimeError`
+ if the operation fails.
+ """
+ def delete_offset(self, partition_id:typing.Optional[builtins.int]) -> typing.Any:
+ r"""
+ Deletes the offset for the provided partition id or if none is specified
+ uses the current partition id for the consumer group.
+
+ Returns `Ok(())` if the server responds successfully, or a `PyRuntimeError`
+ if the operation fails.
+ """
+ def consume_messages(self, callback:collections.abc.Callable[[str]], shutdown_event:typing.Optional[asyncio.Event]) -> typing.Any:
+ r"""
+ Consumes messages continuously using a callback function and an optional `asyncio.Event` for signaling shutdown.
+
+ Returns an awaitable that completes when shutdown is signaled or a PyRuntimeError on failure.
+ """
+
+class PollingStrategy:
+ class Offset(PollingStrategy):
+ __match_args__ = ("value",)
+ @property
+ def value(self) -> builtins.int: ...
+ def __new__(cls, value:builtins.int) -> PollingStrategy.Offset: ...
+
+ class Timestamp(PollingStrategy):
+ __match_args__ = ("value",)
+ @property
+ def value(self) -> builtins.int: ...
+ def __new__(cls, value:builtins.int) -> PollingStrategy.Timestamp: ...
+
+ class First(PollingStrategy):
+ __match_args__ = ((),)
+ def __new__(cls) -> PollingStrategy.First: ...
+
+ class Last(PollingStrategy):
+ __match_args__ = ((),)
+ def __new__(cls) -> PollingStrategy.Last: ...
+
+ class Next(PollingStrategy):
+ __match_args__ = ((),)
+ def __new__(cls) -> PollingStrategy.Next: ...
+
+ ...
class ReceiveMessage:
r"""
@@ -150,21 +391,22 @@ class SendMessage:
"""
class StreamDetails:
- id: builtins.int
- name: builtins.str
- messages_count: builtins.int
- topics_count: builtins.int
+ @property
+ def id(self) -> builtins.int: ...
+ @property
+ def name(self) -> builtins.str: ...
+ @property
+ def messages_count(self) -> builtins.int: ...
+ @property
+ def topics_count(self) -> builtins.int: ...
class TopicDetails:
- id: builtins.int
- name: builtins.str
- messages_count: builtins.int
- partitions_count: builtins.int
-
-class PollingStrategy(Enum):
- Offset = ...
- Timestamp = ...
- First = ...
- Last = ...
- Next = ...
+ @property
+ def id(self) -> builtins.int: ...
+ @property
+ def name(self) -> builtins.str: ...
+ @property
+ def messages_count(self) -> builtins.int: ...
+ @property
+ def partitions_count(self) -> builtins.int: ...
diff --git a/foreign/python/pyproject.toml b/foreign/python/pyproject.toml
index 92d0affb..213bf3ce 100644
--- a/foreign/python/pyproject.toml
+++ b/foreign/python/pyproject.toml
@@ -5,12 +5,13 @@ build-backend = "maturin"
[project]
name = "iggy_py"
requires-python = ">=3.7"
-version = "0.4.0"
+version = "0.5.0"
description = "Apache Iggy is the persistent message streaming platform written in Rust, supporting QUIC, TCP and HTTP transport protocols, capable of processing millions of messages per second."
readme = "README.md"
license = { file = "LICENSE" }
authors = [
{ name = "Dario Lencina Talarico", email = "darioalessandrolencina@gmail.com" },
+ { name = "Albin Skott", email = "albin@mattsson.io" },
]
keywords = ["streaming", "messaging", "pubsub", "iggy", "rust", "performance"]
classifiers = [
diff --git a/foreign/python/src/client.rs b/foreign/python/src/client.rs
index 41410a1c..0b444307 100644
--- a/foreign/python/src/client.rs
+++ b/foreign/python/src/client.rs
@@ -24,15 +24,18 @@ use iggy::prelude::{
PollingStrategy as RustPollingStrategy, *,
};
use pyo3::prelude::*;
-use pyo3::types::PyList;
+use pyo3::types::{PyDelta, PyList};
use pyo3_async_runtimes::tokio::future_into_py;
+use pyo3_stub_gen::define_stub_info_gatherer;
use pyo3_stub_gen::derive::{gen_stub_pyclass, gen_stub_pymethods};
-use pyo3_stub_gen::{define_stub_info_gatherer, impl_stub_type};
+use crate::consumer::{py_delta_to_iggy_duration, AutoCommit, IggyConsumer};
+use crate::identifier::PyIdentifier;
use crate::receive_message::{PollingStrategy, ReceiveMessage};
use crate::send_message::SendMessage;
use crate::stream::StreamDetails;
use crate::topic::TopicDetails;
+use tokio::sync::Mutex;
/// A Python class representing the Iggy client.
/// It wraps the RustIggyClient and provides asynchronous functionality
@@ -43,24 +46,6 @@ pub struct IggyClient {
inner: Arc<RustIggyClient>,
}
-#[derive(FromPyObject)]
-enum PyIdentifier {
- #[pyo3(transparent, annotation = "str")]
- String(String),
- #[pyo3(transparent, annotation = "int")]
- Int(u32),
-}
-impl_stub_type!(PyIdentifier = String | isize);
-
-impl From<PyIdentifier> for Identifier {
- fn from(py_identifier: PyIdentifier) -> Self {
- match py_identifier {
- PyIdentifier::String(s) => Identifier::from_str(&s).unwrap(),
- PyIdentifier::Int(i) => Identifier::numeric(i).unwrap(),
- }
- }
-}
-
#[gen_stub_pymethods]
#[pymethods]
impl IggyClient {
@@ -106,9 +91,10 @@ impl IggyClient {
) -> PyResult<Bound<'a, PyAny>> {
let inner = self.inner.clone();
future_into_py(py, async move {
- inner.login_user(&username, &password).await.map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ inner
+ .login_user(&username, &password)
+ .await
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(())
})
}
@@ -119,9 +105,10 @@ impl IggyClient {
fn connect<'a>(&self, py: Python<'a>) -> PyResult<Bound<'a, PyAny>> {
let inner = self.inner.clone();
future_into_py(py, async move {
- inner.connect().await.map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ inner
+ .connect()
+ .await
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(())
})
}
@@ -138,9 +125,10 @@ impl IggyClient {
) -> PyResult<Bound<'a, PyAny>> {
let inner = self.inner.clone();
future_into_py(py, async move {
- inner.create_stream(&name, stream_id).await.map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ inner
+ .create_stream(&name, stream_id)
+ .await
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(())
})
}
@@ -157,9 +145,10 @@ impl IggyClient {
let inner = self.inner.clone();
future_into_py(py, async move {
- let stream = inner.get_stream(&stream_id).await.map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ let stream = inner
+ .get_stream(&stream_id)
+ .await
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(stream.map(StreamDetails::from))
})
}
@@ -182,9 +171,8 @@ impl IggyClient {
replication_factor: Option<u8>,
) -> PyResult<Bound<'a, PyAny>> {
let compression_algorithm = match compression_algorithm {
- Some(algo) => CompressionAlgorithm::from_str(&algo).map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?,
+ Some(algo) => CompressionAlgorithm::from_str(&algo)
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?,
None => CompressionAlgorithm::default(),
};
@@ -204,9 +192,7 @@ impl IggyClient {
MaxTopicSize::ServerDefault,
)
.await
- .map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(())
})
}
@@ -225,9 +211,10 @@ impl IggyClient {
let inner = self.inner.clone();
future_into_py(py, async move {
- let topic = inner.get_topic(&stream_id, &topic_id).await.map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ let topic = inner
+ .get_topic(&stream_id, &topic_id)
+ .await
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(topic.map(TopicDetails::from))
})
}
@@ -261,9 +248,7 @@ impl IggyClient {
inner
.send_messages(&stream, &topic, &partitioning, messages.as_mut())
.await
- .map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
Ok(())
})
}
@@ -285,7 +270,7 @@ impl IggyClient {
let consumer = RustConsumer::default();
let stream = Identifier::from(stream);
let topic = Identifier::from(topic);
- let strategy: RustPollingStrategy = (*polling_strategy).into();
+ let strategy: RustPollingStrategy = polling_strategy.into();
let inner = self.inner.clone();
@@ -301,9 +286,7 @@ impl IggyClient {
auto_commit,
)
.await
- .map_err(|e| {
- PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}"))
- })?;
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?;
let messages = polled_messages
.messages
.into_iter()
@@ -312,6 +295,105 @@ impl IggyClient {
Ok(messages)
})
}
+
+ /// Creates a new consumer group consumer.
+ ///
+ /// Returns the consumer or a PyRuntimeError on failure.
+ #[allow(clippy::too_many_arguments)]
+ #[pyo3(signature = (
+ name,
+ stream,
+ topic,
+ partition_id=None,
+ polling_strategy=None,
+ batch_length=None,
+ auto_commit=None,
+ create_consumer_group_if_not_exists=true,
+ auto_join_consumer_group=true,
+ poll_interval=None,
+ polling_retry_interval=None,
+ init_retries=None,
+ init_retry_interval=None,
+ allow_replay=false,
+ ))]
+ fn consumer_group<'a>(
+ &self,
+ name: &str,
+ stream: &str,
+ topic: &str,
+ partition_id: Option<u32>,
+ polling_strategy: Option<&PollingStrategy>,
+ batch_length: Option<u32>,
+ auto_commit: Option<&AutoCommit>,
+ create_consumer_group_if_not_exists: bool,
+ auto_join_consumer_group: bool,
+ poll_interval: Option<Py<PyDelta>>,
+ polling_retry_interval: Option<Py<PyDelta>>,
+ init_retries: Option<u32>,
+ init_retry_interval: Option<Py<PyDelta>>,
+ allow_replay: bool,
+ ) -> PyResult<IggyConsumer> {
+ let mut builder = self
+ .inner
+ .consumer_group(name, stream, topic)
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e:?}")))?
+ .without_encryptor()
+ .partition(partition_id);
+
+ if create_consumer_group_if_not_exists {
+ builder = builder.create_consumer_group_if_not_exists()
... 1086 lines suppressed ...