tree: 00261d7ae56d905c5e614556552ab1ed61741bbb
  1. src/
  2. tests/
  3. Cargo.toml
  4. README.md
crates/paimon-rest-server/README.md

paimon-rest-server

A Paimon REST catalog server backed by a real FileSystemCatalog, for local end-to-end testing of the REST catalog client. It is a dev/testing tool and is not published to crates.io.

Unlike the in-memory mock used in paimon's own unit tests, this server maps the Paimon REST protocol onto a real FileSystemCatalog, so the client-side RESTCatalog can be exercised against actual on-disk metadata:

  • config + database/table metadata CRUD;
  • append write + commit (the commit endpoint persists the posted snapshot via SnapshotManager) + read back;
  • column-level alter table.

Because both the server and the client point at the same local warehouse, the client writes data files directly while the server persists the snapshot metadata it receives on the commit endpoint. The wire format mirrors Java Paimon, so the same warehouse can be round-tripped with a Java reader/writer.

Run the standalone server

REST_WAREHOUSE=/tmp/paimon-warehouse REST_HOST=127.0.0.1 REST_PORT=8080 \
  cargo run -p paimon-rest-server

Environment variables: REST_WAREHOUSE (default /tmp/paimon-warehouse), REST_HOST (default 127.0.0.1), REST_PORT (default 8080), REST_PREFIX (default empty).

Use as a test fixture

# async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let server = paimon_rest_server::FsRestCatalogServer::start("/tmp/paimon-wh", "").await?;
// Point a RESTCatalog client at `server.url()`.
# Ok(()) }

See tests/e2e.rs for the full metadata / write-commit-read / alter-table round trips.

Endpoints

Served under the configured prefix (/v1/... by default):

MethodPathOperation
GET/v1/configserver config
GET / POST/databaseslist / create database
GET / POST / DELETE/databases/{db}get / alter (no-op) / drop database
GET / POST/databases/{db}/tableslist / create table
GET / POST / DELETE/databases/{db}/tables/{table}get / alter / drop table
POST/tables/renamerename table
POST/databases/{db}/tables/{table}/commitcommit a snapshot
GET/databases/{db}/tables/{table}/partitionslist partitions

The data-token endpoint returns 501; it is never called when data-token.enabled=false (the default).