Skip to content

Commit 9f67705

Browse files
committed
deprecate set(get)_variable
1 parent c1bb944 commit 9f67705

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

examples/protocol_variable_transfer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl ProtocolEntry for Initiator {
1111
participants: Vec<Participant>,
1212
) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
1313
println!("initiator");
14-
cl.set_variable("output", &param, &[participants[1].clone()])
14+
cl.send_variable("output", &param, &[participants[1].clone()])
1515
.await?;
1616
Ok(())
1717
}
@@ -26,7 +26,7 @@ impl ProtocolEntry for Receiver {
2626
param: Vec<u8>,
2727
participants: Vec<Participant>,
2828
) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
29-
let msg = cl.get_variable("output", &participants[0]).await?;
29+
let msg = cl.receive_variable("output", &participants[0]).await?;
3030
println!("{}", String::from_utf8_lossy(&msg));
3131
cl.create_entry(&format!("tasks:{}:output", cl.get_task_id()?), &msg)
3232
.await?;

src/extensions/variable_transfer/p2p_inbox.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl crate::application::CoLink {
165165
.contains_key(&receiver.user_id)
166166
{
167167
let inbox = self
168-
.get_variable_with_remote_storage("inbox", receiver)
168+
.receive_variable_with_remote_storage("inbox", receiver)
169169
.await?;
170170
let inbox: VTInbox = serde_json::from_slice(&inbox)?;
171171
let inbox = if inbox.addr.is_empty() {
@@ -287,7 +287,7 @@ impl crate::application::CoLink {
287287
.clone(),
288288
}
289289
};
290-
self.set_variable_with_remote_storage(
290+
self.send_variable_with_remote_storage(
291291
"inbox",
292292
&serde_json::to_vec(&vt_inbox)?,
293293
&[sender.clone()],

tests/test_protocol_variable_transfer.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ impl ProtocolEntry for Initiator {
1515
for i in 0..8 {
1616
let key = &format!("output{}", i);
1717
let key2 = &format!("output_remote_storage{}", i);
18-
cl.set_variable(key, &param, &participants[1..participants.len()])
19-
.await?;
20-
cl.set_variable_with_remote_storage(key2, &param, &participants[1..participants.len()])
18+
cl.send_variable(key, &param, &participants[1..participants.len()])
2119
.await?;
20+
cl.send_variable_with_remote_storage(
21+
key2,
22+
&param,
23+
&participants[1..participants.len()],
24+
)
25+
.await?;
2226
}
2327
Ok(())
2428
}
@@ -36,11 +40,11 @@ impl ProtocolEntry for Receiver {
3640
for i in 0..8 {
3741
let key = &format!("output{}", i);
3842
let key2 = &format!("output_remote_storage{}", i);
39-
let msg = cl.get_variable(key, &participants[0]).await?;
43+
let msg = cl.receive_variable(key, &participants[0]).await?;
4044
cl.create_entry(&format!("tasks:{}:output{}", cl.get_task_id()?, i), &msg)
4145
.await?;
4246
let msg = cl
43-
.get_variable_with_remote_storage(key2, &participants[0])
47+
.receive_variable_with_remote_storage(key2, &participants[0])
4448
.await?;
4549
cl.create_entry(
4650
&format!("tasks:{}:output_remote_storage{}", cl.get_task_id()?, i),

0 commit comments

Comments
 (0)