sidebar_position: 2

API Reference

Complete API reference for the Fluss C++ client.

Result

Field / MethodTypeDescription
error_codeint32_t0 for success, non-zero for errors
error_messagestd::stringHuman-readable error description
Ok()boolReturns true if operation succeeded (error_code == 0)

Configuration

FieldTypeDefaultDescription
bootstrap_serversstd::string"127.0.0.1:9123"Coordinator server address
writer_request_max_sizeint32_t10485760 (10 MB)Maximum request size in bytes
writer_acksstd::string"all"Acknowledgment setting ("all", "0", "1", or "-1")
writer_retriesint32_tINT32_MAXNumber of retries on failure
writer_batch_sizeint32_t2097152 (2 MB)Batch size for writes in bytes
writer_batch_timeout_msint64_t100Maximum time in ms to wait for a writer batch to fill up before sending
writer_bucket_no_key_assignerstd::string"sticky"Bucket assignment strategy for tables without bucket keys: "sticky" or "round_robin"
scanner_remote_log_prefetch_numsize_t4Number of remote log segments to prefetch
remote_file_download_thread_numsize_t3Number of threads for remote log downloads
scanner_remote_log_read_concurrencysize_t4Streaming read concurrency within a remote log file
scanner_log_max_poll_recordssize_t500Maximum number of records returned in a single Poll()
scanner_log_fetch_max_bytesint32_t16777216 (16 MB)Maximum bytes per fetch response for LogScanner
scanner_log_fetch_min_bytesint32_t1Minimum bytes the server must accumulate before returning a fetch response
scanner_log_fetch_wait_max_time_msint32_t500Maximum time (ms) the server may wait to satisfy min-bytes
scanner_log_fetch_max_bytes_for_bucketint32_t1048576 (1 MB)Maximum bytes per fetch response per bucket for LogScanner
connect_timeout_msuint64_t120000TCP connect timeout in milliseconds
security_protocolstd::string"PLAINTEXT""PLAINTEXT" (default) or "sasl" for SASL auth
security_sasl_mechanismstd::string"PLAIN"SASL mechanism (only "PLAIN" is supported)
security_sasl_usernamestd::string(empty)SASL username (required when protocol is "sasl")
security_sasl_passwordstd::string(empty)SASL password (required when protocol is "sasl")

Connection

MethodDescription
static Create(const Configuration& config, Connection& out) -> ResultCreate a connection to a Fluss cluster
GetAdmin(Admin& out) -> ResultGet the admin interface
GetTable(const TablePath& table_path, Table& out) -> ResultGet a table for read/write operations
Available() -> boolCheck if the connection is valid and initialized

Admin

Database Operations

MethodDescription
CreateDatabase(const std::string& database_name, const DatabaseDescriptor& descriptor, bool ignore_if_exists) -> ResultCreate a database
DropDatabase(const std::string& name, bool ignore_if_not_exists, bool cascade) -> ResultDrop a database
ListDatabases(std::vector<std::string>& out) -> ResultList all databases
DatabaseExists(const std::string& name, bool& out) -> ResultCheck if a database exists
GetDatabaseInfo(const std::string& name, DatabaseInfo& out) -> ResultGet database metadata

Table Operations

MethodDescription
CreateTable(const TablePath& path, const TableDescriptor& descriptor, bool ignore_if_exists) -> ResultCreate a table
DropTable(const TablePath& path, bool ignore_if_not_exists) -> ResultDrop a table
GetTableInfo(const TablePath& path, TableInfo& out) -> ResultGet table metadata
ListTables(const std::string& database_name, std::vector<std::string>& out) -> ResultList tables in a database
TableExists(const TablePath& path, bool& out) -> ResultCheck if a table exists

Partition Operations

MethodDescription
CreatePartition(const TablePath& path, const std::unordered_map<std::string, std::string>& partition_spec, bool ignore_if_exists) -> ResultCreate a partition
DropPartition(const TablePath& path, const std::unordered_map<std::string, std::string>& partition_spec, bool ignore_if_not_exists) -> ResultDrop a partition
ListPartitionInfos(const TablePath& path, std::vector<PartitionInfo>& out) -> ResultList partition metadata

Offset Operations

MethodDescription
ListOffsets(const TablePath& path, const std::vector<int32_t>& bucket_ids, const OffsetSpec& query, std::unordered_map<int32_t, int64_t>& out) -> ResultGet offsets for buckets
ListPartitionOffsets(const TablePath& path, const std::string& partition_name, const std::vector<int32_t>& bucket_ids, const OffsetSpec& query, std::unordered_map<int32_t, int64_t>& out) -> ResultGet offsets for a partition's buckets

Lake Operations

MethodDescription
GetLatestLakeSnapshot(const TablePath& path, LakeSnapshot& out) -> ResultGet the latest lake snapshot

Cluster Operations

MethodDescription
GetServerNodes(std::vector<ServerNode>& out) -> ResultGet all alive server nodes (coordinator + tablets)

ServerNode

FieldTypeDescription
idint32_tServer node ID
hoststd::stringHostname of the server
portuint32_tPort number
server_typestd::stringServer type ("CoordinatorServer" or "TabletServer")
uidstd::stringUnique identifier (e.g. "cs-0", "ts-1")

Table

MethodDescription
NewRow() -> GenericRowCreate a schema-aware row for this table
NewAppend() -> TableAppendCreate an append builder for log tables
NewUpsert() -> TableUpsertCreate an upsert builder for PK tables
NewLookup() -> TableLookupCreate a lookup builder for PK tables
NewScan() -> TableScanCreate a scan builder
GetTableInfo() -> TableInfoGet table metadata
GetTablePath() -> TablePathGet the table path
HasPrimaryKey() -> boolCheck if the table has a primary key

TableAppend

MethodDescription
CreateWriter(AppendWriter& out) -> ResultCreate an append writer

TableUpsert

MethodDescription
PartialUpdateByIndex(std::vector<size_t> column_indices) -> TableUpsert&Configure partial update by column indices
PartialUpdateByName(std::vector<std::string> column_names) -> TableUpsert&Configure partial update by column names
CreateWriter(UpsertWriter& out) -> ResultCreate an upsert writer

TableLookup

MethodDescription
CreateLookuper(Lookuper& out) -> ResultCreate a lookuper for point lookups

TableScan

MethodDescription
ProjectByIndex(std::vector<size_t> column_indices) -> TableScan&Project columns by index
ProjectByName(std::vector<std::string> column_names) -> TableScan&Project columns by name
CreateLogScanner(LogScanner& out) -> ResultCreate a record-based log scanner
CreateRecordBatchLogScanner(LogScanner& out) -> ResultCreate an Arrow RecordBatch-based log scanner

AppendWriter

MethodDescription
Append(const GenericRow& row) -> ResultAppend a row (fire-and-forget)
Append(const GenericRow& row, WriteResult& out) -> ResultAppend a row with write acknowledgment
Flush() -> ResultFlush all pending writes

UpsertWriter

MethodDescription
Upsert(const GenericRow& row) -> ResultUpsert a row (fire-and-forget)
Upsert(const GenericRow& row, WriteResult& out) -> ResultUpsert a row with write acknowledgment
Delete(const GenericRow& row) -> ResultDelete a row by primary key (fire-and-forget)
Delete(const GenericRow& row, WriteResult& out) -> ResultDelete a row with write acknowledgment
Flush() -> ResultFlush all pending operations

WriteResult

MethodDescription
Wait() -> ResultWait for server acknowledgment of the write

Lookuper

MethodDescription
Lookup(const GenericRow& pk_row, LookupResult& out) -> ResultLookup a row by primary key

LogScanner

MethodDescription
Subscribe(int32_t bucket_id, int64_t offset) -> ResultSubscribe to a single bucket at an offset
Subscribe(const std::vector<BucketSubscription>& bucket_offsets) -> ResultSubscribe to multiple buckets
SubscribePartitionBuckets(int64_t partition_id, int32_t bucket_id, int64_t start_offset) -> ResultSubscribe to a single partition bucket
SubscribePartitionBuckets(const std::vector<PartitionBucketSubscription>& subscriptions) -> ResultSubscribe to multiple partition buckets
Unsubscribe(int32_t bucket_id) -> ResultUnsubscribe from a non-partitioned bucket
UnsubscribePartition(int64_t partition_id, int32_t bucket_id) -> ResultUnsubscribe from a partition bucket
Poll(int64_t timeout_ms, ScanRecords& out) -> ResultPoll individual records
PollRecordBatch(int64_t timeout_ms, ArrowRecordBatches& out) -> ResultPoll Arrow RecordBatches

