pub enum ConflictMode {
Error,
Merge,
Version,
}Expand description
v0.7.0 fix campaign R1-M3 (#690) — substrate-side on_conflict
policy for insert_with_conflict.
Before this enum existed, every call into insert silently
merged on (title, namespace) collision. The G6 work in v0.6.3.1
closed the silent-merge gap at the MCP / HTTP handler layer
(see mcp::tools::store and handlers::http::create_link), but
substrate-internal writers — storage::reflect, the curator
consolidation surface, and the federation sync_push link loop —
kept calling insert directly and inheriting the silent-merge
behaviour. R1-M3 surfaces the same three policies the handler
layer already exposes on a typed enum so substrate callers can
opt into the right semantics explicitly.
Policies:
-
ConflictMode::Error— refuse the write when a(title, namespace)row already exists, returning a typed error. Used bystorage::reflectso a duplicate reflection cannot silently replace an earlier one. -
ConflictMode::Merge— current silent-merge behaviour (the v0.6.3 default).insertcontinues to call into the merge path verbatim for backward compatibility. -
ConflictMode::Version— append a monotonic suffix to the title until a free(title, namespace)slot is found, then insert a new row. Mirrors theon_conflict='version'handler policy.
Variants§
Error
Refuse the write with a typed (title, namespace) collision
error. The existing row is left untouched.
Merge
Silently merge on (title, namespace) collision (the legacy
v0.6.3 substrate default). The existing row’s content / tags /
metadata.agent_id / reflection_depth are merged with the
incoming row per the SQL in insert.
Version
Append (2), (3), … to the title until a free slot is found,
then insert a new row. Both old and new rows persist.
Trait Implementations§
Source§impl Clone for ConflictMode
impl Clone for ConflictMode
Source§fn clone(&self) -> ConflictMode
fn clone(&self) -> ConflictMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConflictMode
Source§impl Debug for ConflictMode
impl Debug for ConflictMode
impl Eq for ConflictMode
Source§impl PartialEq for ConflictMode
impl PartialEq for ConflictMode
Source§fn eq(&self, other: &ConflictMode) -> bool
fn eq(&self, other: &ConflictMode) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConflictMode
Auto Trait Implementations§
impl Freeze for ConflictMode
impl RefUnwindSafe for ConflictMode
impl Send for ConflictMode
impl Sync for ConflictMode
impl Unpin for ConflictMode
impl UnsafeUnpin for ConflictMode
impl UnwindSafe for ConflictMode
Blanket Implementations§
impl<T> Boilerplate for T
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
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§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.impl<T> ErasedDestructor for Twhere
T: 'static,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more