TRIAL 2026-11-18
  • Java 85.2%
  • Python 11%
  • Shell 3%
  • Dockerfile 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Travis Johnson 085eaf693d feeds: move sequence/cursor stores onto dedicated tables
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>
2026-08-05 15:37:31 -05:00
bin pin JDK 21 via Hermit, target Java/Kotlin 21, add docker runtime 2026-05-28 10:44:00 -05:00
docker kv: add List ordering (asc/desc); container reads host MySQL 2026-06-23 08:39:17 -05:00
docs revamp for 2025 2025-02-27 08:56:35 -06:00
gradle test: fix JUnit platform alignment; drop ValerioTest 2026-06-23 08:58:59 -05:00
jooq/src/main/java/io/tcj/jooq db: sync schema with feedz (kv feed index, feed_cursors, sequences) 2026-08-05 15:18:53 -05:00
src feeds: move sequence/cursor stores onto dedicated tables 2026-08-05 15:37:31 -05:00
.dockerignore pin JDK 21 via Hermit, target Java/Kotlin 21, add docker runtime 2026-05-28 10:44:00 -05:00
.gitignore gitignore .claude/ (claude code worktrees + local settings) 2026-05-28 11:53:53 -05:00
build.gradle.kts build: target native MySQL on 3306 for codegen/migrate/run/test 2026-06-23 09:23:27 -05:00
Dockerfile pin JDK 21 via Hermit, target Java/Kotlin 21, add docker runtime 2026-05-28 10:44:00 -05:00
gradle.properties pin JDK 21 via Hermit, target Java/Kotlin 21, add docker runtime 2026-05-28 10:44:00 -05:00
gradlew initial 2022-03-02 06:49:29 -06:00
gradlew.bat initial 2022-03-02 06:49:29 -06:00
kv_service.py add kv_service.py: single-file fastapi KvService (filesystem + mysql backends, uv-run) 2026-05-28 11:11:06 -05:00
README.md add smoke-test curl examples to README (KvService.List, MortgageService.Calc) 2026-05-28 11:53:53 -05:00
settings.gradle revamp for 2025 2025-02-27 08:56:35 -06:00
settings.gradle.kts bump misk version, add KvListNamespaceRpc 2025-12-03 11:37:08 -06:00

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)