Skip to main content

OperationSpec

Enum OperationSpec 

Source
pub enum OperationSpec {
Show 19 variants DefineSchema { schema: SchemaInfo, }, AddAttribute { attribute: AttributeSchemaEntry, }, RemoveAttribute { attr_name: String, }, AddEntity { entity: EntitySchemaEntry, }, RemoveEntity { type_name: String, }, AddRelation { relation: RelationSchemaEntry, }, RemoveRelation { type_name: String, }, AddOwnership { owner_type: String, attribute: OwnedAttributeEntry, }, RemoveOwnership { owner_type: String, attr_name: String, }, ModifyOwnership { owner_type: String, attr_name: String, old_annotations: String, new_annotations: String, }, ModifyTypeAnnotations { type_name: String, old_doc: Option<String>, new_doc: Option<String>, old_meta: BTreeMap<String, String>, new_meta: BTreeMap<String, String>, }, ModifyRoleAnnotations { relation_type: String, role_name: String, old_doc: Option<String>, new_doc: Option<String>, old_meta: BTreeMap<String, String>, new_meta: BTreeMap<String, String>, }, AddRole { relation_type: String, role: RoleEntry, }, RemoveRole { relation_type: String, role_name: String, }, AddRolePlayer { relation_type: String, role_name: String, player_type_name: String, }, RemoveRolePlayer { relation_type: String, role_name: String, player_type_name: String, }, RunTypeql { forward: String, reverse: Option<String>, }, RenameAttribute { old_name: String, new_name: String, value_type: String, }, CopyAttribute { owner: Option<String>, source: Option<String>, dest: Option<String>, filter: Option<String>, forward: Option<String>, reverse: Option<String>, },
}
Expand description

Operation variants covering the frozen Python ops.* authoring surface.

Variants§

§

DefineSchema

Define the complete schema for a model-based initial migration.

Fields

§schema: SchemaInfo

Complete model schema.

§

AddAttribute

Add a standalone attribute type.

Fields

§attribute: AttributeSchemaEntry

Attribute schema payload.

§

RemoveAttribute

Remove a standalone attribute type.

Fields

§attr_name: String

Attribute type name.

§

AddEntity

Add an entity type.

Fields

§entity: EntitySchemaEntry

Entity schema payload.

§

RemoveEntity

Remove an entity type.

Fields

§type_name: String

Entity type name.

§

AddRelation

Add a relation type.

Fields

§relation: RelationSchemaEntry

Relation schema payload.

§

RemoveRelation

Remove a relation type.

Fields

§type_name: String

Relation type name.

§

AddOwnership

Add attribute ownership to an entity or relation.

Fields

§owner_type: String

Owning entity or relation type name.

§attribute: OwnedAttributeEntry

Owned attribute payload.

§

RemoveOwnership

Remove attribute ownership from an entity or relation.

Fields

§owner_type: String

Owning entity or relation type name.

§attr_name: String

Attribute type name.

§

ModifyOwnership

Modify ownership annotations.

Fields

§owner_type: String

Owning entity or relation type name.

§attr_name: String

Attribute type name.

§old_annotations: String

Previous annotations as authored by Python.

§new_annotations: String

New annotations as authored by Python.

§

ModifyTypeAnnotations

Modify @doc/@meta annotations on an entity, relation, or attribute type (TypeDB 3.12+).

Fields

§type_name: String

Type name (entity, relation, or attribute type).

§old_doc: Option<String>

Previous @doc value.

§new_doc: Option<String>

New @doc value.

§old_meta: BTreeMap<String, String>

Previous @meta annotations, keyed by meta key.

§new_meta: BTreeMap<String, String>

New @meta annotations, keyed by meta key.

§

ModifyRoleAnnotations

Modify @doc/@meta annotations on a relation role (TypeDB 3.12+).

Fields

§relation_type: String

Relation type name.

§role_name: String

Role name.

§old_doc: Option<String>

Previous @doc value.

§new_doc: Option<String>

New @doc value.

§old_meta: BTreeMap<String, String>

Previous @meta annotations, keyed by meta key.

§new_meta: BTreeMap<String, String>

New @meta annotations, keyed by meta key.

§

AddRole

Add a role to a relation.

Fields

§relation_type: String

Relation type name.

§role: RoleEntry

Role payload.

§

RemoveRole

Remove a role from a relation.

Fields

§relation_type: String

Relation type name.

§role_name: String

Role name.

§

AddRolePlayer

Add a player type to a role.

Fields

§relation_type: String

Relation type name.

§role_name: String

Role name.

§player_type_name: String

Player type name.

§

RemoveRolePlayer

Remove a player type from a role.

Fields

§relation_type: String

Relation type name.

§role_name: String

Role name.

§player_type_name: String

Player type name.

§

RunTypeql

Execute authored TypeQL without interpreting it in this sub-plan.

Fields

§forward: String

Forward TypeQL text.

§reverse: Option<String>

Optional rollback TypeQL text.

§

RenameAttribute

Rename an attribute type.

Fields

§old_name: String

Previous attribute type name.

§new_name: String

New attribute type name.

§value_type: String

TypeDB value type.

§

CopyAttribute

Copy an attribute from source to dest on every instance of the owner type.

This is a DML (write-typed) backfill operation — it inserts attribute values, not schema. The forward TypeQL is an insert-if-absent backfill; the reverse deletes the destination attribute.

Two wire forms exist. The lowered form carries only forward/reverse TypeQL (what .py execution lowers to); the structured form carries owner/source/dest(/filter) and lets the authoring core synthesize the TypeQL via copy_attribute_typeql and render a faithful ops.CopyAttribute(...) in the generated .py. Sidecars written by the authoring core always carry the synthesized strings, so the executor keeps running carried TypeQL.

Fields

§owner: Option<String>

Owner type label (structured portable form).

§source: Option<String>

Source attribute label (structured portable form).

§dest: Option<String>

Destination attribute label (structured portable form).

§filter: Option<String>

Optional extra match constraint line (structured portable form).

§forward: Option<String>

Forward backfill TypeQL. Absent only in the structured form before normalization; the executor derives its count queries from this string’s match clause.

§reverse: Option<String>

Reverse (rollback) TypeQL from to_rollback_typeql(), or None when the migration is irreversible.

Implementations§

Source§

impl OperationSpec

Source

pub fn normalized(self) -> Result<OperationSpec>

Return the operation with any structured copy_attribute filled in with its synthesized executable TypeQL. Other variants pass through.

§Errors

crate::error::MigrationError::AuthoringInput when a copy_attribute carries neither TypeQL nor the structured fields.

Trait Implementations§

Source§

impl Clone for OperationSpec

Source§

fn clone(&self) -> OperationSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OperationSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OperationSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OperationSpec

Source§

fn eq(&self, other: &OperationSpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OperationSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OperationSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more