- Java 85.2%
- Python 11%
- Shell 3%
- Dockerfile 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
SequenceStoreImpl and FeedCursorStoreImpl previously piggybacked on the kv table (ns FEED_SEQ / FEED_CURSOR); switch them to the real sequences and feed_cursors tables shared with feedz. - SequenceStore: replace put() with atomic allocate(name, count) -- create-on-first-use INSERT ... ON DUPLICATE KEY IGNORE, then UPDATE value = value + count, version = version + 1, then read value. Same statement shape and meaning as feedz (value = last-assigned id), so both publishers can share one sequence row. - FeedPublisher: fetch unpublished first, then allocate exactly entries.size() ids and assign [last-count+1, last]; skip empty batches. A crash between allocate and publish now leaves a harmless id gap instead of the old lookup/put lost-update window. - PublishedFeedDef name "kv" -> "feed-kv" so the sequence row matches feedz's FEED_NAME; expose/consume routing stays "kv". - FeedCursorStore: one feed_cursors row per (consumer, shard); create-on-first-use with token '0', enabled=1, shard_count=1; put() advances token and bumps last_fetched_at. Live traviscj_localdev cleanup: sequences already had feed-kv=28 (= MAX(kv.feed_sync_id), advanced by feedz), so the stale legacy row kv(ns=FEED_SEQ, k=kv, v=22 -- old next-id semantics, last=21) was deleted rather than migrated; no FEED_CURSOR rows existed. Tests: SequenceStoreImplTest (7) + FeedCursorStoreImplTest (6) against the codegen schema; full ./gradlew build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
| bin | ||
| docker | ||
| docs | ||
| gradle | ||
| jooq/src/main/java/io/tcj/jooq | ||
| src | ||
| .dockerignore | ||
| .gitignore | ||
| build.gradle.kts | ||
| Dockerfile | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| kv_service.py | ||
| README.md | ||
| settings.gradle | ||
| settings.gradle.kts | ||
build / run
Toolchain is pinned with Hermit (bin/ =
corretto@21). Activate it first, or ./gradlew runs under your ambient java
(Gradle 8.13 rejects Java 25):
. bin/activate-hermit
./gradlew run # serves :1337; needs MySQL up (see below / kv3 docker-compose)
./gradlew installDist # builds build/install/iotcj for the kv3 `full` compose profile
Java + Kotlin both target 21. DB defaults to localhost:3307 (the kv3 docker MySQL);
docker/traviscj-production.yaml overrides that to the mysql service when run as a
container. The fastest local DB is cd ~/kv3 && docker-compose up -d — the manual
MySQL setup below is the from-scratch alternative.
smoke test
Once ./gradlew run is serving on :1337, hit the endpoints directly:
curl http://localhost:1337/io.tcj.KvService/List -d '{
"ns": "MORTGAGES",
"k_prefix": "",
"limit": 20
}' -H 'Content-type: application/json' -H 'Accept: application/json' | jq .
curl http://localhost:1337/io.tcj.MortgageService/Calc -d '{
"principal": 510400,
"apr": 2.625,
"term": 30
}' -H 'Content-type: application/json' -H 'Accept: application/json' | jq .
mysql (manual / from scratch)
$ brew install mysql
$ brew services start mysql
$ mysql -u root
mysql> create database traviscj_localdev;
Query OK, 1 row affected (0.01 sec)
mysql> use traviscj_localdev ;
Database changed
mysql> CREATE TABLE `schema_version` (
-> `version` varchar(50) NOT NULL,
-> `installed_by` varchar(30) DEFAULT NULL,
-> PRIMARY KEY (`version`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
-> ;
Query OK, 0 rows affected (0.01 sec)
create user root with superuser;
qr-buttons
the QR code could just link to a simple form to create kv entries with a namespace, key, and value or (ns, k, v) for short
nice-to-have feature 1: when namespace is unpopulated, show most recent N distinct namespace values
nice-to-have feature 2: when namespace is selected, show most recent N (k, v) pairs within that namespace.
- kv is feed published
- different feed consumers can listen for KV entries, perhaps listening for a specific namespace or something, and react appropriately e.g. when `k.ns==“LAUNDRY::START”, enqueue a notification based on the k.v payload (perhaps {"minutes":64} or something)