Skip to content

feat: Add C ABI for embedded seekdb (multi‑language SDKs)#674

Open
dengfuping wants to merge 96 commits into
masterfrom
feat/embedded-mode
Open

feat: Add C ABI for embedded seekdb (multi‑language SDKs)#674
dengfuping wants to merge 96 commits into
masterfrom
feat/embedded-mode

Conversation

@dengfuping
Copy link
Copy Markdown
Collaborator

Task Description

Solution Description

  • Architecture Design:
Language Bindings (Node.js, Python, Rust, Go)
           │
           ▼
    SeekDB C ABI (seekdb.h/seekdb.cpp)
           │
           ▼
    OceanBase Core (liboceanbase.so)
  • Source Code Directory (src/include/)
src/include/
├── seekdb.h                          # Public C API header file
│                                     # - All function declarations
│                                     # - Type definitions (SeekdbHandle, SeekdbResult, etc.)
│                                     # - Data structures (SeekdbBind, SeekdbField)
│                                     # - MySQL C API compatible interface
│
├── seekdb.cpp                        # C ABI implementation (~4800 lines)
│                                     # - Global initialization (seekdb_open/close)
│                                     # - Connection management
│                                     # - Query execution & Result set operations
│                                     # - Prepared Statement API
│                                     # - Signal handling & Stack management
│
├── CMakeLists.txt                    # Build configuration for libseekdb.so

Test Directory (unittest/include/)

unittest/include/
├── test_seekdb.cpp                   # C++ unit test suite (comprehensive)
│                                     # - Tests all C API functions directly
│                                     # - Complete API coverage
│
├── nodejs/                           # Node.js FFI binding (koffi)
│   ├── seekdb.js                    # FFI wrapper
│   ├── test.js                      # Test suite
│   └── test.sh                      # Test execution script
│
├── nodejs_napi/                      # Node.js N-API binding (native addon)
│   ├── seekdb.cpp                   # N-API C++ implementation
│   ├── test.js                      # Test suite
│   └── test.sh                      # Test execution script
│
├── python/                           # Python binding (ctypes)
│   ├── seekdb.py                    # FFI wrapper
│   ├── test.py                      # Test suite
│   └── test.sh                      # Test execution script
│
├── rust/                             # Rust FFI binding
│   ├── src/
│   │   ├── lib.rs                   # FFI bindings
│   │   └── test.rs                  # Test suite
│   └── test.sh                      # Test execution script
│
└── go/                               # Go binding (cgo)
    ├── seekdb/seekdb.go              # FFI wrapper
    ├── test.go                       # Test suite
    └── test.sh                       # Test execution script

Passed Regressions

  • Unittest
  • Node.js FFI bindings
  • Node.js N-API bindings
  • Python FFI bindings
  • Go FFI bindings
  • Rust FFI bindings

Build and test:

# build libseekdb library
./build.sh release --init -DBUILD_EMBED_MODE=ON --make

# unittest
make -j$(nproc) test_seekdb
cd build_release/unittest/include && ./test_seekdb

# bindings test
cd unittest/include/nodejs && bash ./test.sh
cd unittest/include/nodejs_napi && bash ./test.sh
cd unittest/include/python && bash ./test.sh
cd unittest/include/go && bash ./test.sh
cd unittest/include/rust && bash ./test.sh

Upgrade Compatibility

  • Compatible

Other Information

Release Note

  • 🆕 Add C ABI for embedded seekdb (multi‑language SDKs).

…ix MTL_SWITCH namespace; remove §7/doc refs

- C ABI: row_nulls for NULL vs empty; read_lob_data for TEXT/JSON LOB; MTL_SWITCH(OB_SYS_TENANT_ID) for ObLobManager; namespace share alias for MTL_SWITCH
- test: 100KB LONGTEXT via SET SESSION ob_default_lob_inrow_threshold=262144, no table option; special chars metadata test; remove §7 and c-abi-modification-reference references from comments and error messages
- Add LOB read paths for TEXT/JSON columns in result row serialization
- Use print_sql_literal for ObJsonType cells and expand buffer to 32KB
- Add col_is_metadata heuristic: write "{}" for empty metadata in fallback paths
- Add unit tests: very long document (100KB), special chars in metadata, empty JSON metadata
- macOS: put ccache in deps devtools/bin so Env.cmake finds it without code change
- Linux: install base deps (incl. wget) first so dep_create.sh can download RPMs
- Linux: try EPEL+ccache; use OB_USE_CCACHE=OFF when ccache not available in container
…cOS cross-build arch

- Checkout PR head ref instead of merge ref to avoid conflict markers in CI
- Restore darwin-x64 job (cross-compile on Apple Silicon for Intel Mac)
- Env.cmake: use CMAKE_OSX_ARCHITECTURES for ARCHITECTURE on macOS x86_64 cross-build
So next push can restore cache and avoid full rebuild from scratch.
- workflow: cd to GITHUB_WORKSPACE/package/libseekdb for Linux pack (was relative to build_release)
- zlib_lite: build QPL only on x86_64 Linux (NOT APPLE); macOS deps do not ship qpl
@dengfuping dengfuping force-pushed the feat/embedded-mode branch 11 times, most recently from f1dfc80 to 0d783e6 Compare May 13, 2026 07:10
@dengfuping dengfuping force-pushed the feat/embedded-mode branch from be89b60 to 7fe3c88 Compare May 14, 2026 09:32
…Module link, RelWithDebInfo maps, Android C++20, N-API fixes
@dengfuping dengfuping force-pushed the feat/embedded-mode branch from 101093e to a83fd30 Compare May 15, 2026 06:28
@dengfuping dengfuping force-pushed the feat/embedded-mode branch 6 times, most recently from 1b071fc to 11f336c Compare May 18, 2026 12:38
@dengfuping dengfuping force-pushed the feat/embedded-mode branch from 11f336c to d60d645 Compare May 18, 2026 12:41
This was referenced May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant