iceberg-cpp
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
iceberg::SnapshotRef Struct Reference

A reference to a snapshot, either a branch or a tag. More...

#include <snapshot.h>

Classes

struct  Branch
 
struct  Tag
 

Public Member Functions

SnapshotRefType type () const noexcept
 
std::optional< int64_t > max_ref_age_ms () const noexcept
 
std::unique_ptr< SnapshotRefClone (std::optional< int64_t > new_snapshot_id=std::nullopt) const
 Clone this SnapshotRef with an optional new snapshot ID.
 
Status Validate () const
 Validate the SnapshotRef.
 

Static Public Member Functions

static Result< std::unique_ptr< SnapshotRef > > MakeBranch (int64_t snapshot_id, std::optional< int32_t > min_snapshots_to_keep=std::nullopt, std::optional< int64_t > max_snapshot_age_ms=std::nullopt, std::optional< int64_t > max_ref_age_ms=std::nullopt)
 Create a branch reference.
 
static Result< std::unique_ptr< SnapshotRef > > MakeTag (int64_t snapshot_id, std::optional< int64_t > max_ref_age_ms=std::nullopt)
 Create a tag reference.
 

Public Attributes

int64_t snapshot_id
 A reference's snapshot ID. The tagged snapshot or latest snapshot of a branch.
 
std::variant< Branch, Tagretention
 Snapshot retention policy.
 

Static Public Attributes

static constexpr std::string_view kMainBranch = "main"
 

Friends

bool operator== (const SnapshotRef &lhs, const SnapshotRef &rhs)
 Compare two snapshot refs for equality.
 

Detailed Description

A reference to a snapshot, either a branch or a tag.

Member Function Documentation

◆ Clone()

std::unique_ptr< SnapshotRef > iceberg::SnapshotRef::Clone ( std::optional< int64_t >  new_snapshot_id = std::nullopt) const

Clone this SnapshotRef with an optional new snapshot ID.

Parameters
new_snapshot_idOptional new snapshot ID. If not provided, uses the current snapshot_id
Returns
A unique_ptr to the cloned SnapshotRef

◆ MakeBranch()

Result< std::unique_ptr< SnapshotRef > > iceberg::SnapshotRef::MakeBranch ( int64_t  snapshot_id,
std::optional< int32_t >  min_snapshots_to_keep = std::nullopt,
std::optional< int64_t >  max_snapshot_age_ms = std::nullopt,
std::optional< int64_t >  max_ref_age_ms = std::nullopt 
)
static

Create a branch reference.

Parameters
snapshot_idThe snapshot ID for the branch
min_snapshots_to_keepOptional minimum number of snapshots to keep
max_snapshot_age_msOptional maximum snapshot age in milliseconds
max_ref_age_msOptional maximum reference age in milliseconds
Returns
A Result containing a unique_ptr to the SnapshotRef, or an error if validation failed

◆ MakeTag()

Result< std::unique_ptr< SnapshotRef > > iceberg::SnapshotRef::MakeTag ( int64_t  snapshot_id,
std::optional< int64_t >  max_ref_age_ms = std::nullopt 
)
static

Create a tag reference.

Parameters
snapshot_idThe snapshot ID for the tag
max_ref_age_msOptional maximum reference age in milliseconds
Returns
A Result containing a unique_ptr to the SnapshotRef, or an error if validation failed

The documentation for this struct was generated from the following files: