1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2026 Super Durable, Inc.
//
// Licensed under the Sustainable Use License 1.0.
// You may not use this file except in compliance with the License.
// See the LICENSE file in the repository root.
//
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
use crate::{AttributeLock, AttributeMapLoad, ChannelMapLoad};
/// Adds runtime-selected map instances to one RPC invocation.
///
/// Dex unions these selections with the RPC definition's fixed locks and loads, then sorts and
/// deduplicates their physical names. Locks and loads are independent. Read-modify-write handlers
/// must add the same AttributeMap instance through both builder methods.
///
/// # Examples
///
/// ```
/// use dex_sdk::{AttributeMap, RpcInvokeOptions};
///
/// let profiles = AttributeMap::<String>::new("profiles");
/// let options = RpcInvokeOptions::new()
/// .lock_attribute_map_instance(profiles.lock("partition-007"))
/// .load_attribute_map_instance(profiles.load("partition-007"));
/// ```
#[derive(Clone, Debug, Default)]
pub struct RpcInvokeOptions {
pub(crate) lock_attribute_map_instances: Vec<AttributeLock>,
pub(crate) load_attribute_map_instances: Vec<AttributeMapLoad>,
pub(crate) load_channel_map_instances: Vec<ChannelMapLoad>,
}
impl RpcInvokeOptions {
/// Creates empty invocation options that preserve the RPC definition's behavior.
pub fn new() -> Self {
Self::default()
}
/// Adds one AttributeMap instance lock for this invocation.
///
/// This does not load the instance into the handler snapshot.
#[must_use]
pub fn lock_attribute_map_instance(mut self, lock: AttributeLock) -> Self {
self.lock_attribute_map_instances.push(lock);
self
}
/// Adds one exact AttributeMap instance to the handler snapshot.
#[must_use]
pub fn load_attribute_map_instance(mut self, load: AttributeMapLoad) -> Self {
self.load_attribute_map_instances.push(load);
self
}
/// Adds one exact ChannelMap instance's pending messages to the handler snapshot.
#[must_use]
pub fn load_channel_map_instance(mut self, load: ChannelMapLoad) -> Self {
self.load_channel_map_instances.push(load);
self
}
}