Inline DEFAULT_SNAPSHOT_VERSION constant string (#22487)
This commit is contained in:
parent
1632ee03da
commit
b82d71d22a
|
@ -49,7 +49,6 @@ pub const DEFAULT_INCREMENTAL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS: Slot = 100;
|
||||||
const MAX_SNAPSHOT_DATA_FILE_SIZE: u64 = 32 * 1024 * 1024 * 1024; // 32 GiB
|
const MAX_SNAPSHOT_DATA_FILE_SIZE: u64 = 32 * 1024 * 1024 * 1024; // 32 GiB
|
||||||
const MAX_SNAPSHOT_VERSION_FILE_SIZE: u64 = 8; // byte
|
const MAX_SNAPSHOT_VERSION_FILE_SIZE: u64 = 8; // byte
|
||||||
const VERSION_STRING_V1_2_0: &str = "1.2.0";
|
const VERSION_STRING_V1_2_0: &str = "1.2.0";
|
||||||
const DEFAULT_SNAPSHOT_VERSION: SnapshotVersion = SnapshotVersion::V1_2_0;
|
|
||||||
pub(crate) const TMP_BANK_SNAPSHOT_PREFIX: &str = "tmp-bank-snapshot-";
|
pub(crate) const TMP_BANK_SNAPSHOT_PREFIX: &str = "tmp-bank-snapshot-";
|
||||||
pub const TMP_SNAPSHOT_ARCHIVE_PREFIX: &str = "tmp-snapshot-archive-";
|
pub const TMP_SNAPSHOT_ARCHIVE_PREFIX: &str = "tmp-snapshot-archive-";
|
||||||
pub const MAX_BANK_SNAPSHOTS_TO_RETAIN: usize = 8; // Save some bank snapshots but not too many
|
pub const MAX_BANK_SNAPSHOTS_TO_RETAIN: usize = 8; // Save some bank snapshots but not too many
|
||||||
|
@ -65,7 +64,7 @@ pub enum SnapshotVersion {
|
||||||
|
|
||||||
impl Default for SnapshotVersion {
|
impl Default for SnapshotVersion {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
DEFAULT_SNAPSHOT_VERSION
|
SnapshotVersion::V1_2_0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2018,7 +2017,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_snapshot_version_from_file_under_limit() {
|
fn test_snapshot_version_from_file_under_limit() {
|
||||||
let file_content = format!("v{}", DEFAULT_SNAPSHOT_VERSION);
|
let file_content = SnapshotVersion::default().as_str();
|
||||||
let mut file = NamedTempFile::new().unwrap();
|
let mut file = NamedTempFile::new().unwrap();
|
||||||
file.write_all(file_content.as_bytes()).unwrap();
|
file.write_all(file_content.as_bytes()).unwrap();
|
||||||
let version_from_file = snapshot_version_from_file(file.path()).unwrap();
|
let version_from_file = snapshot_version_from_file(file.path()).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue