aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-02-21 15:24:30 +0100
committerAlex Auvolat <alex@adnab.me>2021-02-21 15:24:30 +0100
commitb1b640ae8bd8d2ed7c128cb3f90e3e56226a5560 (patch)
tree55a703af2b8816b5c2e1aeb635db3538daa96a75 /src/table
parente59322041a0f894db0dfbd32805303b64048c810 (diff)
downloadgarage-b1b640ae8bd8d2ed7c128cb3f90e3e56226a5560.tar.gz
garage-b1b640ae8bd8d2ed7c128cb3f90e3e56226a5560.zip
rename hash() to sha256sum(), we might want to change it at some places
Diffstat (limited to 'src/table')
-rw-r--r--src/table/schema.rs2
-rw-r--r--src/table/table_fullcopy.rs2
-rw-r--r--src/table/table_sync.rs8
3 files changed, 6 insertions, 6 deletions
diff --git a/src/table/schema.rs b/src/table/schema.rs
index d2ec9450..61deb3c1 100644
--- a/src/table/schema.rs
+++ b/src/table/schema.rs
@@ -10,7 +10,7 @@ pub trait PartitionKey {
impl PartitionKey for String {
fn hash(&self) -> Hash {
- hash(self.as_bytes())
+ sha256sum(self.as_bytes())
}
}
diff --git a/src/table/table_fullcopy.rs b/src/table/table_fullcopy.rs
index 4659cb2c..e6f2c5fc 100644
--- a/src/table/table_fullcopy.rs
+++ b/src/table/table_fullcopy.rs
@@ -44,7 +44,7 @@ impl TableFullReplication {
let mut nodes = vec![];
for (node, _) in ring.config.members.iter() {
- let node_ranking = hash(&[node.as_slice(), my_id.as_slice()].concat());
+ let node_ranking = sha256sum(&[node.as_slice(), my_id.as_slice()].concat());
nodes.push((*node, node_ranking));
}
nodes.sort_by(|(_, rank1), (_, rank2)| rank1.cmp(rank2));
diff --git a/src/table/table_sync.rs b/src/table/table_sync.rs
index 3c667985..86878e35 100644
--- a/src/table/table_sync.rs
+++ b/src/table/table_sync.rs
@@ -322,7 +322,7 @@ where
.range(range.begin.clone()..range.end.clone())
{
let (key, value) = item?;
- let key_hash = hash(&key[..]);
+ let key_hash = sha256sum(&key[..]);
if children.len() > 0
&& key_hash.as_slice()[0..range.level]
.iter()
@@ -340,7 +340,7 @@ where
end: vec![],
level: 0,
};
- children.push((item_range, hash(&value[..])));
+ children.push((item_range, sha256sum(&value[..])));
}
Ok(RangeChecksum {
bounds: range.clone(),
@@ -378,7 +378,7 @@ where
}
let found_limit = sub_ck.found_limit.unwrap();
- let actual_limit_hash = hash(&found_limit[..]);
+ let actual_limit_hash = sha256sum(&found_limit[..]);
if actual_limit_hash.as_slice()[0..range.level]
.iter()
.all(|x| *x == 0u8)
@@ -426,7 +426,7 @@ where
);
let hash = if v.children.len() > 0 {
- Some(hash(&rmp_to_vec_all_named(&v)?[..]))
+ Some(sha256sum(&rmp_to_vec_all_named(&v)?[..]))
} else {
None
};