summaryrefslogtreecommitdiff
path: root/src/dbgen.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-05-03 09:38:34 +0300
committerLars Wirzenius <liw@liw.fi>2022-05-03 09:59:07 +0300
commitaad50a0827b5c74229153395f01e0eafdd64edf6 (patch)
treeb8665053f47f25f3d6864c409a3bda85146704d1 /src/dbgen.rs
parent0b6adba069cd1300079c822b14832d690595cfb4 (diff)
downloadobnam2-aad50a0827b5c74229153395f01e0eafdd64edf6.tar.gz
refactor: add a type for plain integers we store in a database
This will make it easier to change later, if need be. We may want to do that for various reasons, such as to save space. We may also want to change things to only use integer types that SQLite can handle: u64 is currently not well handled by our database layer. However, as this is a refactor, there's no change or fix to that. FileId is now explicitly a database integer. This doesn't break anything, for now, as the underlying integer type is still u64. Also, change a couple of places where it will matter if DbInt changes away from u64, and disable warnings for harmless conversions that may cause warnings depending on what type DbInt has. Sponsored-by: author
Diffstat (limited to 'src/dbgen.rs')
-rw-r--r--src/dbgen.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dbgen.rs b/src/dbgen.rs
index 8e5ece5..0053d4a 100644
--- a/src/dbgen.rs
+++ b/src/dbgen.rs
@@ -2,7 +2,7 @@
use crate::backup_reason::Reason;
use crate::chunkid::ChunkId;
-use crate::db::{Column, Database, DatabaseError, SqlResults, Table, Value};
+use crate::db::{Column, Database, DatabaseError, DbInt, SqlResults, Table, Value};
use crate::fsentry::FilesystemEntry;
use crate::genmeta::{GenerationMeta, GenerationMetaError};
use crate::label::LabelChecksumKind;
@@ -28,8 +28,8 @@ pub const DEFAULT_SCHEMA_MAJOR: VersionComponent = V0_0::MAJOR;
/// Major schema versions supported by this version of Obnam.
pub const SCHEMA_MAJORS: &[VersionComponent] = &[0, 1];
-/// An identifier for a file in a generation.
-pub type FileId = u64;
+/// An integer identifier for a file in a generation.
+pub type FileId = DbInt;
/// Possible errors from using generation databases.
#[derive(Debug, thiserror::Error)]