all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/3] use derive 'Default' for ChunkOrder
Date: Mon, 28 Nov 2022 14:26:40 +0100	[thread overview]
Message-ID: <20221128132641.3458244-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20221128132641.3458244-1-d.csapak@proxmox.com>

instead of hardcoding the default deep inside the code. This makes it
much easier to see what is the actual default

the first instance of ChunkOrder::None was only for the test case, were
the ordering doe not matter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pbs-api-types/src/datastore.rs | 3 ++-
 pbs-datastore/src/datastore.rs | 5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index dde385c3..d75ead90 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -158,13 +158,14 @@ pub const PRUNE_SCHEMA_KEEP_YEARLY: Schema =
         .schema();
 
 #[api]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
 #[serde(rename_all = "lowercase")]
 /// The order to sort chunks by
 pub enum ChunkOrder {
     /// Iterate chunks in the index order
     None,
     /// Iterate chunks in inode order
+    #[default]
     Inode,
 }
 
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index da7bdf87..73e6a3a9 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -71,7 +71,7 @@ impl DataStoreImpl {
             gc_mutex: Mutex::new(()),
             last_gc_status: Mutex::new(GarbageCollectionStatus::default()),
             verify_new: false,
-            chunk_order: ChunkOrder::None,
+            chunk_order: Default::default(),
             last_digest: None,
             sync_level: Default::default(),
         })
@@ -260,14 +260,13 @@ impl DataStore {
             DatastoreTuning::API_SCHEMA
                 .parse_property_string(config.tuning.as_deref().unwrap_or(""))?,
         )?;
-        let chunk_order = tuning.chunk_order.unwrap_or(ChunkOrder::Inode);
 
         Ok(DataStoreImpl {
             chunk_store,
             gc_mutex: Mutex::new(()),
             last_gc_status: Mutex::new(gc_status),
             verify_new: config.verify_new.unwrap_or(false),
-            chunk_order,
+            chunk_order: tuning.chunk_order.unwrap_or_default(),
             last_digest,
             sync_level: tuning.sync_level.unwrap_or_default(),
         })
-- 
2.30.2





  reply	other threads:[~2022-11-28 13:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 13:26 [pbs-devel] [PATCH proxmox-backup 1/3] ui: datastore tuning: show correct default option Dominik Csapak
2022-11-28 13:26 ` Dominik Csapak [this message]
2022-11-28 13:26 ` [pbs-devel] [PATCH proxmox-backup 3/3] docs: don't mention CLI only anymore for tuning options Dominik Csapak
2022-11-28 15:00 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/3] ui: datastore tuning: show correct default option Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221128132641.3458244-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal