Skip to Content
Types & Models

Types & Models

This page documents the most important public types re-exported by kalam-client from link-common.

Query models

QueryResponse

Returned by execute_query, execute_with_files, and related SQL helpers.

  • status: ResponseStatusSuccess or Error
  • results: Vec<QueryResult> — one per executed statement
  • took: Option<f64> — execution time in milliseconds
  • error: Option<ErrorDetail> — populated when status is error

Helpers:

  • success()bool
  • is_token_expired()bool
  • rows_as_maps() → first result as Vec<HashMap<String, KalamCellValue>>
  • rows() → first result as positional Vec<Vec<KalamCellValue>>
  • row_count(), first_row_as_map(), get_value(...), get_i64(...)

QueryResult

  • schema — column metadata (SchemaField)
  • rows: Option<Vec<Vec<KalamCellValue>>> — positional row storage
  • row_count: usize
  • message: Option<String>

row_as_map(index) builds a named row map for one index.

SchemaField

Column metadata with flag helpers for primary key, nullability, and uniqueness.

Authentication models

LoginResponse

Returned by login and refresh_access_token (requires auth-flows):

  • access_token: String
  • refresh_token: Option<String>
  • expires_at / refresh_expires_at — server-provided timestamps
  • userLoginUserInfo

AuthProvider

Enum: BasicAuth, JwtToken, None.

Construct with basic_auth, jwt_token, system_user_auth, or none.

ResolvedAuth

Internal resolved state: static provider or dynamic ArcDynAuthProvider.

Subscription models

SubscriptionConfig

  • id — subscription name
  • query — live SQL string
  • options: Option<SubscriptionOptions>last_rows, batch_size, from (SeqId)

SubscriptionOptions

Builder-style helpers: with_last_rows, with_batch_size, with_from.

LiveRowsConfig

Client-side materializer settings — primarily limit: Option<usize>.

LiveRowsEvent

  • Rows { rows, last_seq_id, .. } — materialized snapshot
  • Error { code, message, .. } — subscription failure

ChangeEvent

Low-level protocol events from live_events():

  • Insert, Update, Delete with row payloads
  • Additional control/ack variants for protocol tooling

SubscriptionInfo

Returned by client.subscriptions() — active subscription id and query text.

Consumer models (feature consumer)

  • ConsumerBuilder — fluent builder from client.consumer()
  • TopicConsumerpoll(), mark_processed(), commit_sync(), close()
  • ConsumerConfig, AutoOffsetReset
  • ConsumeMessage, ConsumeRequest, ConsumeResponse, AckResponse

Connection models

EventHandlers

Lifecycle callbacks — see Client Lifecycle.

ConnectionOptions

HTTP/WebSocket behavior including ws_lazy_connect, compression, keepalive, and HttpVersion.

KalamLinkTimeouts

Receive/send timeouts for HTTP and WebSocket operations.

Error type

KalamLinkError — library error enum. Result<T> is std::result::Result<T, KalamLinkError>.

Common variants: configuration errors, authentication errors, server HTTP errors, subscription errors, SetupRequired (HTTP 428 on login).

FILE column models

FileRef

Table-agnostic metadata stored in FILE column JSON (from kalamdb-commons):

  • id, sub, name, size, mime, sha256, optional shard
  • stored_name(), relative_path(), format_size(), MIME type helpers
  • download_url(base_url, namespace, table) and relative_url(namespace, table) when namespace/table are known as strings

Parse from cells with KalamCellValue::as_file().

TableId

Type-safe namespace + table identity (from kalamdb-commons, re-exported by kalam-client):

RUST
let table_id = TableId::from_strings("docs", "files");let ns = table_id.namespace_id().as_str();let table = table_id.table_name().as_str();let qualified = table_id.full_name(); // "docs.files"

Use one TableId when binding many FILE cells from the same table.

FileRefContext

Wraps a TableId for download context. Construct with FileRefContext::new(table_id) or FileRefContext::from_strings(namespace, table).

BoundFileRef

FileRef plus table context. Derefs to FileRef.

  • table_id(), namespace(), table()
  • download_url(base_url), relative_url() — no extra namespace/table args
  • file_ref() — borrow underlying FileRef

Parse from cells with KalamCellValue::as_bound_file(&table_id).

FileUpload

Multipart payload for FILE("placeholder") SQL — FileUpload::new(placeholder, filename, bytes) plus optional with_mime.

FileDownload

Response from download_bound_file() / download_file():

  • bytes, content_type, content_disposition

IDs

  • SeqId — subscription resume cursor (from kalamdb_commons)
  • TableId — namespace + table composite key
  • UserId, Role — re-exported domain types

Next

Last updated on