clarify semantics

This commit is contained in:
Christien Rioux 2024-03-05 19:26:23 -05:00
parent 119a5668ac
commit 86f7473727
5 changed files with 8 additions and 8 deletions

View File

@ -353,7 +353,7 @@ struct OperationSetValueA @0x9378d0732dc95be2 {
struct OperationWatchValueQ @0xf9a5a6c547b9b228 { struct OperationWatchValueQ @0xf9a5a6c547b9b228 {
key @0 :TypedKey; # key for value to watch key @0 :TypedKey; # key for value to watch
subkeys @1 :List(SubkeyRange); # subkey range to watch (up to 512 subranges), can not be empty, to watch everything use 0..=UINT32_MAX subkeys @1 :List(SubkeyRange); # subkey range to watch (up to 512 subranges), if empty this implies 0..=UINT32_MAX
expiration @2 :UInt64; # requested timestamp when this watch will expire in usec since epoch (can be return less, 0 for max) expiration @2 :UInt64; # requested timestamp when this watch will expire in usec since epoch (can be return less, 0 for max)
count @3 :UInt32; # requested number of changes to watch for (0 = cancel, 1 = single shot, 2+ = counter, UINT32_MAX = continuous) count @3 :UInt32; # requested number of changes to watch for (0 = cancel, 1 = single shot, 2+ = counter, UINT32_MAX = continuous)
watchId @4 :UInt64; # if 0, request a new watch. if >0, existing watch id watchId @4 :UInt64; # if 0, request a new watch. if >0, existing watch id
@ -370,7 +370,7 @@ struct OperationWatchValueA @0xa726cab7064ba893 {
struct OperationValueChanged @0xd1c59ebdd8cc1bf6 { struct OperationValueChanged @0xd1c59ebdd8cc1bf6 {
key @0 :TypedKey; # key for value that changed key @0 :TypedKey; # key for value that changed
subkeys @1 :List(SubkeyRange); # subkey range that changed (up to 512 ranges at a time, this can be empty if this is a watch expiration notice) subkeys @1 :List(SubkeyRange); # subkey range that changed (up to 512 ranges at a time, if empty this is a watch expiration notice)
count @2 :UInt32; # remaining changes left (0 means watch has expired) count @2 :UInt32; # remaining changes left (0 means watch has expired)
watchId @3 :UInt64; # watch id this value change came from watchId @3 :UInt64; # watch id this value change came from
value @4 :SignedValueData; # first value that changed (the rest can be gotten with getvalue) value @4 :SignedValueData; # first value that changed (the rest can be gotten with getvalue)

View File

@ -21406,4 +21406,4 @@ pub mod operation {
} }
} }
//BUILDHASH:2361d45ebb46feb1cecc71c1756fc90ff94487663e8d7211177e6df6e4033386 //BUILDHASH:4ee16918900e322a0daa4bb0a11ca6094989c65936a653b0b78811e027d4d962

View File

@ -131,8 +131,6 @@ impl RPCProcessor {
// Validate accepted requests // Validate accepted requests
if accepted { if accepted {
xxx does this make sense?
// Verify returned answer watch id is the same as the question watch id if it exists // Verify returned answer watch id is the same as the question watch id if it exists
if let Some(question_watch_id) = question_watch_id { if let Some(question_watch_id) = question_watch_id {
if question_watch_id != watch_id { if question_watch_id != watch_id {

View File

@ -566,8 +566,7 @@ impl StorageManager {
Ok(None) Ok(None)
} }
/// Add or change an outbound watch to a DHT value /// Create,update or cancel an outbound watch to a DHT value
xxx decide if empty subkey range is valid. should probably reject that everywhere and use a default range of 'full'
pub async fn watch_values( pub async fn watch_values(
&self, &self,
key: TypedKey, key: TypedKey,

View File

@ -389,7 +389,10 @@ impl RoutingContext {
/// Cancels a watch early /// Cancels a watch early
/// ///
/// This is a convenience function that cancels watching all subkeys in a range /// This is a convenience function that cancels watching all subkeys in a range. The subkeys specified here
/// are subtracted from the watched subkey range. If no range is specified, this is equivalent to cancelling the entire range of subkeys.
/// Only the subkey range is changed, the expiration and count remain the same.
/// If no subkeys remain, the watch is entirely cancelled and will receive no more updates.
/// Returns Ok(true) if there is any remaining watch for this record /// Returns Ok(true) if there is any remaining watch for this record
/// Returns Ok(false) if the entire watch has been cancelled /// Returns Ok(false) if the entire watch has been cancelled
#[instrument(target = "veilid_api", level = "debug", ret, err)] #[instrument(target = "veilid_api", level = "debug", ret, err)]