|
iceberg-cpp
|
Utility functions for working with snapshots. More...
#include <snapshot_util_internal.h>
Static Public Member Functions | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | AncestorsOf (const Table &table, int64_t snapshot_id) |
| Returns a vector of ancestors of the given snapshot. | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | AncestorsOf (const TableMetadata &metadata, int64_t snapshot_id) |
| Returns a vector of ancestors of the given snapshot. | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | AncestorsOf (int64_t snapshot_id, const std::function< Result< std::shared_ptr< Snapshot > >(int64_t)> &lookup) |
| Returns a vector of ancestors of the given snapshot. | |
| static Result< bool > | IsAncestorOf (const Table &table, int64_t ancestor_snapshot_id) |
| Returns whether ancestor_snapshot_id is an ancestor of the table's current state. | |
| static Result< bool > | IsAncestorOf (const TableMetadata &metadata, int64_t ancestor_snapshot_id) |
| Returns whether ancestor_snapshot_id is an ancestor of the metadata's current state. | |
| static Result< bool > | IsAncestorOf (const Table &table, int64_t snapshot_id, int64_t ancestor_snapshot_id) |
| Returns whether ancestor_snapshot_id is an ancestor of snapshot_id. | |
| static Result< bool > | IsAncestorOf (const TableMetadata &metadata, int64_t snapshot_id, int64_t ancestor_snapshot_id) |
| Returns whether ancestor_snapshot_id is an ancestor of snapshot_id. | |
| static Result< bool > | IsAncestorOf (int64_t snapshot_id, int64_t ancestor_snapshot_id, const std::function< Result< std::shared_ptr< Snapshot > >(int64_t)> &lookup) |
| Returns whether ancestor_snapshot_id is an ancestor of snapshot_id using the given lookup function. | |
| static Result< bool > | IsParentAncestorOf (const Table &table, int64_t snapshot_id, int64_t ancestor_parent_snapshot_id) |
| Returns whether some ancestor of snapshot_id has parentId matches ancestor_parent_snapshot_id. | |
| static Result< bool > | IsParentAncestorOf (const TableMetadata &metadata, int64_t snapshot_id, int64_t ancestor_parent_snapshot_id) |
| Returns whether some ancestor of snapshot_id has parentId matches ancestor_parent_snapshot_id. | |
| static Result< bool > | IsParentAncestorOf (int64_t snapshot_id, int64_t ancestor_parent_snapshot_id, const std::function< Result< std::shared_ptr< Snapshot > >(int64_t)> &lookup) |
| Returns whether some ancestor of snapshot_id has parentId matches ancestor_parent_snapshot_id. | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | CurrentAncestors (const Table &table) |
| Returns a vector that traverses the table's snapshots from the current to the last known ancestor. | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | CurrentAncestors (const TableMetadata &metadata) |
| Returns a vector that traverses the metadata's snapshots from the current to the last known ancestor. | |
| static Result< std::vector< int64_t > > | CurrentAncestorIds (const Table &table) |
| Returns the snapshot IDs for the ancestors of the current table state. | |
| static Result< std::optional< std::shared_ptr< Snapshot > > > | OldestAncestor (const Table &table) |
| Traverses the history of the table's current snapshot and finds the oldest Snapshot. | |
| static Result< std::optional< std::shared_ptr< Snapshot > > > | OldestAncestorOf (const Table &table, int64_t snapshot_id) |
| Traverses the history and finds the oldest ancestor of the specified snapshot. | |
| static Result< std::optional< std::shared_ptr< Snapshot > > > | OldestAncestorOf (const TableMetadata &metadata, int64_t snapshot_id) |
| Traverses the history and finds the oldest ancestor of the specified snapshot. | |
| static Result< std::optional< std::shared_ptr< Snapshot > > > | OldestAncestorAfter (const Table &table, TimePointMs timestamp_ms) |
| Traverses the history of the table's current snapshot, finds the oldest snapshot that was committed either at or after a given time. | |
| static Result< std::vector< int64_t > > | SnapshotIdsBetween (const Table &table, int64_t from_snapshot_id, int64_t to_snapshot_id) |
| Returns list of snapshot ids in the range (from_snapshot_id,to_snapshot_id]. | |
| static Result< std::vector< int64_t > > | AncestorIdsBetween (const Table &table, int64_t latest_snapshot_id, const std::optional< int64_t > &oldest_snapshot_id) |
| Returns a vector of ancestor IDs between two snapshots. | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | AncestorsBetween (const Table &table, int64_t latest_snapshot_id, std::optional< int64_t > oldest_snapshot_id) |
| Returns a vector of ancestors between two snapshots. | |
| static Result< std::vector< std::shared_ptr< Snapshot > > > | AncestorsBetween (const TableMetadata &metadata, int64_t latest_snapshot_id, std::optional< int64_t > oldest_snapshot_id) |
| Returns a vector of ancestors between two snapshots. | |
| static Result< std::shared_ptr< Snapshot > > | SnapshotAfter (const Table &table, int64_t snapshot_id) |
| Traverses the history of the table's current snapshot and finds the snapshot with the given snapshot id as its parent. | |
| static Result< int64_t > | SnapshotIdAsOfTime (const Table &table, TimePointMs timestamp_ms) |
| Returns the ID of the most recent snapshot for the table as of the timestamp. | |
| static Result< int64_t > | SnapshotIdAsOfTime (const TableMetadata &metadata, TimePointMs timestamp_ms) |
| Returns the ID of the most recent snapshot for the table as of the timestamp. | |
| static std::optional< int64_t > | OptionalSnapshotIdAsOfTime (const Table &table, TimePointMs timestamp_ms) |
| Returns the ID of the most recent snapshot for the table as of the timestamp, or nullopt if not found. | |
| static Result< std::shared_ptr< Schema > > | SchemaFor (const Table &table, int64_t snapshot_id) |
| Returns the schema of the table for the specified snapshot. | |
| static Result< std::shared_ptr< Schema > > | SchemaFor (const Table &table, TimePointMs timestamp_ms) |
| Returns the schema of the table for the specified timestamp. | |
| static Result< std::shared_ptr< Schema > > | SchemaFor (const Table &table, const std::string &ref) |
| Return the schema of the snapshot at a given ref. | |
| static Result< std::shared_ptr< Schema > > | SchemaFor (const TableMetadata &metadata, const std::string &ref) |
| Return the schema of the snapshot at a given ref. | |
| static Result< std::shared_ptr< Snapshot > > | LatestSnapshot (const Table &table, const std::string &branch) |
| Fetch the snapshot at the head of the given branch in the given table. | |
| static Result< std::shared_ptr< Snapshot > > | LatestSnapshot (const TableMetadata &metadata, const std::string &branch) |
| Fetch the snapshot at the head of the given branch in the given table. | |
| static Result< std::shared_ptr< Snapshot > > | OptionalLatestSnapshot (const TableMetadata &metadata, const std::string &branch) |
| Fetch the snapshot at the head of the given branch in the given table. | |
| static int64_t | GenerateSnapshotId () |
| Generate a new snapshot ID. | |
| static int64_t | GenerateSnapshotId (const TableMetadata &metadata) |
| Generate a new snapshot ID for the given metadata. | |
Utility functions for working with snapshots.
|
static |
Returns a vector of ancestor IDs between two snapshots.
| table | The table |
| latest_snapshot_id | The latest snapshot ID |
| oldest_snapshot_id | The oldest snapshot ID (optional, nullopt means all ancestors) |
|
static |
Returns a vector of ancestors between two snapshots.
| table | The table |
| latest_snapshot_id | The latest snapshot ID |
| oldest_snapshot_id | The oldest snapshot ID (optional, nullopt means all ancestors) |
|
static |
Returns a vector of ancestors between two snapshots.
| metadata | The table metadata |
| latest_snapshot_id | The latest snapshot ID |
| oldest_snapshot_id | The oldest snapshot ID (optional, nullopt means all ancestors) |
|
static |
Returns a vector of ancestors of the given snapshot.
| table | The table |
| snapshot_id | The snapshot ID to start from |
|
static |
Returns a vector of ancestors of the given snapshot.
| metadata | The table metadata |
| snapshot_id | The snapshot ID to start from |
|
static |
Returns a vector of ancestors of the given snapshot.
| snapshot_id | The snapshot ID to start from |
| lookup | A function to look up snapshots by ID |
|
static |
Returns the snapshot IDs for the ancestors of the current table state.
Ancestor IDs are ordered by commit time, descending. The first ID is the current snapshot, followed by its parent, and so on.
| table | The table |
|
static |
Returns a vector that traverses the table's snapshots from the current to the last known ancestor.
| table | The table |
|
static |
Returns a vector that traverses the metadata's snapshots from the current to the last known ancestor.
| metadata | The table metadata |
|
static |
Generate a new snapshot ID for the given metadata.
| metadata | The table metadata |
|
static |
Returns whether ancestor_snapshot_id is an ancestor of the table's current state.
| table | The table to check |
| ancestor_snapshot_id | The ancestor snapshot ID to check for |
|
static |
Returns whether ancestor_snapshot_id is an ancestor of snapshot_id.
| table | The table to check |
| snapshot_id | The snapshot ID to check |
| ancestor_snapshot_id | The ancestor snapshot ID to check for |
|
static |
Returns whether ancestor_snapshot_id is an ancestor of the metadata's current state.
| metadata | The table metadata to check |
| ancestor_snapshot_id | The ancestor snapshot ID to check for |
|
static |
Returns whether ancestor_snapshot_id is an ancestor of snapshot_id.
| metadata | The table metadata to check |
| snapshot_id | The snapshot ID to check |
| ancestor_snapshot_id | The ancestor snapshot ID to check for |
|
static |
Returns whether ancestor_snapshot_id is an ancestor of snapshot_id using the given lookup function.
| snapshot_id | The snapshot ID to check |
| ancestor_snapshot_id | The ancestor snapshot ID to check for |
| lookup | Function to lookup snapshots by ID |
|
static |
Returns whether some ancestor of snapshot_id has parentId matches ancestor_parent_snapshot_id.
| table | The table to check |
| snapshot_id | The snapshot ID to check |
| ancestor_parent_snapshot_id | The ancestor parent snapshot ID to check for |
|
static |
Returns whether some ancestor of snapshot_id has parentId matches ancestor_parent_snapshot_id.
| metadata | The table metadata to check |
| snapshot_id | The snapshot ID to check |
| ancestor_parent_snapshot_id | The ancestor parent snapshot ID to check for |
|
static |
Returns whether some ancestor of snapshot_id has parentId matches ancestor_parent_snapshot_id.
| snapshot_id | The snapshot ID to check |
| ancestor_parent_snapshot_id | The ancestor parent snapshot ID to check for |
| lookup | Function to lookup snapshots by ID |
|
static |
Fetch the snapshot at the head of the given branch in the given table.
This method calls TableMetadata::Snapshot() instead of using branch API for the main branch so that existing code still goes through the old code path to ensure backwards compatibility.
| table | The table |
| branch | Branch name of the table (empty string means main branch) |
|
static |
Fetch the snapshot at the head of the given branch in the given table.
This method calls TableMetadata::Snapshot() instead of using branch API for the main branch so that existing code still goes through the old code path to ensure backwards compatibility.
If branch does not exist, the table's latest snapshot is returned it will be the schema when the new branch is created.
| metadata | The table metadata |
| branch | Branch name of the table metadata (empty string means main branch) |
|
static |
Traverses the history of the table's current snapshot and finds the oldest Snapshot.
| table | The table |
|
static |
Traverses the history of the table's current snapshot, finds the oldest snapshot that was committed either at or after a given time.
| table | The table |
| timestamp_ms | A timestamp in milliseconds |
|
static |
Traverses the history and finds the oldest ancestor of the specified snapshot.
Oldest ancestor is defined as the ancestor snapshot whose parent is null or has been expired. If the specified snapshot has no parent or parent has been expired, the specified snapshot itself is returned.
| table | The table |
| snapshot_id | The ID of the snapshot to find the oldest ancestor |
|
static |
Traverses the history and finds the oldest ancestor of the specified snapshot.
Oldest ancestor is defined as the ancestor snapshot whose parent is null or has been expired. If the specified snapshot has no parent or parent has been expired, the specified snapshot itself is returned.
| metadata | The table metadata |
| snapshot_id | The ID of the snapshot to find the oldest ancestor |
|
static |
Fetch the snapshot at the head of the given branch in the given table.
Like LatestSnapshot above except that nullptr is returned if snapshot does not exist.
| metadata | The table metadata |
| branch | Branch name of the table metadata (empty string means main branch) |
|
static |
Returns the ID of the most recent snapshot for the table as of the timestamp, or nullopt if not found.
| table | The table |
| timestamp_ms | The timestamp in millis since the Unix epoch |
|
static |
Return the schema of the snapshot at a given ref.
If the ref does not exist or the ref is a branch, the table schema is returned because it will be the schema when the new branch is created. If the ref is a tag, then the snapshot schema is returned.
| table | The table |
| ref | Ref name of the table (empty string means main branch) |
|
static |
Returns the schema of the table for the specified snapshot.
| table | The table |
| snapshot_id | The ID of the snapshot |
|
static |
Returns the schema of the table for the specified timestamp.
| table | The table |
| timestamp_ms | The timestamp in millis since the Unix epoch |
|
static |
Return the schema of the snapshot at a given ref.
If the ref does not exist or the ref is a branch, the table schema is returned because it will be the schema when the new branch is created. If the ref is a tag, then the snapshot schema is returned.
| metadata | The table metadata |
| ref | Ref name of the table (empty string means main branch) |
|
static |
Traverses the history of the table's current snapshot and finds the snapshot with the given snapshot id as its parent.
| table | The table |
| snapshot_id | The parent snapshot ID |
|
static |
Returns the ID of the most recent snapshot for the table as of the timestamp.
| table | The table |
| timestamp_ms | The timestamp in millis since the Unix epoch |
|
static |
Returns the ID of the most recent snapshot for the table as of the timestamp.
| metadata | The table metadata |
| timestamp_ms | The timestamp in millis since the Unix epoch |
|
static |
Returns list of snapshot ids in the range (from_snapshot_id,to_snapshot_id].
This method assumes that from_snapshot_id is an ancestor of to_snapshot_id.
| table | The table |
| from_snapshot_id | The starting snapshot ID (exclusive) |
| to_snapshot_id | The ending snapshot ID (inclusive) |