valkey-glide-rb 0.9.0.pre.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +69 -0
- data/.rubocop_todo.yml +22 -0
- data/AGENTS.md +224 -0
- data/CLAUDE.md +130 -0
- data/CONTRIBUTING.md +115 -0
- data/DEVELOPER.md +453 -0
- data/README.md +268 -0
- data/Rakefile +126 -0
- data/examples/README.md +55 -0
- data/examples/cluster.rb +24 -0
- data/examples/opentelemetry.rb +50 -0
- data/examples/pipelining.rb +29 -0
- data/examples/standalone.rb +22 -0
- data/examples/statistics.rb +24 -0
- data/lib/valkey/bindings.rb +319 -0
- data/lib/valkey/commands/bitmap_commands.rb +86 -0
- data/lib/valkey/commands/cluster_commands.rb +259 -0
- data/lib/valkey/commands/connection_commands.rb +318 -0
- data/lib/valkey/commands/function_commands.rb +255 -0
- data/lib/valkey/commands/generic_commands.rb +525 -0
- data/lib/valkey/commands/geo_commands.rb +87 -0
- data/lib/valkey/commands/hash_commands.rb +592 -0
- data/lib/valkey/commands/hyper_log_log_commands.rb +51 -0
- data/lib/valkey/commands/json_commands.rb +389 -0
- data/lib/valkey/commands/list_commands.rb +348 -0
- data/lib/valkey/commands/module_commands.rb +125 -0
- data/lib/valkey/commands/pubsub_commands.rb +237 -0
- data/lib/valkey/commands/scripting_commands.rb +287 -0
- data/lib/valkey/commands/server_commands.rb +961 -0
- data/lib/valkey/commands/set_commands.rb +220 -0
- data/lib/valkey/commands/sorted_set_commands.rb +971 -0
- data/lib/valkey/commands/stream_commands.rb +636 -0
- data/lib/valkey/commands/string_commands.rb +371 -0
- data/lib/valkey/commands/transaction_commands.rb +175 -0
- data/lib/valkey/commands/vector_search_commands.rb +271 -0
- data/lib/valkey/commands.rb +68 -0
- data/lib/valkey/errors.rb +41 -0
- data/lib/valkey/native/aarch64-unknown-linux-gnu/libglide_ffi.so +0 -0
- data/lib/valkey/native/x86_64-unknown-linux-gnu/libglide_ffi.so +0 -0
- data/lib/valkey/opentelemetry.rb +207 -0
- data/lib/valkey/pipeline.rb +20 -0
- data/lib/valkey/pubsub_callback.rb +10 -0
- data/lib/valkey/request_error_type.rb +10 -0
- data/lib/valkey/request_type.rb +436 -0
- data/lib/valkey/response_type.rb +20 -0
- data/lib/valkey/utils.rb +267 -0
- data/lib/valkey/version.rb +5 -0
- data/lib/valkey.rb +617 -0
- metadata +107 -0
data/DEVELOPER.md
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# Developer Guide
|
|
2
|
+
|
|
3
|
+
This document describes how to set up your development environment to build and test the Valkey GLIDE Ruby client (`valkey-rb`).
|
|
4
|
+
|
|
5
|
+
## Development Overview
|
|
6
|
+
|
|
7
|
+
The Valkey GLIDE Ruby client consists of **Ruby** application code and a **Rust FFI** native library. Ruby talks to [glide-core](https://github.com/valkey-io/valkey-glide/tree/main/glide-core) through the [`glide-ffi`](https://github.com/valkey-io/valkey-glide/tree/main/ffi) crate, exposed as `libglide_ffi.so` (Linux) or `libglide_ffi.dylib` (macOS) via the [`ffi`](https://github.com/ffi/ffi) gem.
|
|
8
|
+
|
|
9
|
+
| Layer | Technology | Location |
|
|
10
|
+
|-------|------------|----------|
|
|
11
|
+
| Application API | Ruby | `lib/valkey.rb`, `lib/valkey/commands/` |
|
|
12
|
+
| FFI bindings | Ruby FFI | `lib/valkey/bindings.rb` |
|
|
13
|
+
| Native bridge | Rust `cdylib` | `lib/valkey/libglide_ffi.{so,dylib}` |
|
|
14
|
+
| Core driver | Rust `glide-core` | Built from [valkey-glide](https://github.com/valkey-io/valkey-glide) |
|
|
15
|
+
|
|
16
|
+
This architecture matches the **Go** and **Python sync** clients (C FFI), not the Java (JNI) or Python async (PyO3 + UDS) stacks.
|
|
17
|
+
|
|
18
|
+
## Project Structure
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
valkey-glide-ruby/
|
|
22
|
+
├── lib/
|
|
23
|
+
│ ├── valkey.rb # Client, pipelining, response conversion
|
|
24
|
+
│ └── valkey/
|
|
25
|
+
│ ├── bindings.rb # FFI definitions
|
|
26
|
+
│ ├── native/ # Platform-specific native libraries (in gem)
|
|
27
|
+
│ │ ├── x86_64-unknown-linux-gnu/
|
|
28
|
+
│ │ └── aarch64-unknown-linux-gnu/
|
|
29
|
+
│ ├── commands/ # Command modules per data type
|
|
30
|
+
│ ├── opentelemetry.rb # OTel init and sampling
|
|
31
|
+
│ ├── pipeline.rb # Pipeline helper
|
|
32
|
+
│ ├── request_type.rb # Command enum (maps to glide-core)
|
|
33
|
+
│ ├── response_type.rb # Response enum
|
|
34
|
+
│ └── errors.rb # Ruby exception types
|
|
35
|
+
├── valkey-glide/ # Git submodule (valkey-io/valkey-glide)
|
|
36
|
+
│ └── ffi/ # Rust FFI crate (build target)
|
|
37
|
+
├── test/
|
|
38
|
+
│ ├── valkey/ # Standalone server tests
|
|
39
|
+
│ ├── cluster/ # Cluster tests
|
|
40
|
+
│ ├── lint/ # Shared lint suites
|
|
41
|
+
│ └── support/helper/ # Test helpers (client, cluster, SSL)
|
|
42
|
+
├── bin/
|
|
43
|
+
│ ├── setup # bundle install
|
|
44
|
+
│ └── console # IRB with gem loaded
|
|
45
|
+
├── .github/workflows/
|
|
46
|
+
│ ├── CI.yml # RuboCop + test matrix
|
|
47
|
+
│ └── cd.yml # Build and publish gem
|
|
48
|
+
├── valkey.gemspec
|
|
49
|
+
├── Gemfile
|
|
50
|
+
└── Rakefile # test:valkey, test:cluster, native:build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Prerequisites
|
|
54
|
+
|
|
55
|
+
### Software Dependencies
|
|
56
|
+
|
|
57
|
+
- **Ruby** 2.6+ (3.x recommended for development)
|
|
58
|
+
- **Bundler**
|
|
59
|
+
- **git**
|
|
60
|
+
- **Valkey** or Redis OSS (for integration tests)
|
|
61
|
+
- **Docker** (optional; matches CI setup)
|
|
62
|
+
|
|
63
|
+
To **build** the native FFI library from source:
|
|
64
|
+
|
|
65
|
+
- **Rust** (`rustup`)
|
|
66
|
+
- **GCC** / Xcode command-line tools
|
|
67
|
+
- **cmake**, **pkg-config**, **openssl** / **libssl-dev**
|
|
68
|
+
- Clone of [valkey-glide](https://github.com/valkey-io/valkey-glide) at a compatible release tag
|
|
69
|
+
|
|
70
|
+
### Valkey Installation
|
|
71
|
+
|
|
72
|
+
See the [Valkey installation guide](https://valkey.io/topics/installation/) to install `valkey-server` and `valkey-cli`.
|
|
73
|
+
|
|
74
|
+
**Ubuntu / Debian (standalone testing):**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
sudo apt update -y
|
|
78
|
+
sudo apt install -y ruby-full build-essential
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**macOS:**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
brew install ruby
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Clone and Local Setup
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone --recurse-submodules https://github.com/valkey-io/valkey-glide-ruby.git
|
|
91
|
+
cd valkey-glide-ruby
|
|
92
|
+
bin/setup # runs bundle install
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If you've already cloned without submodules:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git submodule update --init --recursive
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Load the gem from the checkout without installing:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export RUBYOPT="-I$(pwd)/lib"
|
|
105
|
+
bundle exec ruby -r valkey -e 'puts Valkey::VERSION'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Interactive console:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bundle exec bin/console
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Build Native FFI from Source
|
|
115
|
+
|
|
116
|
+
This repository includes [valkey-glide](https://github.com/valkey-io/valkey-glide) as a Git submodule. Rake tasks are provided to build the native FFI library.
|
|
117
|
+
|
|
118
|
+
### Prerequisites for Building
|
|
119
|
+
|
|
120
|
+
- **Rust toolchain**: Install via [rustup](https://rustup.rs/)
|
|
121
|
+
- **Protobuf compiler**: `protoc` (required for glide-core)
|
|
122
|
+
|
|
123
|
+
### Build with Rake
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Build the native FFI library (release mode)
|
|
127
|
+
rake native:build
|
|
128
|
+
|
|
129
|
+
# This will:
|
|
130
|
+
# 1. Initialize the valkey-glide submodule if needed
|
|
131
|
+
# 2. Build the Rust FFI library in release mode
|
|
132
|
+
# 3. Output: valkey-glide/ffi/target/release/libglide_ffi.{so,dylib}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Available Rake Tasks
|
|
136
|
+
|
|
137
|
+
| Task | Description |
|
|
138
|
+
|------|-------------|
|
|
139
|
+
| `rake native:build` | Build the native FFI library (release mode) |
|
|
140
|
+
| `rake native:build_debug` | Build the native FFI library (debug mode) |
|
|
141
|
+
| `rake native:clean` | Clean native build artifacts |
|
|
142
|
+
| `rake native:submodule` | Initialize/update the valkey-glide submodule |
|
|
143
|
+
| `rake native:package` | Copy built library to `lib/valkey/native/{platform}/` for gem packaging |
|
|
144
|
+
|
|
145
|
+
### Verify the Build
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
bundle exec ruby -e 'require "valkey"; c = Valkey.new; puts c.ping; c.close'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Updating the Submodule
|
|
152
|
+
|
|
153
|
+
To update to a newer version of valkey-glide:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
cd valkey-glide
|
|
157
|
+
git fetch origin
|
|
158
|
+
git checkout v2.4.0 # or desired tag/branch
|
|
159
|
+
cd ..
|
|
160
|
+
git add valkey-glide
|
|
161
|
+
git commit -m "Update valkey-glide submodule to v2.4.0"
|
|
162
|
+
|
|
163
|
+
# Rebuild the native library
|
|
164
|
+
rake native:build
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Rust Linters (when changing FFI)
|
|
168
|
+
|
|
169
|
+
From `valkey-glide/ffi/`:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
rustup component add clippy rustfmt
|
|
173
|
+
cargo clippy --all-features --all-targets -- -D warnings
|
|
174
|
+
cargo fmt --manifest-path ./Cargo.toml --all
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
See [ffi/README.md](https://github.com/valkey-io/valkey-glide/blob/main/ffi/README.md) in valkey-glide for C header generation (`cbindgen`) if needed.
|
|
178
|
+
|
|
179
|
+
## Running Tests
|
|
180
|
+
|
|
181
|
+
Tests use **Minitest**. The suite is split into standalone (`test/valkey/`) and cluster (`test/cluster/`) groups.
|
|
182
|
+
|
|
183
|
+
### Start Valkey (standalone)
|
|
184
|
+
|
|
185
|
+
Default test configuration (see `test/test_helper.rb`):
|
|
186
|
+
|
|
187
|
+
| Variable | Default | Purpose |
|
|
188
|
+
|----------|---------|---------|
|
|
189
|
+
| `VALKEY_PORT` | `6379` | Plain TCP |
|
|
190
|
+
| `VALKEY_SSL_PORT` | `6380` | TLS (optional) |
|
|
191
|
+
| `TIMEOUT` | `5.0` | Client timeout |
|
|
192
|
+
| DB | `15` | Test database |
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Example: Docker standalone (matches CI)
|
|
196
|
+
docker run -d --name valkey-test -p 6379:6379 valkey/valkey:8 \
|
|
197
|
+
valkey-server --enable-module-command yes
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Start Valkey Cluster
|
|
201
|
+
|
|
202
|
+
Cluster tests expect six nodes on `127.0.0.1:7000`–`7005`. CI uses `grokzen/redis-cluster:7.0.15`.
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
docker run -d --name redis-cluster -p 7000-7005:7000-7005 grokzen/redis-cluster:7.0.15
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Run Tests
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# All default (standalone) tests
|
|
212
|
+
bundle exec rake test
|
|
213
|
+
# or
|
|
214
|
+
bundle exec rake test:valkey
|
|
215
|
+
|
|
216
|
+
# Cluster tests only
|
|
217
|
+
bundle exec rake test:cluster
|
|
218
|
+
|
|
219
|
+
# Verbose output (also enabled when CI=1)
|
|
220
|
+
CI=1 bundle exec rake test:valkey
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### SSL Tests
|
|
224
|
+
|
|
225
|
+
Generate test certificates:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
ruby test/fixtures/ssl/generate_certs.rb
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Start TLS Valkey on port 6380 (see `.github/workflows/CI.yml` for a full Docker example).
|
|
232
|
+
|
|
233
|
+
### Module Tests (JSON, Bloom, Search)
|
|
234
|
+
|
|
235
|
+
CI copies prebuilt modules into `test/fixtures/`:
|
|
236
|
+
|
|
237
|
+
- `redisjson.so` — JSON commands
|
|
238
|
+
- `redisbloom.so` — Bloom filters
|
|
239
|
+
- `redisearch.so` — Vector / FT commands
|
|
240
|
+
|
|
241
|
+
Load modules when starting Valkey if you run module-specific tests locally.
|
|
242
|
+
|
|
243
|
+
### Environment Overrides
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
VALKEY_PORT=6379 TIMEOUT=10 bundle exec rake test:valkey
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Linters
|
|
250
|
+
|
|
251
|
+
### RuboCop
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
bundle exec rubocop
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
CI runs RuboCop on every push and pull request (see `.github/workflows/CI.yml`).
|
|
258
|
+
|
|
259
|
+
Auto-correct safe offenses:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
bundle exec rubocop -A
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Configuration: `.rubocop.yml`, `.rubocop_todo.yml`.
|
|
266
|
+
|
|
267
|
+
## Contributing New Valkey Commands
|
|
268
|
+
|
|
269
|
+
When adding a command, check whether it already exists in [glide-core](https://github.com/valkey-io/valkey-glide/blob/main/glide-core/src/request_type.rs) and [command_request.proto](https://github.com/valkey-io/valkey-glide/blob/main/glide-core/src/protobuf/command_request.proto). Other language clients (Python, Java, Go) are the reference for semantics and routing.
|
|
270
|
+
|
|
271
|
+
### Steps
|
|
272
|
+
|
|
273
|
+
1. **Add `RequestType` constant** in `lib/valkey/request_type.rb` if not present (must match glide-core enum).
|
|
274
|
+
2. **Implement the command** in the appropriate file under `lib/valkey/commands/` (e.g. `string_commands.rb`, `hash_commands.rb`).
|
|
275
|
+
3. **Use `send_command`** with the correct `RequestType` and argument list (all arguments converted to strings for FFI).
|
|
276
|
+
4. **Add standalone tests** in `test/valkey/<group>_commands_test.rb`.
|
|
277
|
+
5. **Add lint tests** in `test/lint/<group>_commands.rb` when the command should match redis-rb behavior.
|
|
278
|
+
6. **Update the wiki** [command implementation status](https://github.com/valkey-io/valkey-glide-ruby/wiki/The-implementation-status-of-the-Valkey-commands).
|
|
279
|
+
|
|
280
|
+
### Command module layout
|
|
281
|
+
|
|
282
|
+
| Module file | Valkey command families |
|
|
283
|
+
|-------------|-------------------------|
|
|
284
|
+
| `string_commands.rb` | Strings, counters |
|
|
285
|
+
| `hash_commands.rb` | Hashes |
|
|
286
|
+
| `list_commands.rb` | Lists |
|
|
287
|
+
| `set_commands.rb` | Sets |
|
|
288
|
+
| `sorted_set_commands.rb` | Sorted sets |
|
|
289
|
+
| `stream_commands.rb` | Streams |
|
|
290
|
+
| `bitmap_commands.rb` | Bitmaps |
|
|
291
|
+
| `hyper_log_log_commands.rb` | HyperLogLog |
|
|
292
|
+
| `geo_commands.rb` | Geo |
|
|
293
|
+
| `generic_commands.rb` | Keys, scan, type, … |
|
|
294
|
+
| `connection_commands.rb` | Connection, auth, select |
|
|
295
|
+
| `server_commands.rb` | Server, config, ACL |
|
|
296
|
+
| `scripting_commands.rb` | Lua scripting |
|
|
297
|
+
| `function_commands.rb` | Functions |
|
|
298
|
+
| `transaction_commands.rb` | MULTI, WATCH, … |
|
|
299
|
+
| `pubsub_commands.rb` | Pub/Sub |
|
|
300
|
+
| `cluster_commands.rb` | Cluster administration |
|
|
301
|
+
| `json_commands.rb` | RedisJSON / Valkey JSON |
|
|
302
|
+
| `vector_search_commands.rb` | RediSearch / FT |
|
|
303
|
+
| `module_commands.rb` | MODULE |
|
|
304
|
+
|
|
305
|
+
### Tests
|
|
306
|
+
|
|
307
|
+
- **Unit-style command tests**: `test/valkey/*_test.rb` — require a running server.
|
|
308
|
+
- **Lint suites**: `test/lint/*.rb` — included from valkey and cluster tests for API parity checks.
|
|
309
|
+
- **OpenTelemetry**: `test/valkey/test_opentelemetry.rb` — uses file exporter endpoints.
|
|
310
|
+
- **Statistics**: `test/valkey/test_statistics.rb`.
|
|
311
|
+
|
|
312
|
+
### Documentation in code
|
|
313
|
+
|
|
314
|
+
Follow existing YARD-style comments in command modules: link to [valkey.io/commands](https://valkey.io/commands/), document parameters and return types, note cluster vs standalone behavior.
|
|
315
|
+
|
|
316
|
+
## OpenTelemetry Development
|
|
317
|
+
|
|
318
|
+
OpenTelemetry is configured via `Valkey::OpenTelemetry.init` before client creation. Sampling is applied in Ruby (`should_sample?`); spans are created in FFI (`create_otel_span`, `create_batch_otel_span`).
|
|
319
|
+
|
|
320
|
+
File exporter example for local debugging:
|
|
321
|
+
|
|
322
|
+
```ruby
|
|
323
|
+
Valkey::OpenTelemetry.init(
|
|
324
|
+
traces: { endpoint: "file:///tmp/valkey_traces.json", sample_percentage: 100 },
|
|
325
|
+
metrics: { endpoint: "file:///tmp/valkey_metrics.json" }
|
|
326
|
+
)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Run OTel tests:
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
bundle exec ruby test/valkey/test_opentelemetry.rb
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## CI Overview
|
|
336
|
+
|
|
337
|
+
GitHub Actions (`.github/workflows/CI.yml`):
|
|
338
|
+
|
|
339
|
+
| Job | Matrix |
|
|
340
|
+
|-----|--------|
|
|
341
|
+
| `lint` | Ruby 3.3, RuboCop |
|
|
342
|
+
| `standalone` | Ruby 2.6–3.4 + JRuby; Valkey 7.2, 8, 8.1 |
|
|
343
|
+
| `cluster` | Ruby 2.6–3.4; grokzen/redis-cluster |
|
|
344
|
+
|
|
345
|
+
## Building the Gem Locally
|
|
346
|
+
|
|
347
|
+
The gem includes platform-specific native libraries. For development and testing, you can build a gem that works on your current platform.
|
|
348
|
+
|
|
349
|
+
### Quick Build (Current Platform Only)
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# 1. Build the native FFI library
|
|
353
|
+
rake native:build
|
|
354
|
+
|
|
355
|
+
# 2. Package it into lib/valkey/native/{platform}/
|
|
356
|
+
rake native:package
|
|
357
|
+
|
|
358
|
+
# 3. Build the gem
|
|
359
|
+
gem build valkey.gemspec
|
|
360
|
+
|
|
361
|
+
# 4. Install locally
|
|
362
|
+
gem install ./valkey-rb-*.gem
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### What `rake native:package` Does
|
|
366
|
+
|
|
367
|
+
This task copies the built native library to the correct platform-specific directory:
|
|
368
|
+
|
|
369
|
+
```text
|
|
370
|
+
lib/valkey/native/
|
|
371
|
+
├── x86_64-unknown-linux-gnu/
|
|
372
|
+
│ └── libglide_ffi.so
|
|
373
|
+
├── aarch64-unknown-linux-gnu/
|
|
374
|
+
│ └── libglide_ffi.so
|
|
375
|
+
├── x86_64-apple-darwin/
|
|
376
|
+
│ └── libglide_ffi.dylib
|
|
377
|
+
└── aarch64-apple-darwin/
|
|
378
|
+
└── libglide_ffi.dylib
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
The gem automatically detects your platform at runtime and loads the appropriate library.
|
|
382
|
+
|
|
383
|
+
### Building for Multiple Platforms
|
|
384
|
+
|
|
385
|
+
For distribution, you need native libraries for each target platform. The CD workflow builds these using GitHub Actions runners:
|
|
386
|
+
|
|
387
|
+
- **x86_64-unknown-linux-gnu** — Ubuntu x64 runner
|
|
388
|
+
- **aarch64-unknown-linux-gnu** — Ubuntu ARM64 runner
|
|
389
|
+
|
|
390
|
+
To build for a different platform, you must build on that platform (or use cross-compilation tools).
|
|
391
|
+
|
|
392
|
+
### Verify the Gem Contents
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Unpack and inspect
|
|
396
|
+
gem unpack valkey-rb-*.gem --target=gem-contents
|
|
397
|
+
find gem-contents -name "libglide_ffi.*"
|
|
398
|
+
|
|
399
|
+
# Or list files in the gem
|
|
400
|
+
gem spec valkey-rb-*.gem files
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Install and Test
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
# Install the locally built gem
|
|
407
|
+
gem install ./valkey-rb-*.gem
|
|
408
|
+
|
|
409
|
+
# Test it works (requires Valkey running)
|
|
410
|
+
ruby -e "require 'valkey'; c = Valkey.new; puts c.ping; c.close"
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Troubleshooting Gem Builds
|
|
414
|
+
|
|
415
|
+
| Problem | Solution |
|
|
416
|
+
|---------|----------|
|
|
417
|
+
| `LoadError: Could not find libglide_ffi` | Run `rake native:package` before `gem build` |
|
|
418
|
+
| Wrong platform library | Rebuild on the target platform; don't copy between OS/arch |
|
|
419
|
+
| Gem too large | Check that `valkey-glide/` submodule isn't included (gemspec excludes it) |
|
|
420
|
+
| Version mismatch | Update `lib/valkey/version.rb` before building |
|
|
421
|
+
|
|
422
|
+
## Troubleshooting
|
|
423
|
+
|
|
424
|
+
| Problem | Suggestion |
|
|
425
|
+
|---------|------------|
|
|
426
|
+
| `CannotConnectError` | Ensure Valkey is running on the configured host/port; cluster requires all seed nodes. |
|
|
427
|
+
| `LoadError` / FFI library not found | Confirm `lib/valkey/libglide_ffi.{so,dylib}` exists and matches your OS/arch. |
|
|
428
|
+
| Wrong architecture after FFI rebuild | Rebuild `glide-ffi` on the target platform; do not copy Linux `.so` to macOS. |
|
|
429
|
+
| Cluster tests flaky | Wait for `cluster_state:ok`; increase `TIMEOUT` env var. |
|
|
430
|
+
| SSL test failures | Regenerate certs: `ruby test/fixtures/ssl/generate_certs.rb`. |
|
|
431
|
+
| Pipeline / MULTI crashes | Transaction commands in `pipelined` use sequential fallback by design. |
|
|
432
|
+
|
|
433
|
+
## Recommended Editor Extensions
|
|
434
|
+
|
|
435
|
+
- [Ruby LSP](https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp) or [Solargraph](https://marketplace.visualstudio.com/items?itemName=castwide.solargraph)
|
|
436
|
+
- [RuboCop](https://marketplace.visualstudio.com/items?itemName=rubocop.vscode-rubocop)
|
|
437
|
+
- [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) — when editing valkey-glide FFI
|
|
438
|
+
|
|
439
|
+
## Examples
|
|
440
|
+
|
|
441
|
+
Sample scripts live in [examples/](./examples/). Run from the repo root:
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
bundle exec ruby examples/standalone.rb
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
See [examples/README.md](./examples/README.md) for Docker setup and environment variables.
|
|
448
|
+
|
|
449
|
+
## Community and Feedback
|
|
450
|
+
|
|
451
|
+
Join Valkey Slack: [Join Valkey Slack](https://join.slack.com/t/valkey-oss-developer/shared_invite/zt-2nxs51chx-EB9hu9Qdch3GMfRcztTSkQ).
|
|
452
|
+
|
|
453
|
+
Contribution guidelines: [CONTRIBUTING.md](./CONTRIBUTING.md). Broader GLIDE process: [valkey-glide CONTRIBUTING.md](https://github.com/valkey-io/valkey-glide/blob/main/CONTRIBUTING.md).
|