mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[fleet] test for relations on deleted entities
GitOrigin-RevId: 43b87ad5e4a4caaffef0abe07c12968d7e935dad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ea4b14110a
commit
85ed4f1762
@@ -6,10 +6,12 @@ import fleet.fastutil.ints.IntOpenHashSet
|
|||||||
import fleet.fastutil.ints.isNotEmpty
|
import fleet.fastutil.ints.isNotEmpty
|
||||||
import fleet.fastutil.ints.mapNotNull
|
import fleet.fastutil.ints.mapNotNull
|
||||||
|
|
||||||
data class CreateEntity(val eid: EID,
|
data class CreateEntity(
|
||||||
val entityTypeEid: EID,
|
val eid: EID,
|
||||||
val attributes: List<Pair<Attribute<*>, Any>>,
|
val entityTypeEid: EID,
|
||||||
override val seed: TX) : Instruction {
|
val attributes: List<Pair<Attribute<*>, Any>>,
|
||||||
|
override val seed: TX,
|
||||||
|
) : Instruction {
|
||||||
|
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion = InstructionExpansion(
|
override fun DbContext<Q>.expand(): InstructionExpansion = InstructionExpansion(
|
||||||
buildList {
|
buildList {
|
||||||
@@ -34,8 +36,10 @@ data class CreateEntity(val eid: EID,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class AtomicComposite(val instructions: List<Instruction>,
|
data class AtomicComposite(
|
||||||
override val seed: Long) : Instruction {
|
val instructions: List<Instruction>,
|
||||||
|
override val seed: Long,
|
||||||
|
) : Instruction {
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion = run {
|
override fun DbContext<Q>.expand(): InstructionExpansion = run {
|
||||||
val expansions = instructions.map { it.run { expand() } }
|
val expansions = instructions.map { it.run { expand() } }
|
||||||
InstructionExpansion(expansions.flatMap(InstructionExpansion::ops),
|
InstructionExpansion(expansions.flatMap(InstructionExpansion::ops),
|
||||||
@@ -55,8 +59,10 @@ data class EffectInstruction(val effect: DbContext<Mut>.() -> Unit) : Instructio
|
|||||||
* i.e. Entities which we load from disk, or get from the internet could not have EntityType loaded, however
|
* i.e. Entities which we load from disk, or get from the internet could not have EntityType loaded, however
|
||||||
* we are still able to store and modify them
|
* we are still able to store and modify them
|
||||||
* */
|
* */
|
||||||
data class ReifyEntities(val entityTypeEID: EID,
|
data class ReifyEntities(
|
||||||
override val seed: TX) : Instruction {
|
val entityTypeEID: EID,
|
||||||
|
override val seed: TX,
|
||||||
|
) : Instruction {
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion = InstructionExpansion(buildList {
|
override fun DbContext<Q>.expand(): InstructionExpansion = InstructionExpansion(buildList {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
getOne(entityTypeEID, Entity.EntityObject.attr as Attribute<Entity>)?.let { et ->
|
getOne(entityTypeEID, Entity.EntityObject.attr as Attribute<Entity>)?.let { et ->
|
||||||
@@ -69,10 +75,12 @@ data class ReifyEntities(val entityTypeEID: EID,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Add<V : Any>(val eid: EID,
|
data class Add<V : Any>(
|
||||||
val attribute: Attribute<V>,
|
val eid: EID,
|
||||||
val value: V,
|
val attribute: Attribute<V>,
|
||||||
override val seed: Long) : Instruction {
|
val value: V,
|
||||||
|
override val seed: Long,
|
||||||
|
) : Instruction {
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion = run {
|
override fun DbContext<Q>.expand(): InstructionExpansion = run {
|
||||||
impl.assertEntityExists(eid, attribute, null)
|
impl.assertEntityExists(eid, attribute, null)
|
||||||
if (attribute.schema.isRef) {
|
if (attribute.schema.isRef) {
|
||||||
@@ -82,18 +90,22 @@ data class Add<V : Any>(val eid: EID,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Remove<V : Any>(val eid: EID,
|
data class Remove<V : Any>(
|
||||||
val attribute: Attribute<V>,
|
val eid: EID,
|
||||||
val value: V,
|
val attribute: Attribute<V>,
|
||||||
override val seed: Long) : Instruction {
|
val value: V,
|
||||||
|
override val seed: Long,
|
||||||
|
) : Instruction {
|
||||||
|
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion =
|
override fun DbContext<Q>.expand(): InstructionExpansion =
|
||||||
InstructionExpansion(listOf(Op.Retract(eid, attribute, value)))
|
InstructionExpansion(listOf(Op.Retract(eid, attribute, value)))
|
||||||
}
|
}
|
||||||
|
|
||||||
data class RetractAttribute(val eid: EID,
|
data class RetractAttribute(
|
||||||
val attribute: Attribute<*>,
|
val eid: EID,
|
||||||
override val seed: Long) : Instruction {
|
val attribute: Attribute<*>,
|
||||||
|
override val seed: Long,
|
||||||
|
) : Instruction {
|
||||||
|
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion =
|
override fun DbContext<Q>.expand(): InstructionExpansion =
|
||||||
InstructionExpansion(buildList {
|
InstructionExpansion(buildList {
|
||||||
@@ -106,8 +118,10 @@ data class RetractAttribute(val eid: EID,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
data class RetractEntityInPartition(val eid: EID,
|
data class RetractEntityInPartition(
|
||||||
override val seed: Long) : Instruction {
|
val eid: EID,
|
||||||
|
override val seed: Long,
|
||||||
|
) : Instruction {
|
||||||
|
|
||||||
override fun DbContext<Q>.expand(): InstructionExpansion {
|
override fun DbContext<Q>.expand(): InstructionExpansion {
|
||||||
val res = ArrayList<Op>()
|
val res = ArrayList<Op>()
|
||||||
|
|||||||
Reference in New Issue
Block a user