Repository: tikv/tikv
File: components/backup-stream/src/router.rs (Rust)

Code before:
        self.min_ts = self
            .min_ts
            .map_or(Some(file.min_ts), |ts| Some(ts.min(file.min_ts)));
        self.max_ts = self
            .max_ts
            .map_or(Some(file.max_ts), |ts| Some(ts.max(file.max_ts)));
        self.file_groups.push(file);
    }

    fn marshal_to(self) -> Result<Vec<u8>> {
        let mut metadata = Metadata::new();
        metadata.set_file_groups(self.file_groups.into());
        metadata.set_store_id(self.store_id as _);
        metadata.set_resolved_ts(self.min_resolved_ts.unwrap_or_default());
        metadata.set_min_ts(self.min_ts.unwrap_or(0));
        metadata.set_max_ts(self.max_ts.unwrap_or(0));
        metadata.set_meta_version(MetaVersion::V2);

        metadata
            .write_to_bytes()
            .map_err(|err| Error::Other(box_err!("failed to marshal proto: {}", err)))
    }

    fn path_to_meta(&self, min_begin_ts: u64, mut flush_ts: u64) -> String {
        // It is possible flush_ts be set to zero when PD is unavailable.
        // In this scenario, a "tso" from local clock will be synthesised.
        // A special suffix need to be appended to avoid file name collision.
        let suffix = if flush_ts == 0 {
            flush_ts = TimeStamp::compose(TimeStamp::physical_now(), 0).into_inner();
            let uuid = Uuid::new_v4().as_u128();
            format!("-SYNTHETIC{:X}", uuid)
        } else {
            String::new()
        };
        format!(
            "v1/backupmeta/{:016X}-{:016X}-{:016X}-{:016X}{}.meta",
            flush_ts,
            min_begin_ts,
            self.min_ts.unwrap_or_default(),
            self.max_ts.unwrap_or_default(),
            suffix
        )
    }
}

impl DataFile {
    /// create and open a logfile at the path.
    /// Note: if a file with same name exists, would truncate it.
    fn new(local_path: impl AsRef<Path>, files: &Arc<TempFilePool>) -> Result<Self> {
        let sha256 = Hasher::new(MessageDigest::sha256())
            .map_err(|err| Error::Other(box_err!("openssl hasher failed to init: {}", err)))?;

Review comment (suggestion):
Spelling inconsistency: "synthesised" should be "synthesized" to maintain consistent American English spelling throughout the codebase.
```suggestion
        // In this scenario, a "tso" from local clock will be synthesized.
```

Code after:
        self.max_ts = self
            .max_ts
            .map_or(Some(file.max_ts), |ts| Some(ts.max(file.max_ts)));
        self.file_groups.push(file);
    }

    fn marshal_to(self) -> Result<Vec<u8>> {
        let mut metadata = Metadata::new();
        metadata.set_file_groups(self.file_groups.into());
        metadata.set_store_id(self.store_id as _);
        metadata.set_resolved_ts(self.min_resolved_ts.unwrap_or_default());
        metadata.set_min_ts(self.min_ts.unwrap_or(0));
        metadata.set_max_ts(self.max_ts.unwrap_or(0));
        metadata.set_meta_version(MetaVersion::V2);

        metadata
            .write_to_bytes()
            .map_err(|err| Error::Other(box_err!("failed to marshal proto: {}", err)))
    }

    fn path_to_meta(&self, min_begin_ts: u64, flush_ts: u64) -> String {
        // It is possible for flush_ts to be set to zero when PD is unavailable.
        // In this scenario, a "tso" from the local clock will be synthesized.
        // A special suffix needs to be appended to avoid file name collision.
        let mut actual_flush_ts = flush_ts;
        let suffix = if flush_ts == 0 {
            actual_flush_ts = TimeStamp::compose(TimeStamp::physical_now(), 0).into_inner();
            let uuid = Uuid::new_v4().as_u128();
            format!("-SYNTHETIC{:X}", uuid)
        } else {
            String::new()
        };
        format!(
            "v1/backupmeta/{:016X}-{:016X}-{:016X}-{:016X}{}.meta",
            actual_flush_ts,
            min_begin_ts,
            self.min_ts.unwrap_or_default(),
            self.max_ts.unwrap_or_default(),
            suffix
        )
    }
}

impl DataFile {
    /// create and open a logfile at the path.
    /// Note: if a file with same name exists, would truncate it.
    fn new(local_path: impl AsRef<Path>, files: &Arc<TempFilePool>) -> Result<Self> {
        let sha256 = Hasher::new(MessageDigest::sha256())
            .map_err(|err| Error::Other(box_err!("openssl hasher failed to init: {}", err)))?;
        let inner = files.open_for_write(local_path.as_ref())?;
        Ok(Self {