pub struct ChangeId { /* private fields */ }Expand description
The complete identity of a submitted command — Canton’s change ID.
The Ledger API does not identify a command by its command_id alone: it
de-duplicates on the triple (user_id, act_as, command_id), and two
applications sharing a participant can legitimately use the same command id.
Anything that goes looking for a command’s outcome afterwards — a completion
after a lost response, say — has to match on all three or it can find
somebody else’s answer.
A Submission hands one of these back before the
command is sent, which is the point: after an ambiguous failure the id is
the only way back to the outcome, and a generated id the caller never saw
is no way back at all.
Implementations§
Source§impl ChangeId
impl ChangeId
Sourcepub fn new(
user_id: impl Into<String>,
act_as: Vec<String>,
command_id: impl Into<String>,
) -> Self
pub fn new( user_id: impl Into<String>, act_as: Vec<String>, command_id: impl Into<String>, ) -> Self
Assemble a change ID from its three parts.
An empty user_id means “whichever user the bearer token resolves to”,
which is what the participant fills in when a submission leaves it
unset — see Self::matches.
Sourcepub fn command_id(&self) -> &str
pub fn command_id(&self) -> &str
The command id.
Sourcepub fn matches(&self, completion: &Completion) -> bool
pub fn matches(&self, completion: &Completion) -> bool
Whether completion is the completion of this command.
The command id must match, and the acting parties must be the same set — order is not meaningful, and Canton may echo them in its own.
Two deliberate asymmetries. A user_id this side left empty is not
compared: the participant resolved it from the token and the client
genuinely does not know it, so requiring equality would reject every
completion. And a completion that carries no act_as at all is not
rejected on that ground — some rejections are reported without one, and
refusing to recognise a rejection is worse than the narrow risk of a
same-user, same-command-id collision it guards against.
Sourcepub fn matches_json(&self, completion: &Value) -> bool
pub fn matches_json(&self, completion: &Value) -> bool
Self::matches for a completion from the JSON transport, which
carries the same three fields under their camelCase names.
The rule lives here rather than in the JSON client so that the two transports cannot come to disagree about what identifies a command.
Trait Implementations§
impl Eq for ChangeId
impl StructuralPartialEq for ChangeId
Auto Trait Implementations§
impl Freeze for ChangeId
impl RefUnwindSafe for ChangeId
impl Send for ChangeId
impl Sync for ChangeId
impl Unpin for ChangeId
impl UnsafeUnpin for ChangeId
impl UnwindSafe for ChangeId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request