Documentation

TypeDB.Native

Native bindings #

Thin @[extern] declarations over ffi/typedb_lean.c. Every function returns the driver's error as a NativeError in the same call, because the driver keeps its last error in thread-local state. Handles are external objects: dropping the last reference releases them, and the explicit close functions release them early.

This module is internal; TypeDB.Driver, TypeDB.Tx and TypeDB.Query wrap it.

An error reported by the driver: its code (CXN05, TQL03, …) and message. Codes starting with TDBLEAN come from the shim itself.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      An open transaction, with the query options it runs queries with.

      Equations
      Instances For

        A stream of concept rows; valid only while its transaction is open.

        Equations
        Instances For

          A stream of JSON documents from a fetch; valid only while its transaction is open.

          Equations
          Instances For

            What a query answered. Constructor order is mirrored by the shim.

            Instances For
              @[reducible, inline]
              abbrev TypeDB.Native.NIO (α : Type) :
              Equations
              Instances For
                @[extern tdb_driver_open]
                opaque TypeDB.Native.driverOpen (address user password : String) (tls : Bool) (rootCA : String) (timeoutMs : Int64) :

                Opens a connection. An empty rootCA with tls uses the system's root certificates. A timeoutMs of 0 keeps the driver's default request timeout.

                @[extern tdb_driver_close]
                @[extern tdb_driver_is_open]
                @[extern tdb_db_create]
                @[extern tdb_db_contains]
                @[extern tdb_db_delete]
                @[extern tdb_db_schema]
                opaque TypeDB.Native.dbSchema (d : DriverHandle) (name : String) (kind : UInt8) :

                kind 0 is the full schema, 1 the type schema only.

                @[extern tdb_db_all]
                @[extern tdb_tx_open]
                opaque TypeDB.Native.txOpen (d : DriverHandle) (db : String) (type : UInt8) (timeoutMs prefetch : Int64) :

                type is 0 read, 1 write, 2 schema; a timeoutMs or prefetch of 0 keeps the default.

                @[extern tdb_tx_commit]

                Commits and releases the transaction, whatever the outcome.

                @[extern tdb_tx_rollback]
                @[extern tdb_tx_close]

                Closes the transaction without committing and releases it, without waiting for the driver to finish closing it (like the Rust driver's drop). Idempotent.

                @[extern tdb_wait_closes]

                Waits until every transaction closed so far has finished closing.

                @[extern tdb_tx_is_open]
                @[extern tdb_tx_query]
                @[extern tdb_rows_next]
                @[extern tdb_rows_close]
                @[extern tdb_row_columns]
                @[extern tdb_row_get]
                opaque TypeDB.Native.rowGet (r : RowHandle) (col : String) (flags : UInt8) :

                The concept in column col, or none if the row leaves it empty.

                @[extern tdb_rows_next_batch]

                Pulls up to k rows and returns the concepts of cols in each, in one native call. A result shorter than k means the stream is exhausted (and already released).

                @[extern tdb_docs_next]
                @[extern tdb_docs_close]

                Column flags: read the concept's type label.

                Equations
                Instances For

                  Column flags: read the instance's IID.

                  Equations
                  Instances For