65 const std::function<
Result<std::shared_ptr<Snapshot>>(int64_t)>& lookup);
82 int64_t ancestor_snapshot_id);
91 int64_t ancestor_snapshot_id);
100 int64_t ancestor_snapshot_id);
110 int64_t snapshot_id, int64_t ancestor_snapshot_id,
111 const std::function<
Result<std::shared_ptr<Snapshot>>(int64_t)>& lookup);
121 int64_t ancestor_parent_snapshot_id);
132 int64_t ancestor_parent_snapshot_id);
142 int64_t snapshot_id, int64_t ancestor_parent_snapshot_id,
143 const std::function<
Result<std::shared_ptr<Snapshot>>(int64_t)>& lookup);
190 const Table& table, int64_t snapshot_id);
225 int64_t from_snapshot_id,
226 int64_t to_snapshot_id);
236 const Table& table, int64_t latest_snapshot_id,
237 const std::optional<int64_t>& oldest_snapshot_id);
247 const Table& table, int64_t latest_snapshot_id,
248 std::optional<int64_t> oldest_snapshot_id);
259 std::optional<int64_t> oldest_snapshot_id);
268 int64_t snapshot_id);
300 int64_t snapshot_id);
320 const std::string& ref);
332 const std::string& ref);
344 const std::string& branch);
360 const std::string& branch);
390 const TableMetadata& metadata,
const std::shared_ptr<Snapshot>& snapshot);
398 const std::shared_ptr<Snapshot>& snapshot,
399 const std::function<
Result<std::shared_ptr<Snapshot>>(int64_t)>& lookup);
406 const std::vector<std::shared_ptr<Snapshot>>& snapshots);
Utility functions for working with snapshots.
Definition snapshot_util.h:40
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::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::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::shared_ptr< Schema > > SchemaFor(const Table &table, int64_t snapshot_id)
Returns the schema of the table for the specified 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(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< 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 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::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 > > > 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< 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< 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 ...
static int64_t GenerateSnapshotId(const TableMetadata &metadata)
Generate a new snapshot ID for the given metadata.
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 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::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< 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< std::shared_ptr< Schema > > SchemaFor(const Table &table, TimePointMs timestamp_ms)
Returns the schema of the table for the specified timestamp.
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< 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< 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 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::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::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 int64_t GenerateSnapshotId()
Generate a new snapshot ID.
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 > > > OldestAncestorAfter(const Table &table, TimePointMs timestamp_ms)
Traverses the history of the table's current snapshot, finds the oldest snapshot that was committed e...
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::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< 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< 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< 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< 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< 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.
Represents an Iceberg table.
Definition table.h:45
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > TimePointMs
A time point in milliseconds.
Definition timepoint.h:33
Define Result, Status, and error helpers.
Provide time point conversion helpers.