Canonical result and measurement data storage APIs for Cogniflow
Project description
cf_datahive
cf_datahive owns the Data Hive write provider for CfDataHiveSinkContractV1, publishes the read-side datahive_runs service contract for first-party consumers, and exposes a local Python read/inspect API for manual inspection, owner-side tooling, and package-local validation.
For first-party package integration the boundary is strict:
- cross-package writes go only through
cf_package_contractsand injected contract slots such asCfExecutionContext.datahive_sink - cross-package reads go only through
cf_service_contractsand thedatahive_runsprovider key - first-party packages must not import
cf_datahive - first-party packages must not reach into
cf_datahive/native/*or consumecf_datahive_cpp_*helper APIs
Boundary
sandcastle/cf_datahive/src/cf_datahive/cppis the owner-side native gatekeeper for writes underworkspace/data_hivesandcastle/cf_datahive/src/cf_datahive/service_contract_provider.pypublishes the canonical read-sidedatahive_runscontract for first-party consumerssandcastle/cf_datahive/src/cf_datahiveprovides owner-side read/inspect APIs such asDataHiveClientCfDataHiveSinkContractV1incf_package_contractsis the only supported cross-package sink interfaceDataHiveRunsContractV1incf_service_contractsis the only supported cross-package read interface
First-party packages that need read-side runtime integration should resolve ProviderKey.DATAHIVE_RUNS against the canonical workspace root instead of importing cf_datahive directly.
Usage
First-party read-side integration:
from cf_service_contracts import ProviderKey, require_provider
datahive_runs = require_provider(ProviderKey.DATAHIVE_RUNS)
evidence = datahive_runs.find_latest_run(workspace_root, pipeline_id)
if evidence is not None:
print(evidence["run_id"], evidence["manifest_status"])
Owner-side inspection workflow:
from pathlib import Path
from cf_datahive import DataHiveClient
workspace_root = Path("workspace")
client = DataHiveClient(str(workspace_root))
runs = client.list_runs("opcua_fifo_avg")
if runs:
latest = runs[0].run_id
manifest = client.load_manifest("opcua_fifo_avg", latest)
table = client.read_table("opcua_fifo_avg", latest, "measurements")
print(manifest.status, table.num_rows)
DataHiveClient, RunHandle, and StorageModePolicy remain public for owner-side workflows, but they are not a first-party integration surface.
Canonical Layout
workspace/
data_hive/
<pipeline_id>/
<yyyy>/<mm>/<dd>/<session_id>/
runs/<run_id>/manifest.json
runs/<run_id>/artifacts/<artifact_name>
tables/<table_name>/run_id=<run_id>/part-0000.parquet
tables/<table_name>/_session_compacted/part-0000.parquet
session_manifest.json
latest.txt
latest_session.txt
latest.txtstores the latest committedrun_idlatest_session.txtstores the latest committedsession_idmanifest.jsonis the run SOT for tables, artifacts, hashes, and session linkagesession_manifest.jsonis the per-session SOT for storage-mode locks- flat run layouts and direct
data_hive/roots outside the canonical workspace root are not supported
Local Build Notes
cf_datahive now consumes the workspace-store runtime contract instead of linking the storage backend directly.
Editable builds still use the shared native dependency cache under ~/.cogniflow/cache/native/ and the standard
cf_setup MSVC/CMake environment preparation.
Build caches are expected under ~/.cogniflow/cache/native/scikit-build/cf-datahive.
Guardrails
Run:
python tools/check_datahive_guardrails.py
The guardrail script hard-fails when first-party code outside sandcastle/cf_datahive:
- imports
cf_datahive - references removed
cf_datahive_cpp_*helper APIs - reaches into the removed native consumer packaging surface
Testing
pip install -e "sandcastle/cf_datahive[test]"
pytest -q sandcastle/cf_datahive/tests
Published distribution name:
pip install cf-datahive
Publishing
cf_datahive still publishes the provider binary plus provider descriptor used by cf_setup and cf_pipeline_engine.
- Workflow:
.github/workflows/cf_datahive_windows_publish.yml - Package directory:
sandcastle/cf_datahive - PyPI tag:
cf-datahive-v<version> - TestPyPI tag:
cf-datahive-v<version>-test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cf_datahive-0.1.11.tar.gz.
File metadata
- Download URL: cf_datahive-0.1.11.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b07d84378534aeb402e59cbdd957359cd56408b07190a6e8f9122a94a7b747e
|
|
| MD5 |
7d6f5e7bb92fde5978b4ceed2f36fe40
|
|
| BLAKE2b-256 |
b8e8a2b5154f32c4486d8f35b103978db60177bfa565d4f176187a5dd7a8e5dc
|
File details
Details for the file cf_datahive-0.1.11-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: cf_datahive-0.1.11-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 82.4 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fb1164e77f2e4d5e31edc0870d0471ea9dde2a89c1086bbeb5d5699b6db2920
|
|
| MD5 |
781a949d9bd55f9e462349dce9e87ba2
|
|
| BLAKE2b-256 |
7a6e1d370086594c2f7c0c86b0337d79ef443eac1af47b3716fa9940e3ff0667
|