Skip to main content

CheckpointSynchronizer

Trait CheckpointSynchronizer 

Source
pub trait CheckpointSynchronizer: Sync {
    // Required methods
    fn push(
        &self,
        checkpoint: Uuid,
        storage: Arc<dyn StorageBackend>,
        remote_config: SyncConfig,
        host_info: Option<HostInfo>,
        pipeline: PipelineIdentity,
    ) -> Result<Option<CheckpointSyncMetrics>>;
    fn pull(
        &self,
        storage: Arc<dyn StorageBackend>,
        remote_config: SyncConfig,
        host_info: Option<HostInfo>,
        standby: bool,
        pipeline: PipelineIdentity,
    ) -> Result<(CheckpointMetadata, Option<CheckpointSyncMetrics>)>;
    fn list_remote(
        &self,
        remote_config: SyncConfig,
    ) -> Result<Vec<RemoteCheckpoint>>;

    // Provided method
    fn take_ownership(
        &self,
        _storage: Arc<dyn StorageBackend>,
        _remote_config: SyncConfig,
        _pipeline: PipelineIdentity,
    ) -> Result<()> { ... }
}

Required Methods§

Source

fn push( &self, checkpoint: Uuid, storage: Arc<dyn StorageBackend>, remote_config: SyncConfig, host_info: Option<HostInfo>, pipeline: PipelineIdentity, ) -> Result<Option<CheckpointSyncMetrics>>

Push a checkpoint to remote object storage.

host_info identifies the calling host within a multihost pipeline. When Some, the checkpoint zip and catalog are written under host{N}/ in the remote bucket; when None (solo pipeline), the existing flat layout is used for backward compatibility.

pipeline identifies the pipeline performing the push and is used to enforce bucket ownership: the push fails before writing any data if the bucket is already owned by a different pipeline.

Source

fn pull( &self, storage: Arc<dyn StorageBackend>, remote_config: SyncConfig, host_info: Option<HostInfo>, standby: bool, pipeline: PipelineIdentity, ) -> Result<(CheckpointMetadata, Option<CheckpointSyncMetrics>)>

Pull a checkpoint from remote object storage.

host_info scopes the pull to the correct host{N}/ subdirectory. Pass None for solo pipelines to use the existing flat layout.

standby indicates that the pipeline is in standby mode: the local-storage cache is bypassed (always pull from remote) and a missing remote checkpoint is treated as an error rather than a fresh start.

pipeline identifies the pipeline performing the pull. It is used only to warn (never fail) when pulling from a bucket owned by a different pipeline.

Source

fn list_remote( &self, remote_config: SyncConfig, ) -> Result<Vec<RemoteCheckpoint>>

List checkpoints available in remote object storage.

Provided Methods§

Source

fn take_ownership( &self, _storage: Arc<dyn StorageBackend>, _remote_config: SyncConfig, _pipeline: PipelineIdentity, ) -> Result<()>

Takes ownership of the remote bucket for pipeline as it starts.

Called once per run, before the pipeline starts processing, when remote_config.take_bucket_ownership is set. Claims an unowned bucket, refreshes the ownership of a bucket pipeline already owns, and takes over a bucket owned by a different pipeline, logging a warning that names the previous and new owners. Self::push never takes ownership, so if another pipeline takes the bucket over later in this run, the next push fails.

Every host of a multihost pipeline calls this as it starts. The hosts share pipeline, so their concurrent writes agree, and a write by another host of the same pipeline counts as success.

The default implementation fails, reporting take_bucket_ownership as unsupported. It keeps this method optional, so that a synchronizer that predates it still compiles: the enterprise synchronizer is built from a separate repository, which may lag behind this trait, and a runtime version override builds a newer runtime against an older platform’s synchronizer.

§Arguments
  • storage: local storage, used to stage the ownership file.
  • remote_config: sync settings; bucket is the location to take.
  • pipeline: identity of the pipeline taking ownership.
§Returns

Ok(()) once the bucket’s ownership file names pipeline; an error if it could not be written, a different pipeline overwrote it at the same moment, or the synchronizer does not support taking ownership.

Trait Implementations§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§