diff options
author | Trinity Pointard <trinity.pointard@gmail.com> | 2021-03-26 21:53:28 +0100 |
---|---|---|
committer | Trinity Pointard <trinity.pointard@gmail.com> | 2021-04-06 05:26:48 +0200 |
commit | 92d54770bbdc2f1a64eb60ab899ca559244c0f48 (patch) | |
tree | 6fd0339f8d7f651553145a3c29decc56e29c23bd /src/model/version_table.rs | |
parent | 30bec0758b943351d946234329b9a46bd83749a1 (diff) | |
download | garage-92d54770bbdc2f1a64eb60ab899ca559244c0f48.tar.gz garage-92d54770bbdc2f1a64eb60ab899ca559244c0f48.zip |
attempt at documenting model crate
Diffstat (limited to 'src/model/version_table.rs')
-rw-r--r-- | src/model/version_table.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/model/version_table.rs b/src/model/version_table.rs index fabd1fb1..428fac10 100644 --- a/src/model/version_table.rs +++ b/src/model/version_table.rs @@ -10,21 +10,27 @@ use garage_table::*; use crate::block_ref_table::*; +/// A version of an object #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] pub struct Version { - // Primary key + /// UUID of the version pub uuid: UUID, // Actual data: the blocks for this version // In the case of a multipart upload, also store the etags // of individual parts and check them when doing CompleteMultipartUpload + /// Is this version deleted pub deleted: crdt::Bool, + /// list of blocks of data composing the version pub blocks: crdt::Map<VersionBlockKey, VersionBlock>, + /// Etag of each part in case of a multipart upload, empty otherwise pub parts_etags: crdt::Map<u64, String>, // Back link to bucket+key so that we can figure if // this was deleted later on + /// Bucket in which the related object is stored pub bucket: String, + /// Key in which the related object is stored pub key: String, } @@ -43,7 +49,9 @@ impl Version { #[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)] pub struct VersionBlockKey { + /// Number of the part, starting at 1 pub part_number: u64, + /// offset of the block in the file, starting at 0 pub offset: u64, } @@ -61,9 +69,12 @@ impl PartialOrd for VersionBlockKey { } } +/// Informations about a single block #[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Copy, Debug, Serialize, Deserialize)] pub struct VersionBlock { + /// Hash of the block pub hash: Hash, + /// Size of the block pub size: u64, } |