Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ jobs:
mobilitydb-ref: master
build-libmeos: "true"

- name: Derive the streaming-relevance baseline from the catalog
# The facade generator reads tools/baseline/streaming-relevance-baseline.json; derive
# it from the master catalog with the deterministic classifier so the generator input
# tracks master too. The baseline is gitignored — it only ever exists as a build artifact.
- name: Stage the derived MEOS catalog
# codegen_jvm.py reads tools/meos-idl.json; place the derived catalog there so its
# wiring is unchanged. The catalog is gitignored — it only ever exists as a build artifact.
run: |
tools/regen_baseline.sh "${{ steps.provision.outputs.catalog-path }}"
cp "${{ steps.provision.outputs.catalog-path }}" tools/meos-idl.json
echo "LD_LIBRARY_PATH=/usr/local/lib" >> "$GITHUB_ENV"

- name: Check out JMEOS at master
Expand Down Expand Up @@ -71,7 +70,7 @@ jobs:
-DgroupId=org.jmeos -DartifactId=meos -Dversion=1.0 -Dpackaging=jar

- name: Build + generate + smoke tests
# generate-sources runs the facade generator over the installed jar's surface ∩ baseline;
# generate-sources runs codegen_jvm.py --engine flink over the installed jar's full surface;
# the smoke tests exercise the facades against the freshly built libmeos from /usr/local/lib.
working-directory: flink-processor
run: mvn -B -Dmeos.lib.dir=/usr/local/lib -Dmeos.enabled=true clean test
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ __pycache__/
# Maven build output
flink-processor/target/

# Derived generator input — the streaming-relevance baseline is regenerated in CI
# from the master MEOS catalog (tools/regen_baseline.sh), never committed.
tools/baseline/streaming-relevance-baseline.json
# Derived generator input — the MEOS catalog is staged in CI from upstream
# MobilityDB master (provision-meos), never committed.
tools/meos-idl.json
50 changes: 25 additions & 25 deletions GENERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ equivalence probe).
## MobilityFlink scope: generated MEOS facades over the JMEOS surface

MobilityFlink is a **consumer** binding: it binds the **JMEOS jar** (the JVM FFI projection
of the catalog), not MEOS-API directly. Its generator **`tools/codegen_facades.py`** reads
the bundled JMEOS raw-FFI surface (intersected with the streaming-relevance baseline) and
emits the `org.mobilitydb.meos.MeosOps*` 1:1 forwarder facades the Flink processor consumes.
The facades are a *consumer* projection (they live here, not in JMEOS, so the JMEOS FFI line
and the facade line do not diverge).

## The streaming-relevance baseline (generator input)

`tools/codegen_facades.py` emits a facade only for functions in the
**streaming-relevant** tiers, read from `tools/baseline/streaming-relevance-baseline.json`.
That baseline is itself **generated and reproducible** — it is not a hand-maintained
list. It is produced by **`tools/classify_streaming_relevance.py`**, a deterministic
classifier: the tier of a function is decided purely by its name, its object-model role,
and its number of temporal parameters (zero per-function judgement), so the same MEOS
catalog always yields the same baseline.
of the catalog), not MEOS-API directly. Its generator is the shared
**`tools/codegen_jvm.py --engine flink`**, the single generator vendored identically by every
JVM binding (MobilitySpark, MobilityFlink, MobilityKafka); the `flink` and `kafka` engines
emit the `org.mobilitydb.meos.MeosOps*` 1:1 forwarder facades the streaming processors
consume. The facades are a *consumer* projection (they live here, not in JMEOS, so the JMEOS
FFI line and the facade line do not diverge).

## Full surface, grouped by the catalog object model

`codegen_jvm.py --engine flink` emits a facade for **every** function on the bundled JMEOS
`functions.GeneratedFunctions` surface, grouped by the MEOS-API catalog object model: one
`MeosOps<Class>` per object-model class plus one `MeosOpsFree<Header>` per source header for
the free functions, with a shared `MeosOpsRuntime` that probes libmeos once per JVM. Each
forwarder carries a runtime guard: functions whose catalog return type is sequence-typed
(build a whole `TSequence`/`SeqSet`, inherently non-streamable) throw
`UnsupportedOperationException`; all others forward to `GeneratedFunctions` behind the
`MEOS_AVAILABLE` probe. The class/role/header are read straight from the catalog's
`objectModel`, and the sequence check from `returnType.canonical` — no separate classifier.

The full input chain, from upstream MobilityDB master:

```
MobilityDB @ master
→ provision-meos (MEOS-API/run.py over the MEOS headers) → meos-idl.json (the catalog)
→ tools/classify_streaming_relevance.py → tools/baseline/streaming-relevance-baseline.json
→ tools/codegen_facades.py (jar-surface ∩ baseline) → org.mobilitydb.meos.MeosOps* facades
→ tools/codegen_jvm.py --engine flink (full jar surface) → org.mobilitydb.meos.MeosOps* facades
```

CI derives the baseline from the master catalog with `tools/regen_baseline.sh
<path-to-meos-idl.json>` before the build; the baseline is gitignored, not committed.
Because the classifier is deterministic, the same catalog regenerates it byte-for-byte, so
a local refresh is: build the catalog from master with MEOS-API, then run the same script.
CI stages the master-derived catalog to `tools/meos-idl.json` before the build; the catalog
is gitignored, not committed.

## Generate-then-retire — the green-CI version is the probe

Expand All @@ -56,10 +56,10 @@ never wipe-first**: regenerate, build green, **prove generated ⊇ hand** agains
green-CI version** (the test suite + the streaming benchmark), then retire the hand path.

The `MeosOps*` facades are emitted at build time and are **not committed**: Maven
`generate-sources` runs `tools/codegen_facades.py` into `target/generated-facades`, and
`build-helper` adds it as a source root. Only the generator and its `tools/` classifier are
tracked; the catalog, the baseline and the JMEOS jar are all derived in CI, and the sole
hand-written class under `org.mobilitydb.meos` is `MeosSetSetJoin`.
`generate-sources` runs `tools/codegen_jvm.py --engine flink` into `target/generated-facades`,
and `build-helper` adds it as a source root. Only the generator is tracked; the catalog and
the JMEOS jar are all derived in CI, and the sole hand-written class under
`org.mobilitydb.meos` is `MeosSetSetJoin`.

## Surface match

Expand Down
8 changes: 5 additions & 3 deletions flink-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@
<configuration>
<executable>python3</executable>
<arguments>
<argument>${project.basedir}/../tools/codegen_facades.py</argument>
<argument>${project.basedir}/../tools/codegen_jvm.py</argument>
<argument>--engine</argument>
<argument>flink</argument>
<argument>--catalog</argument>
<argument>${project.basedir}/../tools/meos-idl.json</argument>
<argument>--jar</argument>
<argument>${settings.localRepository}/org/jmeos/meos/1.0/meos-1.0.jar</argument>
<argument>--out</argument>
<argument>${project.build.directory}/generated-facades</argument>
<argument>--engine</argument>
<argument>flink</argument>
</arguments>
</configuration>
</execution>
Expand Down
Loading
Loading