Skip to content

feat: one wiring, built once, handed back by name - #34

Closed
AlexeyShalaev wants to merge 1 commit into
feat/plan-artifact-guardsfrom
feat/partition-toolkit
Closed

AlexeyShalaev wants to merge 1 commit into
feat/plan-artifact-guardsfrom
feat/partition-toolkit

Conversation

@AlexeyShalaev

Copy link
Copy Markdown
Member

Second piece of #32, and the other half of #27 — the construction helper.

Three settings live on two objects and have to agree, and passing one of them to one object only is silent:

  • marker_prefix — the repository stamps it on detach and reads it back before a drop; the metadata provider looks for it when discovering orphans. Give it to one only and detached partitions are never seen again, so they are never dropped.
  • ddl_timezone — one writes naive boundary literals in it, the other reads them back in it, and the two constructors do not even default to the same value ("UTC" on the repository, None on the provider). So "I passed nothing" used to mean a reader on a timezone the writer never used. from_engine now gives both "UTC".
  • boundary_codec.

PartitionToolkit.from_engine(engine, ...) takes each of those once and returns repo / metadata / locks / service / maintainer. Parts rather than just a maintainer, so code calling metadata.is_partition_closed or locks.acquire_lock directly does not build a second set and keep it consistent by hand. PartitionToolkit(...) can be constructed directly around parts of your own.

Both mirrors, 16 tests. The getting-started page keeps the hand-wiring as the explanation and uses the toolkit from there on.

Stacked on #33.

Three settings live on two objects and have to agree: marker_prefix, which
one writes and the other looks for; ddl_timezone, which one writes naive
boundary literals in and the other reads them back in -- on constructors
that do not even default to the same value -- and boundary_codec. Passing
one of them to one object only is silent: detached partitions simply stop
being seen, so they are never dropped.

PartitionToolkit.from_engine takes each of those once and builds the
repository, the provider, the locks, the service and the maintainer around
one engine. It returns the parts, not just a maintainer, so code calling
metadata.is_partition_closed or locks.acquire_lock directly does not build a
second set and keep it consistent by hand.
@AlexeyShalaev

Copy link
Copy Markdown
Member Author

Folded into #43, one PR for the whole epic; this branch stays for history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant