|
iceberg-cpp
|
Updates snapshot references. More...
#include <update_snapshot_reference.h>
Classes | |
| struct | ApplyResult |
Public Member Functions | |
| UpdateSnapshotReference & | CreateBranch (const std::string &name, int64_t snapshot_id) |
| Create a branch reference. | |
| UpdateSnapshotReference & | CreateTag (const std::string &name, int64_t snapshot_id) |
| Create a tag reference. | |
| UpdateSnapshotReference & | RemoveBranch (const std::string &name) |
| Remove a branch reference. | |
| UpdateSnapshotReference & | RemoveTag (const std::string &name) |
| Remove a tag reference. | |
| UpdateSnapshotReference & | RenameBranch (const std::string &name, const std::string &new_name) |
| Rename a branch reference. | |
| UpdateSnapshotReference & | ReplaceBranch (const std::string &name, int64_t snapshot_id) |
| Replace a branch reference with a new snapshot ID. | |
| UpdateSnapshotReference & | ReplaceBranch (const std::string &from, const std::string &to) |
| Replace a branch reference with another reference's snapshot ID. | |
| UpdateSnapshotReference & | FastForward (const std::string &from, const std::string &to) |
| Fast-forward a branch to another reference's snapshot ID. | |
| UpdateSnapshotReference & | ReplaceTag (const std::string &name, int64_t snapshot_id) |
| Replace a tag reference with a new snapshot ID. | |
| UpdateSnapshotReference & | SetMinSnapshotsToKeep (const std::string &name, int32_t min_snapshots_to_keep) |
| Set the minimum number of snapshots to keep for a branch. | |
| UpdateSnapshotReference & | SetMaxSnapshotAgeMs (const std::string &name, int64_t max_snapshot_age_ms) |
| Set the maximum snapshot age in milliseconds for a branch. | |
| UpdateSnapshotReference & | SetMaxRefAgeMs (const std::string &name, int64_t max_ref_age_ms) |
| Set the maximum reference age in milliseconds. | |
| Kind | kind () const final |
| Return the kind of this pending update. | |
| bool | IsRetryable () const override |
| Snapshot reference updates are not retryable. | |
| Result< ApplyResult > | Apply () |
| Apply the pending changes and return the updated and removed references. | |
Public Member Functions inherited from iceberg::PendingUpdate | |
| virtual Status | Commit () |
| Apply the pending changes and commit. | |
| virtual Status | Finalize (Result< const TableMetadata * > commit_result) |
| Finalize the pending update. | |
| PendingUpdate (const PendingUpdate &)=delete | |
| PendingUpdate & | operator= (const PendingUpdate &)=delete |
| PendingUpdate (PendingUpdate &&) noexcept=default | |
| PendingUpdate & | operator= (PendingUpdate &&) noexcept=default |
Public Member Functions inherited from iceberg::ErrorCollector | |
| ErrorCollector (ErrorCollector &&)=default | |
| ErrorCollector & | operator= (ErrorCollector &&)=default |
| ErrorCollector (const ErrorCollector &)=default | |
| ErrorCollector & | operator= (const ErrorCollector &)=default |
| template<typename... Args> | |
| auto & | AddError (this auto &self, ErrorKind kind, const std::format_string< Args... > fmt, Args &&... args) |
| Add a specific error and return reference to derived class. | |
| auto & | AddError (this auto &self, Error err) |
| Add an existing error object and return reference to derived class. | |
| auto & | AddError (this auto &self, std::unexpected< Error > err) |
| Add an unexpected result's error and return reference to derived class. | |
| bool | has_errors () const |
| Check if any errors have been collected. | |
| size_t | error_count () const |
| Get the number of errors collected. | |
| Status | CheckErrors () const |
| Check for accumulated errors and return them if any exist. | |
| void | ClearErrors () |
| Clear all accumulated errors. | |
| const std::vector< Error > & | errors () const |
| Get read-only access to all collected errors. | |
Static Public Member Functions | |
| static Result< std::shared_ptr< UpdateSnapshotReference > > | Make (std::shared_ptr< TransactionContext > ctx) |
Additional Inherited Members | |
Public Types inherited from iceberg::PendingUpdate | |
| enum class | Kind : uint8_t { kExpireSnapshots , kSetSnapshot , kUpdateLocation , kUpdatePartitionSpec , kUpdatePartitionStatistics , kUpdateProperties , kUpdateSchema , kUpdateSnapshot , kUpdateSnapshotReference , kUpdateSortOrder , kUpdateStatistics } |
Protected Member Functions inherited from iceberg::PendingUpdate | |
| PendingUpdate (std::shared_ptr< TransactionContext > ctx) | |
| const TableMetadata & | base () const |
Protected Attributes inherited from iceberg::PendingUpdate | |
| std::shared_ptr< TransactionContext > | ctx_ |
Protected Attributes inherited from iceberg::ErrorCollector | |
| std::vector< Error > | errors_ |
Updates snapshot references.
TODO(xxx): Add SetSnapshot operations such as SetCurrentSnapshot, RollBackTime, RollbackTo to this class so that we can support those operations for refs.
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::CreateBranch | ( | const std::string & | name, |
| int64_t | snapshot_id | ||
| ) |
Create a branch reference.
| name | The branch name |
| snapshot_id | The snapshot ID for the branch |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::CreateTag | ( | const std::string & | name, |
| int64_t | snapshot_id | ||
| ) |
Create a tag reference.
| name | The tag name |
| snapshot_id | The snapshot ID for the tag |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::FastForward | ( | const std::string & | from, |
| const std::string & | to | ||
| ) |
Fast-forward a branch to another reference's snapshot ID.
This is similar to ReplaceBranch but validates that the target snapshot is an ancestor of the current branch snapshot.
| from | The branch name to update |
| to | The reference name to copy the snapshot ID from |
|
inlineoverridevirtual |
Snapshot reference updates are not retryable.
The update snapshots the ref map at construction time and validates rename or fast-forward operations against that captured state. Replaying after a refresh can clobber or reinterpret concurrent ref changes.
Implements iceberg::PendingUpdate.
|
inlinefinalvirtual |
Return the kind of this pending update.
Implements iceberg::PendingUpdate.
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::RemoveBranch | ( | const std::string & | name | ) |
Remove a branch reference.
| name | The branch name to remove |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::RemoveTag | ( | const std::string & | name | ) |
Remove a tag reference.
| name | The tag name to remove |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::RenameBranch | ( | const std::string & | name, |
| const std::string & | new_name | ||
| ) |
Rename a branch reference.
| name | The current branch name |
| new_name | The new branch name |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::ReplaceBranch | ( | const std::string & | from, |
| const std::string & | to | ||
| ) |
Replace a branch reference with another reference's snapshot ID.
| from | The branch name to update |
| to | The reference name to copy the snapshot ID from |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::ReplaceBranch | ( | const std::string & | name, |
| int64_t | snapshot_id | ||
| ) |
Replace a branch reference with a new snapshot ID.
| name | The branch name |
| snapshot_id | The new snapshot ID |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::ReplaceTag | ( | const std::string & | name, |
| int64_t | snapshot_id | ||
| ) |
Replace a tag reference with a new snapshot ID.
| name | The tag name |
| snapshot_id | The new snapshot ID |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::SetMaxRefAgeMs | ( | const std::string & | name, |
| int64_t | max_ref_age_ms | ||
| ) |
Set the maximum reference age in milliseconds.
| name | The reference name |
| max_ref_age_ms | The maximum reference age in milliseconds |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::SetMaxSnapshotAgeMs | ( | const std::string & | name, |
| int64_t | max_snapshot_age_ms | ||
| ) |
Set the maximum snapshot age in milliseconds for a branch.
| name | The branch name |
| max_snapshot_age_ms | The maximum snapshot age in milliseconds |
| UpdateSnapshotReference & iceberg::UpdateSnapshotReference::SetMinSnapshotsToKeep | ( | const std::string & | name, |
| int32_t | min_snapshots_to_keep | ||
| ) |
Set the minimum number of snapshots to keep for a branch.
| name | The branch name |
| min_snapshots_to_keep | The minimum number of snapshots to keep |