Skip to content

Commit 063122c

Browse files
authored
Bump kv-cache-manager to v0.4.0-rc2 (#261)
* Bump kv-cache-manager to v0.4.0-rc1 Signed-off-by: Pierangelo Di Pilato <[email protected]> * rc2 Signed-off-by: Pierangelo Di Pilato <[email protected]> * Install python3-dev and pkg-config Extract template wrapper from kv-cache-manager Signed-off-by: Pierangelo Di Pilato <[email protected]> * Build image in CI checks Signed-off-by: Pierangelo Di Pilato <[email protected]> * Move setup to Makefile Signed-off-by: Pierangelo Di Pilato <[email protected]> --------- Signed-off-by: Pierangelo Di Pilato <[email protected]>
1 parent cecbf25 commit 063122c

File tree

10 files changed

+148
-63
lines changed

10 files changed

+148
-63
lines changed

.github/workflows/ci-pr-checks.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ jobs:
2121
go-version-file: ./go.mod
2222
cache-dependency-path: ./go.sum
2323

24-
- name: Install libzmq dependencies (kvcache/kvevents)
24+
- name: Install libzmq and Python dependencies (kvcache/kvevents)
2525
run: |
2626
sudo apt-get update
27-
make download-zmq
28-
29-
- name: Set PKG_CONFIG_PATH
30-
run: echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> $GITHUB_ENV
27+
sudo apt-get install -y pkg-config python3-dev python3-pip
28+
make install-dependencies
29+
pip3 install transformers --break-system-packages
3130
3231
- name: Run lint checks
33-
uses: golangci/golangci-lint-action@v8
34-
with:
35-
version: 'v2.4.0'
36-
args: "--config=./.golangci.yml"
32+
run: |
33+
make lint
34+
35+
- name: Build Container image
36+
run: |
37+
make image-build SIM_TAG=pr-check
3738
3839
- name: Run go test
39-
shell: bash
40+
shell: bash
4041
run: |
41-
echo "Running tests with Ginkgo..."
4242
make test

Dockerfile

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ ARG TARGETARCH
66
# Install build tools
77
# The builder is based on UBI8, so we need epel-release-8.
88
RUN dnf install -y 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm' && \
9-
dnf install -y gcc-c++ libstdc++ libstdc++-devel clang zeromq-devel pkgconfig && \
9+
dnf install -y gcc-c++ libstdc++ libstdc++-devel clang zeromq-devel pkgconfig python3.12-devel python3.12-pip git && \
1010
dnf clean all
11+
# python3.12-devel needed for CGO compilation (Python headers and python3.12-config for linker flags)
1112

1213
WORKDIR /workspace
1314
# Copy the Go Modules manifests
@@ -28,6 +29,15 @@ ARG TOKENIZER_VERSION=v1.22.1
2829
RUN curl -L https://github.com/daulet/tokenizers/releases/download/${TOKENIZER_VERSION}/libtokenizers.${TARGETOS}-${TARGETARCH}.tar.gz | tar -xz -C lib
2930
RUN ranlib lib/*.a
3031

32+
# Copy Python wrapper and requirements from kv-cache-manager dependency
33+
# Extract version dynamically and copy to a known location
34+
RUN KV_CACHE_MGR_VERSION=$(go list -m -f '{{.Version}}' github.com/llm-d/llm-d-kv-cache-manager) && \
35+
mkdir -p /workspace/kv-cache-manager-wrapper && \
36+
cp /go/pkg/mod/github.com/llm-d/llm-d-kv-cache-manager@${KV_CACHE_MGR_VERSION}/pkg/preprocessing/chat_completions/render_jinja_template_wrapper.py \
37+
/workspace/kv-cache-manager-wrapper/ && \
38+
cp /go/pkg/mod/github.com/llm-d/llm-d-kv-cache-manager@${KV_CACHE_MGR_VERSION}/pkg/preprocessing/chat_completions/requirements.txt \
39+
/workspace/kv-cache-manager-wrapper/
40+
3141
# Build
3242
# the GOARCH has not a default value to allow the binary be built according to the host where the command
3343
# was called. For example, if we call make image-build in a local env which has the Apple Silicon M1 SO
@@ -36,22 +46,49 @@ RUN ranlib lib/*.a
3646
ENV CGO_ENABLED=1
3747
ENV GOOS=${TARGETOS:-linux}
3848
ENV GOARCH=${TARGETARCH}
39-
RUN go build -a -o bin/llm-d-inference-sim -ldflags="-extldflags '-L$(pwd)/lib'" cmd/cmd.go
49+
ENV PYTHON=python3.12
50+
ENV PYTHONPATH=/usr/lib64/python3.12/site-packages:/usr/lib/python3.12/site-packages
51+
52+
RUN export CGO_CFLAGS="$(python3.12-config --cflags) -I/workspace/lib" && \
53+
export CGO_LDFLAGS="$(python3.12-config --ldflags --embed) -L/workspace/lib -ltokenizers -ldl -lm" && \
54+
go build -a -o bin/llm-d-inference-sim -ldflags="-extldflags '-L$(pwd)/lib'" cmd/cmd.go
4055

56+
# Runtime stage
4157
# Use ubi9 as a minimal base image to package the manager binary
4258
# Refer to https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5 for more details
4359
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
4460

4561
WORKDIR /
4662

47-
# Install zeromq runtime library needed by the manager.
63+
# Install zeromq runtime library and Python runtime needed by the manager.
4864
# The final image is UBI9, so we need epel-release-9.
65+
# Using microdnf for minimal image size
4966
USER root
50-
RUN microdnf install -y dnf && \
51-
dnf install -y 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' && \
52-
dnf install -y zeromq && \
53-
dnf clean all && \
54-
rm -rf /var/cache/dnf /var/lib/dnf
67+
RUN curl -L -o /tmp/epel-release.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
68+
rpm -i /tmp/epel-release.rpm && \
69+
rm /tmp/epel-release.rpm && \
70+
microdnf install -y --setopt=install_weak_deps=0 zeromq python3.12 python3.12-libs python3.12-pip && \
71+
microdnf clean all && \
72+
rm -rf /var/cache/yum /var/lib/yum && \
73+
ln -sf /usr/bin/python3.12 /usr/bin/python3 && \
74+
ln -sf /usr/bin/python3.12 /usr/bin/python
75+
76+
# Install wrapper as a module in site-packages
77+
RUN mkdir -p /usr/local/lib/python3.12/site-packages/
78+
COPY --from=builder /workspace/kv-cache-manager-wrapper/render_jinja_template_wrapper.py /usr/local/lib/python3.12/site-packages/
79+
80+
# Python deps (no cache, single target) – filter out torch
81+
ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
82+
COPY --from=builder /workspace/kv-cache-manager-wrapper/requirements.txt /tmp/requirements.txt
83+
RUN sed '/^torch\b/d' /tmp/requirements.txt > /tmp/requirements.notorch.txt && \
84+
python3.12 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
85+
python3.12 -m pip install --no-cache-dir --target /usr/local/lib/python3.12/site-packages -r /tmp/requirements.notorch.txt && \
86+
rm /tmp/requirements.txt /tmp/requirements.notorch.txt && \
87+
rm -rf /root/.cache/pip
88+
89+
# Python env
90+
ENV PYTHONPATH="/usr/local/lib/python3.12/site-packages:/usr/lib/python3.12/site-packages"
91+
ENV PYTHON=python3.12
5592

5693
COPY --from=builder /workspace/bin/llm-d-inference-sim /app/llm-d-inference-sim
5794

Makefile

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ SRC = $(shell find . -type f -name '*.go')
5353
help: ## Print help
5454
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
5555

56+
PYTHON_INCLUDE := $(shell python3 -c "import sysconfig; print(sysconfig.get_path('include'))")
57+
CGO_CFLAGS := $(shell python3-config --cflags --embed)
58+
CGO_LDFLAGS := $(shell python3-config --ldflags --embed)
59+
60+
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
61+
62+
GOMODCACHE := $(shell go env GOMODCACHE)
63+
KV_CACHE_MGR_VERSION := $(shell go list -m -f '{{.Version}}' github.com/llm-d/llm-d-kv-cache-manager)
64+
KV_CACHE_MGR_PATH := $(GOMODCACHE)/github.com/llm-d/llm-d-kv-cache-manager@$(KV_CACHE_MGR_VERSION)/pkg/preprocessing/chat_completions
65+
export PYTHONPATH := $(KV_CACHE_MGR_PATH):$(PYTHONPATH)
66+
67+
# Export them for all targets (optional)
68+
export CGO_ENABLED=1
69+
export CGO_CFLAGS
70+
export CGO_LDFLAGS
71+
export CPATH := $(PYTHON_INCLUDE):$(CPATH)
72+
5673
GO_LDFLAGS := -extldflags '-L$(shell pwd)/lib $(LDFLAGS)'
5774
CGO_ENABLED=1
5875
TOKENIZER_LIB = lib/libtokenizers.a
@@ -82,7 +99,7 @@ format: ## Format Go source files
8299
@gofmt -l -w $(SRC)
83100

84101
.PHONY: test
85-
test: $(GINKGO) download-tokenizer download-zmq ## Run tests
102+
test: $(GINKGO) install-dependencies ## Run tests
86103
@printf "\033[33;1m==== Running tests ====\033[0m\n"
87104
ifdef GINKGO_FOCUS
88105
CGO_ENABLED=1 ginkgo -ldflags="$(GO_LDFLAGS)" -v -r -- -ginkgo.v -ginkgo.focus="$(GINKGO_FOCUS)"
@@ -103,7 +120,7 @@ lint: $(GOLANGCI_LINT) ## Run lint
103120
##@ Build
104121

105122
.PHONY: build
106-
build: check-go download-tokenizer download-zmq
123+
build: check-go install-dependencies
107124
@printf "\033[33;1m==== Building ====\033[0m\n"
108125
go build -ldflags="$(GO_LDFLAGS)" -o $(LOCALBIN)/$(PROJECT_NAME) cmd/$(PROJECT_NAME)/main.go
109126

@@ -217,32 +234,41 @@ install-hooks: ## Install git hooks
217234

218235
##@ ZMQ Setup
219236

220-
.PHONY: download-zmq
221-
download-zmq: ## Install ZMQ dependencies based on OS/ARCH
222-
@echo "⏳ Checking if ZMQ is already installed..."
223-
@if pkg-config --exists libzmq; then \
224-
echo "✅ ZMQ is already installed."; \
225-
else \
226-
echo "⏳ Installing ZMQ dependencies..."; \
227-
if [ "$(TARGETOS)" = "linux" ]; then \
228-
if command -v apt >/dev/null 2>&1; then \
229-
sudo apt update && sudo apt install -y libzmq3-dev; \
230-
elif command -v dnf >/dev/null 2>&1; then \
231-
sudo dnf install -y zeromq-devel; \
237+
.PHONY: install-dependencies
238+
install-dependencies: download-tokenizer ## Install development dependencies based on OS/ARCH
239+
@echo "Checking and installing development dependencies..."
240+
@if [ "$(TARGETOS)" = "linux" ]; then \
241+
if [ -x "$$(command -v apt)" ]; then \
242+
if ! dpkg -s libzmq3-dev >/dev/null 2>&1 || ! dpkg -s g++ >/dev/null 2>&1; then \
243+
echo "Installing dependencies with apt..."; \
244+
sudo apt-get update && sudo apt-get install -y libzmq3-dev g++; \
232245
else \
233-
echo -e "⚠️ Unsupported Linux package manager. Follow installation guides: https://github.com/zeromq/libzmq#installation-of-binary-packages-\n"; \
234-
exit 1; \
246+
echo "✅ ZMQ and g++ are already installed."; \
235247
fi; \
236-
elif [ "$(TARGETOS)" = "darwin" ]; then \
237-
if command -v brew >/dev/null 2>&1; then \
238-
brew install zeromq; \
248+
elif [ -x "$$(command -v dnf)" ]; then \
249+
if ! dnf -q list installed zeromq-devel >/dev/null 2>&1 || ! dnf -q list installed gcc-c++ >/dev/null 2>&1; then \
250+
echo "Installing dependencies with dnf..."; \
251+
sudo dnf install -y zeromq-devel gcc-c++; \
239252
else \
240-
echo "⚠️ Homebrew is not installed and is required to install zeromq. Install it from https://brew.sh/"; \
241-
exit 1; \
253+
echo "✅ ZMQ and gcc-c++ are already installed."; \
242254
fi; \
243255
else \
244-
echo "⚠️ Unsupported OS: $(TARGETOS). Install libzmq manually - see https://zeromq.org/download/"; \
256+
echo "Unsupported Linux package manager. Install libzmq and g++/gcc-c++ manually."; \
245257
exit 1; \
246258
fi; \
247-
echo "✅ ZMQ dependencies installed."; \
259+
elif [ "$(TARGETOS)" = "darwin" ]; then \
260+
if [ -x "$$(command -v brew)" ]; then \
261+
if ! brew list zeromq pkg-config >/dev/null 2>&1; then \
262+
echo "Installing dependencies with brew..."; \
263+
brew install zeromq pkg-config; \
264+
else \
265+
echo "✅ ZeroMQ and pkgconf are already installed."; \
266+
fi; \
267+
else \
268+
echo "Homebrew is not installed and is required to install zeromq. Install it from https://brew.sh/"; \
269+
exit 1; \
270+
fi; \
271+
else \
272+
echo "Unsupported OS: $(TARGETOS). Install development dependencies manually."; \
273+
exit 1; \
248274
fi

go.mod

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/buaazp/fasthttprouter v0.1.1
99
github.com/go-logr/logr v1.4.2
1010
github.com/google/uuid v1.6.0
11-
github.com/llm-d/llm-d-kv-cache-manager v0.3.0-rc1
11+
github.com/llm-d/llm-d-kv-cache-manager v0.4.0-rc2
1212
github.com/onsi/ginkgo/v2 v2.23.4
1313
github.com/onsi/gomega v1.37.0
1414
github.com/openai/openai-go/v3 v3.6.1
@@ -23,6 +23,12 @@ require (
2323
k8s.io/klog/v2 v2.130.1
2424
)
2525

26+
require (
27+
github.com/dgraph-io/ristretto/v2 v2.3.0 // indirect
28+
github.com/dustin/go-humanize v1.0.1 // indirect
29+
go.uber.org/multierr v1.11.0 // indirect
30+
)
31+
2632
require (
2733
github.com/andybalholm/brotli v1.1.1 // indirect
2834
github.com/beorn7/perks v1.0.1 // indirect
@@ -64,7 +70,7 @@ require (
6470
go.uber.org/automaxprocs v1.6.0 // indirect
6571
golang.org/x/net v0.38.0 // indirect
6672
golang.org/x/oauth2 v0.27.0 // indirect
67-
golang.org/x/sys v0.32.0 // indirect
73+
golang.org/x/sys v0.35.0 // indirect
6874
golang.org/x/term v0.30.0 // indirect
6975
golang.org/x/text v0.23.0 // indirect
7076
golang.org/x/time v0.9.0 // indirect
@@ -77,7 +83,7 @@ require (
7783
k8s.io/client-go v0.33.0 // indirect
7884
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
7985
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
80-
sigs.k8s.io/controller-runtime v0.21.0 // indirect
86+
sigs.k8s.io/controller-runtime v0.21.0
8187
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
8288
sigs.k8s.io/randfill v1.0.0 // indirect
8389
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect

go.sum

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
1919
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2020
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
2121
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22+
github.com/dgraph-io/ristretto/v2 v2.3.0 h1:qTQ38m7oIyd4GAed/QkUZyPFNMnvVWyazGXRwvOt5zk=
23+
github.com/dgraph-io/ristretto/v2 v2.3.0/go.mod h1:gpoRV3VzrEY1a9dWAYV6T1U7YzfgttXdd/ZzL1s9OZM=
24+
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38=
25+
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
2226
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
2327
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
28+
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
29+
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
2430
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
2531
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
2632
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
@@ -68,8 +74,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6874
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
6975
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
7076
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
71-
github.com/llm-d/llm-d-kv-cache-manager v0.3.0-rc1 h1:SDLiNrcreDcA9m9wfXAumFARDHHXpjOjHTzshTiTGxk=
72-
github.com/llm-d/llm-d-kv-cache-manager v0.3.0-rc1/go.mod h1:tN80/D0Faf6pE2ocwFgTNoCxKPsqdsa2XnjQUqOaZ8Q=
77+
github.com/llm-d/llm-d-kv-cache-manager v0.4.0-rc2 h1:l2Sm8W6SRg4TAme4RsndwZ++5+4aQvDI4vnf8TKrhww=
78+
github.com/llm-d/llm-d-kv-cache-manager v0.4.0-rc2/go.mod h1:ZlK7MCuz5D/weLeHyNKEmVF/eJZDyYn3XyRowTihq9o=
7379
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
7480
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
7581
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
@@ -153,6 +159,8 @@ go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
153159
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
154160
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
155161
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
162+
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
163+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
156164
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
157165
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
158166
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -174,8 +182,8 @@ golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
174182
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
175183
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
176184
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
177-
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
178-
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
185+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
186+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
179187
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
180188
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
181189
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

pkg/kv-cache/block_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ func (bc *blockCache) startRequest(requestID string, blocks []uint64) (int, erro
177177

178178
delete(bc.unusedBlocks, oldestUnusedHash)
179179
common.WriteToChannel(bc.eventChan,
180-
EventData{action: eventActionRemove, hashValues: []uint64{oldestUnusedHash}},
180+
EventData{action: eventActionRemove, hashValues: []any{oldestUnusedHash}},
181181
bc.logger, "block cache eventChan")
182182
}
183183

184184
// Add the new block
185185
bc.usedBlocks[block] = 1
186186
common.WriteToChannel(bc.eventChan,
187-
EventData{action: eventActionStore, hashValues: []uint64{block}},
187+
EventData{action: eventActionStore, hashValues: []any{block}},
188188
bc.logger, "block cache eventChan")
189189
}
190190

pkg/kv-cache/kv_cache_sender.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const (
3737

3838
type EventData struct {
3939
action EventAction
40-
hashValues []uint64
40+
hashValues []any
4141
}
4242

4343
type KVEventSender struct {

pkg/kv-cache/kv_cache_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ var _ = Describe("KV cache", Ordered, func() {
330330
wg.Wait() // wait for goroutine to exit
331331
}()
332332

333-
expectedRemovedBlocks := []uint64{2, 4}
334-
expectedStoredBlocks := []uint64{1, 2, 3, 4, 5, 6}
333+
expectedRemovedBlocks := []any{uint64(2), uint64(4)}
334+
expectedStoredBlocks := []any{uint64(1), uint64(2), uint64(3), uint64(4), uint64(5), uint64(6)}
335335

336336
go func() {
337337
// Make sure that the subscriber listens before the events are published
@@ -371,8 +371,8 @@ var _ = Describe("KV cache", Ordered, func() {
371371
Expect(alreadyInCache).To(Equal(0))
372372
}()
373373

374-
removedBlocks := make([]uint64, 0)
375-
storedBlocks := make([]uint64, 0)
374+
removedBlocks := make([]any, 0)
375+
storedBlocks := make([]any, 0)
376376
count := uint64(1)
377377
for {
378378
parts, err := sub.RecvMessageBytes(0)

pkg/kv-cache/kv_test_helper.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121

2222
"github.com/llm-d/llm-d-kv-cache-manager/pkg/kvcache/kvevents"
2323
"github.com/onsi/ginkgo/v2"
24-
gomega "github.com/onsi/gomega"
24+
"github.com/onsi/gomega"
2525
"github.com/vmihailenco/msgpack/v5"
2626
)
2727

28-
func ParseKVEvent(parts [][]byte, expectedTopic string, expectedSeq uint64) ([]uint64, []uint64, bool) {
28+
func ParseKVEvent(parts [][]byte, expectedTopic string, expectedSeq uint64) ([]any, []any, bool) {
2929
// The message should be [topic, seq, payload]
3030
gomega.Expect(parts).To(gomega.HaveLen(3))
3131

@@ -34,8 +34,8 @@ func ParseKVEvent(parts [][]byte, expectedTopic string, expectedSeq uint64) ([]u
3434
seq := binary.BigEndian.Uint64(parts[1])
3535
gomega.Expect(seq).To(gomega.Equal(expectedSeq))
3636

37-
removed := make([]uint64, 0)
38-
stored := make([]uint64, 0)
37+
removed := make([]any, 0)
38+
stored := make([]any, 0)
3939
allCleared := false
4040

4141
var eventBatch kvevents.EventBatch

0 commit comments

Comments
 (0)