httk.store.mongo.leases¶
Cross-process writer and fsck leases for httk.store.mongo.
The lease protocol deliberately uses MongoDB’s server clock. A writer first inserts itself and only then looks for the fsck singleton; fsck does the opposite half of that handshake by installing the singleton before draining fresh writers.
Exceptions¶
An fsck lease or a live writer prevents the requested operation. |
|
A lease owner tried to refresh after its lease was displaced. |
Classes¶
Server-clock lease timings. |
|
Shared lease state and heartbeat operations for writer and fsck leases. |
|
A writer registration plus the generation seen during acquisition. |
|
The singleton fsck exclusion lease. |
Functions¶
|
Insert a writer lease, then check fsck and observe the layout generation. |
|
Install the fsck singleton and drain fresh writer registrations. |
|
Clear a stale fsck lock after an administrator verified its owner died. |
Module Contents¶
- exception httk.store.mongo.leases.StoreLockedError[source]¶
Bases:
RuntimeErrorAn fsck lease or a live writer prevents the requested operation.
- exception httk.store.mongo.leases.LeaseLostError[source]¶
Bases:
StoreLockedErrorA lease owner tried to refresh after its lease was displaced.
- class httk.store.mongo.leases.LeaseTiming[source]¶
Server-clock lease timings.
- Parameters:
refresh_interval – Maximum normal interval between heartbeats.
stale_multiplier – Number of refresh intervals before a writer is stale.
poll_initial – Initial fsck writer-drain sleep.
poll_max – Maximum fsck writer-drain sleep.
- class httk.store.mongo.leases.Lease[source]¶
Shared lease state and heartbeat operations for writer and fsck leases.
- timing: LeaseTiming[source]¶
- class httk.store.mongo.leases.WriterLease[source]¶
Bases:
LeaseA writer registration plus the generation seen during acquisition.
- httk.store.mongo.leases.acquire_writer(database, *, timing=DEFAULT_TIMING)[source]¶
Insert a writer lease, then check fsck and observe the layout generation.
The ordering is the writer half of the insert-then-check handshake. A stale fsck lease intentionally still blocks writers: clearing it is an explicit administrative assertion that its owner is dead.
- httk.store.mongo.leases.acquire_fsck(database, *, force=False, timing=DEFAULT_TIMING)[source]¶
Install the fsck singleton and drain fresh writer registrations.
forcemay replace a pre-existing fsck lease and may proceed past stale writer residue. It is an administrative assertion that those owners are dead; using it against a still-running owner can corrupt the store.