mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-03 04:06:11 -04:00
dht testing work
This commit is contained in:
parent
d044f646bf
commit
176d9ac68e
4 changed files with 32 additions and 19 deletions
|
@ -338,8 +338,14 @@ impl StorageManager {
|
|||
let schema = descriptor.schema()?;
|
||||
|
||||
// Make new subkey data
|
||||
let value_data = if let Some(signed_value_data) = last_subkey_result.value {
|
||||
let seq = signed_value_data.value_data().seq();
|
||||
let value_data = if let Some(last_signed_value_data) = last_subkey_result.value {
|
||||
if last_signed_value_data.value_data().data() == &data
|
||||
&& last_signed_value_data.value_data().writer() == &writer.key
|
||||
{
|
||||
// Data and writer is the name, nothing is changing, just return the same ValueData
|
||||
return Ok(Some(last_signed_value_data.into_value_data()));
|
||||
}
|
||||
let seq = last_signed_value_data.value_data().seq();
|
||||
ValueData::new_with_seq(seq + 1, data, writer.key)
|
||||
} else {
|
||||
ValueData::new(data, writer.key)
|
||||
|
|
|
@ -98,7 +98,7 @@ impl StorageManager {
|
|||
if new_seq > prior_seq {
|
||||
// If the sequence number is greater, keep it
|
||||
ctx.value = value;
|
||||
// One node has show us this value so far
|
||||
// One node has shown us this value so far
|
||||
ctx.value_count = 1;
|
||||
} else {
|
||||
// If the sequence number is older, or an equal sequence number,
|
||||
|
@ -171,8 +171,8 @@ impl StorageManager {
|
|||
|
||||
// Make sure this value would actually be newer
|
||||
if let Some(last_value) = &last_subkey_result.value {
|
||||
if value.value_data().seq() < last_value.value_data().seq() {
|
||||
// inbound value is older than the one we have, just return the one we have
|
||||
if value.value_data().seq() <= last_value.value_data().seq() {
|
||||
// inbound value is older or equal sequence number than the one we have, just return the one we have
|
||||
return Ok(NetworkResult::value(Some(last_value.clone())));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue