Repository: qdrant/qdrant
File: lib/collection/src/shards/transfer/driver.rs (Rust)

Code before:
    // Initiate shard on a remote peer
    let remote_shard = RemoteShard::new(
        remote_shard_id,
        collection_id.clone(),
        transfer_config.to,
        channel_service.clone(),
    );

    // Prepare the remote for receiving the shard, waits for the correct state on the remote
    remote_shard.initiate_transfer().await?;

    match transfer_config.method.unwrap_or_default() {
        // Transfer shard record in batches
        ShardTransferMethod::StreamRecords => {
            transfer_stream_records(
                shard_holder.clone(),
                progress,
                local_shard_id,
                remote_shard,
                &collection_id,
                None,
            )
            .await?;
        }

        ShardTransferMethod::FilteredStreamRecords => {
            transfer_stream_records(
                shard_holder.clone(),
                progress,
                local_shard_id,
                remote_shard,
                &collection_id,
                transfer_config.filter,
            )
            .await?;
        }

        // Transfer shard record in batches for resharding
        ShardTransferMethod::ReshardingStreamRecords => {
            transfer_resharding_stream_records(
                shard_holder.clone(),
                progress,
                local_shard_id,
                remote_shard,
                &collection_id,
            )
            .await?;
        }

        // Transfer shard as snapshot
        ShardTransferMethod::Snapshot => {

Review comment (suggestion):
it doesn't seem like having a special `ShardTransferMethod` is justified here, since the only different thing is presence of filter

Code after:
    // Initiate shard on a remote peer
    let remote_shard = RemoteShard::new(
        remote_shard_id,
        collection_id.clone(),
        transfer_config.to,
        channel_service.clone(),
    );

    // Prepare the remote for receiving the shard, waits for the correct state on the remote
    remote_shard.initiate_transfer().await?;

    match transfer_config.method.unwrap_or_default() {
        // Transfer shard record in batches
        ShardTransferMethod::StreamRecords => {
            transfer_stream_records(
                shard_holder.clone(),
                progress,
                local_shard_id,
                remote_shard,
                &collection_id,
                transfer_config.filter,
            )
            .await?;
        }

        // Transfer shard record in batches for resharding
        ShardTransferMethod::ReshardingStreamRecords => {
            transfer_resharding_stream_records(
                shard_holder.clone(),
                progress,
                local_shard_id,
                remote_shard,
                &collection_id,
            )
            .await?;
        }

        // Transfer shard as snapshot
        ShardTransferMethod::Snapshot => {
            transfer_snapshot(
                transfer_config,
                shard_holder,
                progress,
                local_shard_id,
                remote_shard,
                &channel_service,
                consensus,
                snapshots_path,
                &collection_id,
                temp_dir,
            )