graflo.architecture.evolution.merge_refusals¶
The structural refusals of a merge, read from the sides before the union.
Pure: each reads the sides and their
:class:~graflo.architecture.evolution.canonical.ClusterResolution and
returns its refusals, so the preview and the merge refuse alike.
Attributes¶
Classes¶
DemotedKeyPlan
dataclass
¶
How one merged class names its members' demoted keys.
names is the secondary identity each demoted member's key answers to,
by (side, member); additions the secondaries to declare for them,
in order; refusals what makes the naming impossible.
Source code in graflo/architecture/evolution/merge_refusals.py
Functions:¶
ambiguous_reference_refusals(resolution, sides, member_properties)
¶
Each resource that would have to find one class by two demoted keys.
The rule :func:_attach_uncovered_producers and
:func:_pin_member_references refuse on, read from the sides before the
union: a resource producing members of one side whose keys are demoted to
different secondaries -- two key spaces, or two field sets -- when it
only references them (every step lookup_only), or when it would be
attached: it writes them, the derived identity names it nowhere, and its
records complete no property branch. sides carry the union's resource
names; member_properties are each member's properties in canonical
names.
Source code in graflo/architecture/evolution/merge_refusals.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
demoted_key_refusals(resolution, manifests)
¶
Every demoted key :func:plan_demoted_key_names cannot name.
Read from the sides before the union, so the preview and the merge refuse alike before anything is renamed.
Source code in graflo/architecture/evolution/merge_refusals.py
identifier_refusals(resolution, manifests)
¶
Every demoted-key property name a PostgreSQL target would truncate.
A demoted key field is renamed <key space>__<field>; PostgreSQL keeps
only the first 63 bytes of a column name, so two such names could
become one column. Checked only when the union targets PostgreSQL. Read
from the sides before the union, so the preview and the merge refuse
alike.
Source code in graflo/architecture/evolution/merge_refusals.py
key_space_refusals(resolution, manifests)
¶
Every problem with the key spaces resolution names demoted keys by.
A local_key tag names the key space of a member's own ids, and its
demoted key is named by it. Refused: a member two of its resources tag
differently (its ids would be in two spaces at once), a tag that cannot
name a key space (see :func:~graflo.architecture.evolution.naming_graph.key_space_name_problem),
a tag a member of the cluster already declares as a secondary identity
(the demoted key would take that name), and a key space both sides name
(two sides' ids in one space). An origin colliding with a secondary is
:func:origin_refusals' to report.
Source code in graflo/architecture/evolution/merge_refusals.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |
origin_refusals(op, manifests, resolution)
¶
Every problem with the origins resolution names something by.
Only a side whose origin names something is checked: a demoted key whose
key space is the origin, or a local key the origin tags (see
:attr:~graflo.architecture.evolution.canonical.ClusterResolution.origin_tagged).
Its origin must be a valid key space name (see
:func:~graflo.architecture.evolution.naming_graph.key_space_name_problem;
it is joined to field names with __); two named origins must differ;
and no member of a re-keyed cluster may declare a secondary identity of
that name, which the demoted key takes. Each refusal is about the merged
classes that name something by the origin, or that declare the secondary.
Source code in graflo/architecture/evolution/merge_refusals.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
plan_demoted_key_names(into, members, key_spaces, origins, authored)
¶
Name the demoted keys of the merged class into; pure.
members are its demoted members in order, as (side, member, fields,
key): fields in the union's names (after the key-space prefix), key
the canonical fields before it. A member's key space is its entry in
key_spaces, else its side's origin. authored are the secondaries the
members declare, by name, in the union's field names.
A field set authored declares answers to that declaration and its name.
Otherwise the secondary is named by its key space, one per key space; a
key space contributing two field sets names each <space>__<key fields
joined by __>. A field set is shared by the members of one key space
and by members of different sides; the first member to declare it fixes
its column order. Refused: two key spaces of one side on one field set,
authored or not -- their ids would share a lookup column -- and a
<space>__<fields> name an authored secondary takes.
A key space named like an authored secondary is
:func:key_space_refusals' and :func:origin_refusals' to report.
Source code in graflo/architecture/evolution/merge_refusals.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |