aboutsummaryrefslogtreecommitdiff
path: root/src/util/data.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-10-15 11:05:09 +0200
committerAlex Auvolat <alex@adnab.me>2021-10-22 16:55:24 +0200
commit1b450c4b493dfcb2ee88acbca3ea584beac8eb4b (patch)
treed6437f105a630fa197b67446b5c3b2902335c34a /src/util/data.rs
parent4067797d0142ee7860aff8da95d65820d6cc0889 (diff)
downloadgarage-1b450c4b493dfcb2ee88acbca3ea584beac8eb4b.tar.gz
garage-1b450c4b493dfcb2ee88acbca3ea584beac8eb4b.zip
Improvements to CLI and various fixes for netapp version
Discovery via consul, persist peer list to file
Diffstat (limited to 'src/util/data.rs')
-rw-r--r--src/util/data.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/data.rs b/src/util/data.rs
index 6df51cd0..d4fe0009 100644
--- a/src/util/data.rs
+++ b/src/util/data.rs
@@ -87,6 +87,18 @@ impl FixedBytes32 {
}
}
+impl From<netapp::NodeID> for FixedBytes32 {
+ fn from(node_id: netapp::NodeID) -> FixedBytes32 {
+ FixedBytes32::try_from(node_id.as_ref()).unwrap()
+ }
+}
+
+impl Into<netapp::NodeID> for FixedBytes32 {
+ fn into(self) -> netapp::NodeID {
+ netapp::NodeID::from_slice(self.as_slice()).unwrap()
+ }
+}
+
/// A 32 bytes UUID
pub type Uuid = FixedBytes32;
/// A 256 bit cryptographic hash, can be sha256 or blake2 depending on provenance