archive_rules
sc_crawler.archive_rules
#
Archive rules: the records replaced by another record or deliberately dropped.
A record gets the ARCHIVED status only
through the archive_rules listed
here, which are applied by the pull and sync commands on every run:
- Each old → new pair is one ArchiveRule:
a rename or re-key is one rule, a split is one rule per successor with
the same
match, a merge is one rule per old record with the samesuccessor. A dropped record has one rule with an emptysuccessorand areason. matchis the primary key of the record to archive, or a subset of its columns to archive every record with those values (a dict column such asconfigmatches only when the whole dict is equal).successorgives the new values of the same columns. Give enum columns by the value of the member (e.g.spotforallocation), not by its name as stored in the database (SPOT).- Child records, i.e. records referencing an archived record in their primary key (e.g. the zones and prices of a region, or the scores of a benchmark), are archived as well without their own rules. Add a rule for a child record only when its successor does not follow from the rules of its parents (e.g. the Hetzner zones below).
- Never remove a rule that has archived records. Rules removed from here
are kept as
INACTIVEin thearchive_ruletable.
The methods matching and applying the rules are on ScModel and ArchiveRule, e.g. archived_by tracing which rules archived a record.
Use ARCHIVED only for our own decisions about the identity of a record,
see Status on how it differs from
INACTIVE and RETIRED.
Attributes:
| Name | Type | Description |
|---|---|---|
archive_rules |
List[ArchiveRule]
|
All archive rules, applied by the |
archive_rules
module-attribute
#
archive_rules = [*[ArchiveRule(table_name='region', match={'vendor_id': 'hcloud', 'region_id': old}, successor={'vendor_id': 'hcloud', 'region_id': new}, reason=_HCLOUD_REASON) for old, new in _HCLOUD_DATACENTER_TO_LOCATION.items()], *[ArchiveRule(table_name='zone', match={'vendor_id': 'hcloud', 'region_id': old, 'zone_id': old}, successor={'vendor_id': 'hcloud', 'region_id': new, 'zone_id': new}, reason=_HCLOUD_REASON) for old, new in _HCLOUD_DATACENTER_TO_LOCATION.items()], *[ArchiveRule(table_name='server', match={'vendor_id': 'gcp', 'server_id': old}, successor={'vendor_id': 'gcp', 'server_id': new}, reason='Same machine as its successor: GCP renamed it and keeps the old name as an alias.') for old, new in _GCP_RENAMED_MACHINE_TYPES.items()], ArchiveRule(table_name='benchmark', match={'benchmark_id': 'app:static_web'}, successor={'benchmark_id': 'static_web:rps'}, reason='Replaced by the benchmarks of the static_web framework.')]
All archive rules, applied by the pull and sync commands.