GenericRow

GenericRow is a write-only row used for append, upsert, delete, and lookup key construction. For reading field values from scan or lookup results, see RowView and LookupResult.

Index-Based Setters

MethodDescription
SetNull(size_t idx)Set field to null
SetBool(size_t idx, bool value)Set boolean value
SetInt32(size_t idx, int32_t value)Set 32-bit integer
SetInt64(size_t idx, int64_t value)Set 64-bit integer
SetFloat32(size_t idx, float value)Set 32-bit float
SetFloat64(size_t idx, double value)Set 64-bit float
SetString(size_t idx, const std::string& value)Set string value
SetBytes(size_t idx, const std::vector<uint8_t>& value)Set binary data
SetDate(size_t idx, const Date& value)Set date value
SetTime(size_t idx, const Time& value)Set time value
SetTimestampNtz(size_t idx, const Timestamp& value)Set timestamp without timezone
SetTimestampLtz(size_t idx, const Timestamp& value)Set timestamp with timezone
SetDecimal(size_t idx, const std::string& value)Set decimal from string

Name-Based Setters

When using table.NewRow(), the Set() method auto-routes to the correct type based on the schema:

MethodDescription
Set(const std::string& name, std::nullptr_t)Set field to null by column name
Set(const std::string& name, bool value)Set boolean by column name
Set(const std::string& name, int32_t value)Set integer by column name
Set(const std::string& name, int64_t value)Set big integer by column name
Set(const std::string& name, float value)Set float by column name
Set(const std::string& name, double value)Set double by column name
Set(const std::string& name, const std::string& value)Set string/decimal by column name
Set(const std::string& name, const Date& value)Set date by column name
Set(const std::string& name, const Time& value)Set time by column name
Set(const std::string& name, const Timestamp& value)Set timestamp by column name

RowView

Read-only row view for scan results. Provides zero-copy access to string and bytes data. RowView shares ownership of the underlying scan data via reference counting, so it can safely outlive the ScanRecords that produced it.

:::note string_view Lifetime GetString() returns std::string_view that borrows from the underlying data. The string_view is valid as long as any RowView (or ScanRecord) referencing the same poll result is alive. Copy to std::string if you need the value after all references are gone. :::

Index-Based Getters

MethodDescription
FieldCount() -> size_tGet the number of fields
GetType(size_t idx) -> TypeIdGet the type at index
IsNull(size_t idx) -> boolCheck if field is null
GetBool(size_t idx) -> boolGet boolean value at index
GetInt32(size_t idx) -> int32_tGet 32-bit integer at index
GetInt64(size_t idx) -> int64_tGet 64-bit integer at index
GetFloat32(size_t idx) -> floatGet 32-bit float at index
GetFloat64(size_t idx) -> doubleGet 64-bit float at index
GetString(size_t idx) -> std::string_viewGet string at index (zero-copy)
GetBytes(size_t idx) -> std::pair<const uint8_t*, size_t>Get binary data at index (zero-copy)
GetDate(size_t idx) -> DateGet date at index
GetTime(size_t idx) -> TimeGet time at index
GetTimestamp(size_t idx) -> TimestampGet timestamp at index
IsDecimal(size_t idx) -> boolCheck if field is a decimal type
GetDecimalString(size_t idx) -> std::stringGet decimal as string at index

Name-Based Getters

MethodDescription
IsNull(const std::string& name) -> boolCheck if field is null by name
GetBool(const std::string& name) -> boolGet boolean by column name
GetInt32(const std::string& name) -> int32_tGet 32-bit integer by column name
GetInt64(const std::string& name) -> int64_tGet 64-bit integer by column name
GetFloat32(const std::string& name) -> floatGet 32-bit float by column name
GetFloat64(const std::string& name) -> doubleGet 64-bit float by column name
GetString(const std::string& name) -> std::string_viewGet string by column name
GetBytes(const std::string& name) -> std::pair<const uint8_t*, size_t>Get binary data by column name
GetDate(const std::string& name) -> DateGet date by column name
GetTime(const std::string& name) -> TimeGet time by column name
GetTimestamp(const std::string& name) -> TimestampGet timestamp by column name
GetDecimalString(const std::string& name) -> std::stringGet decimal as string by column name

ScanRecord

ScanRecord is a value type that can be freely copied, stored, and accumulated across multiple Poll() calls. It shares ownership of the underlying scan data via reference counting.

FieldTypeDescription
offsetint64_tRecord offset in the log
timestampint64_tRecord timestamp
change_typeChangeTypeChange type (AppendOnly, Insert, UpdateBefore, UpdateAfter, Delete)
rowRowViewRow data (value type, shares ownership via reference counting)

ScanRecords

Flat Access

MethodDescription
Count() -> size_tTotal number of records across all buckets
IsEmpty() -> boolCheck if empty
begin() / end()Iterator support for range-based for loops

Flat iteration over all records (regardless of bucket):

for (const auto& rec : records) {
    std::cout << "offset=" << rec.offset << std::endl;
}

Per-Bucket Access

MethodDescription
BucketCount() -> size_tNumber of distinct buckets
Buckets() -> std::vector<TableBucket>List of distinct buckets
Records(const TableBucket& bucket) -> BucketRecordsRecords for a specific bucket (empty if bucket not present)
BucketAt(size_t idx) -> BucketRecordsRecords by bucket index (0-based, O(1))

BucketRecords

A bundle of scan records belonging to a single bucket. Obtained from ScanRecords::Records() or ScanRecords::BucketAt(). BucketRecords is a value type — it shares ownership of the underlying scan data via reference counting, so it can safely outlive the ScanRecords that produced it.

MethodDescription
Size() -> size_tNumber of records in this bucket
Empty() -> boolCheck if empty
Bucket() -> const TableBucket&Get the bucket
operator[](size_t idx) -> ScanRecordAccess record by index within this bucket
begin() / end()Iterator support for range-based for loops

TableBucket

Field / MethodDescription
table_id -> int64_tTable ID
bucket_id -> int32_tBucket ID
partition_id -> std::optional<int64_t>Partition ID (empty if non-partitioned)
operator==(const TableBucket&) -> boolEquality comparison

LookupResult

Read-only result for lookup operations. Provides zero-copy access to field values.

Metadata

MethodDescription
Found() -> boolWhether a matching row was found
FieldCount() -> size_tGet the number of fields

Index-Based Getters

MethodDescription
GetType(size_t idx) -> TypeIdGet the type at index
IsNull(size_t idx) -> boolCheck if field is null
GetBool(size_t idx) -> boolGet boolean value at index
GetInt32(size_t idx) -> int32_tGet 32-bit integer at index
GetInt64(size_t idx) -> int64_tGet 64-bit integer at index
GetFloat32(size_t idx) -> floatGet 32-bit float at index
GetFloat64(size_t idx) -> doubleGet 64-bit float at index
GetString(size_t idx) -> std::string_viewGet string at index (zero-copy)
GetBytes(size_t idx) -> std::pair<const uint8_t*, size_t>Get binary data at index (zero-copy)
GetDate(size_t idx) -> DateGet date at index
GetTime(size_t idx) -> TimeGet time at index
GetTimestamp(size_t idx) -> TimestampGet timestamp at index
IsDecimal(size_t idx) -> boolCheck if field is a decimal type
GetDecimalString(size_t idx) -> std::stringGet decimal as string at index

Name-Based Getters

MethodDescription
IsNull(const std::string& name) -> boolCheck if field is null by name
GetBool(const std::string& name) -> boolGet boolean by column name
GetInt32(const std::string& name) -> int32_tGet 32-bit integer by column name
GetInt64(const std::string& name) -> int64_tGet 64-bit integer by column name
GetFloat32(const std::string& name) -> floatGet 32-bit float by column name
GetFloat64(const std::string& name) -> doubleGet 64-bit float by column name
GetString(const std::string& name) -> std::string_viewGet string by column name
GetBytes(const std::string& name) -> std::pair<const uint8_t*, size_t>Get binary data by column name
GetDate(const std::string& name) -> DateGet date by column name
GetTime(const std::string& name) -> TimeGet time by column name
GetTimestamp(const std::string& name) -> TimestampGet timestamp by column name
GetDecimalString(const std::string& name) -> std::stringGet decimal as string by column name

ArrowRecordBatch

MethodDescription
GetArrowRecordBatch() -> std::shared_ptr<arrow::RecordBatch>Get the underlying Arrow RecordBatch
Available() -> boolCheck if the batch is valid
NumRows() -> int64_tNumber of rows in the batch
GetTableId() -> int64_tTable ID
GetPartitionId() -> int64_tPartition ID
GetBucketId() -> int32_tBucket ID
GetBaseOffset() -> int64_tFirst record offset
GetLastOffset() -> int64_tLast record offset

ArrowRecordBatches

MethodDescription
Size() -> size_tNumber of batches
Empty() -> boolCheck if empty
operator[](size_t idx)Access batch by index
begin() / end()Iterator support for range-based for loops

Schema

MethodDescription
NewBuilder() -> Schema::BuilderCreate a new schema builder

Schema::Builder

MethodDescription
AddColumn(const std::string& name, const DataType& type) -> Builder&Add a column
SetPrimaryKeys(const std::vector<std::string>& keys) -> Builder&Set primary key columns
Build() -> SchemaBuild the schema

TableDescriptor

MethodDescription
NewBuilder() -> TableDescriptor::BuilderCreate a new table descriptor builder

TableDescriptor::Builder

MethodDescription
SetSchema(const Schema& schema) -> Builder&Set the table schema
SetPartitionKeys(const std::vector<std::string>& keys) -> Builder&Set partition key columns
SetBucketCount(int32_t count) -> Builder&Set the number of buckets
SetBucketKeys(const std::vector<std::string>& keys) -> Builder&Set bucket key columns
SetProperty(const std::string& key, const std::string& value) -> Builder&Set a table property
SetCustomProperty(const std::string& key, const std::string& value) -> Builder&Set a custom property
SetComment(const std::string& comment) -> Builder&Set a table comment
Build() -> TableDescriptorBuild the table descriptor

DataType

Factory Methods

MethodDescription
DataType::Boolean()Boolean type
DataType::TinyInt()8-bit signed integer
DataType::SmallInt()16-bit signed integer
DataType::Int()32-bit signed integer
DataType::BigInt()64-bit signed integer
DataType::Float()32-bit floating point
DataType::Double()64-bit floating point
DataType::String()UTF-8 string
DataType::Bytes()Binary data
DataType::Date()Date (days since epoch)
DataType::Time()Time (milliseconds since midnight)
DataType::Timestamp(int precision)Timestamp without timezone
DataType::TimestampLtz(int precision)Timestamp with timezone
DataType::Decimal(int precision, int scale)Decimal with precision and scale

Accessors

MethodDescription
id() -> TypeIdGet the type ID
precision() -> intGet precision (for Decimal/Timestamp types)
scale() -> intGet scale (for Decimal type)

TablePath

Method / FieldDescription
TablePath(const std::string& database, const std::string& table)Create a table path
database_name -> std::stringDatabase name
table_name -> std::stringTable name
ToString() -> std::stringString representation

TableInfo

FieldTypeDescription
table_idint64_tTable ID
schema_idint32_tSchema ID
table_pathTablePathTable path
created_timeint64_tCreation timestamp
modified_timeint64_tLast modification timestamp
primary_keysstd::vector<std::string>Primary key columns
bucket_keysstd::vector<std::string>Bucket key columns
partition_keysstd::vector<std::string>Partition key columns
num_bucketsint32_tNumber of buckets
has_primary_keyboolWhether the table has a primary key
is_partitionedboolWhether the table is partitioned
propertiesstd::unordered_map<std::string, std::string>Table properties
custom_propertiesstd::unordered_map<std::string, std::string>Custom properties
commentstd::stringTable comment
schemaSchemaTable schema

Temporal Types

Date

MethodDescription
Date::FromDays(int32_t days)Create from days since epoch
Date::FromYMD(int year, int month, int day)Create from year, month, day
Year() -> intGet year
Month() -> intGet month
Day() -> intGet day

Time

MethodDescription
Time::FromMillis(int32_t millis)Create from milliseconds since midnight
Time::FromHMS(int hour, int minute, int second)Create from hour, minute, second
Hour() -> intGet hour
Minute() -> intGet minute
Second() -> intGet second
Millis() -> int64_tGet sub-second millisecond component (0-999)

Timestamp

MethodDescription
Timestamp::FromMillis(int64_t millis)Create from milliseconds since epoch
Timestamp::FromMillisNanos(int64_t millis, int32_t nanos)Create from milliseconds and nanoseconds
Timestamp::FromTimePoint(std::chrono::system_clock::time_point tp)Create from a time point

PartitionInfo

FieldTypeDescription
partition_idint64_tPartition ID
partition_namestd::stringPartition name

DatabaseDescriptor

FieldTypeDescription
commentstd::stringDatabase comment
propertiesstd::unordered_map<std::string, std::string>Custom properties

DatabaseInfo

FieldTypeDescription
database_namestd::stringDatabase name
commentstd::stringDatabase comment
propertiesstd::unordered_map<std::string, std::string>Custom properties
created_timeint64_tCreation timestamp
modified_timeint64_tLast modification timestamp

LakeSnapshot

FieldTypeDescription
snapshot_idint64_tSnapshot ID
bucket_offsetsstd::vector<BucketOffset>All bucket offsets

BucketOffset

FieldTypeDescription
table_idint64_tTable ID
partition_idint64_tPartition ID
bucket_idint32_tBucket ID
offsetint64_tOffset value

OffsetSpec

MethodDescription
OffsetSpec::Earliest()Query for the earliest available offset
OffsetSpec::Latest()Query for the latest offset
OffsetSpec::Timestamp(int64_t timestamp_ms)Query offset at a specific timestamp

Constants

ConstantValueDescription
fluss::EARLIEST_OFFSET-2Start reading from the earliest available offset

To start reading from the latest offset (only new records), resolve the current offset via ListOffsets before subscribing:

std::unordered_map<int32_t, int64_t> offsets;
admin.ListOffsets(table_path, {0}, fluss::OffsetSpec::Latest(), offsets);
scanner.Subscribe(0, offsets[0]);

Enums

ChangeType

ValueShort StringDescription
AppendOnly+AAppend-only record
Insert+IInserted row
UpdateBefore-UPrevious value of an updated row
UpdateAfter+UNew value of an updated row
Delete-DDeleted row

You may refer to the following example to convert ChangeType enum to its short string representation.

inline const char* ChangeTypeShortString(ChangeType ct) {
    switch (ct) {
        case ChangeType::AppendOnly: return "+A";
        case ChangeType::Insert: return "+I";
        case ChangeType::UpdateBefore: return "-U";
        case ChangeType::UpdateAfter: return "+U";
        case ChangeType::Delete: return "-D";
    }
    throw std::invalid_argument("Unknown ChangeType");
}

TypeId

ValueDescription
BooleanBoolean type
TinyInt8-bit signed integer
SmallInt16-bit signed integer
Int32-bit signed integer
BigInt64-bit signed integer
Float32-bit floating point
Double64-bit floating point
StringUTF-8 string
BytesBinary data
DateDate
TimeTime
TimestampTimestamp without timezone
TimestampLtzTimestamp with timezone
DecimalDecimal

ChangeType

ValueDescription
AppendOnlyAppend-only record (log tables)
InsertInserted row (PK tables)
UpdateBeforeRow value before an update (PK tables)
UpdateAfterRow value after an update (PK tables)
DeleteDeleted row (PK tables)

OffsetSpec

ValueDescription
EarliestEarliest available offset
LatestLatest offset
TimestampOffset at a specific timestamp