System Design Atlas

Mining operations with intermittent connectivity

05 / 10Worked example

Data and states

Which changes to the work order must apply together, and what remains protected after completion?

The contracts require an authoritative datastore for work order A-35. Each device maintains a monotonically increasing event number within its own identity namespace. Data-centre receipt time and reported action time remain separate. Stale central device information cannot reliably establish whether a person has already performed the work. State and command result are stored together, so the same change request remains recognisable after restart.

Starting point Each device has its own event namespace.

Assumptions for the example case

A fictional example design for offline documentation of previously authorised routine work, with separate safety procedures. Zone information is marked stale from age 300 seconds; this does not authorise entry or work. All figures and test targets are illustrative assumptions.

Authoritative data and permitted state transitions

Entities and life cycle

Work order A-35Central and received revision
Device G-35Signed event numbers and acknowledgements
Zone information Z-35Timestamp and source of safety information
Auftrag A-35 → Gerät G-35is delivered to exactly one device
Auftrag A-35 → Zonenstand Z-35Binds the received safety information
1zugeteilt → lokal_bearbeitet
2→ abgeglichen | klärfall
3abgeglichen | klärfall → abgeschlossen
4storniert | abgeschlossen (terminal)

An offline report records an action against the received revision and grants no authorisation.

Each device maintains a monotonically increasing event number within its own identity namespace. Data-centre receipt time and reported action time remain separate. Stale central device information cannot reliably establish whether a person has already performed the work.

Domain entities and relationships

EntityAuthoritative attributesRelationship
Work assignmentA-35; revision, shift and responsibilityThe central system maintains the assigned revision.
DeviceG-35; identity and monotonically increasing event numberThe local journal preserves reports awaiting acknowledgement.
Zone informationZ-35; source and freshness timestampDocumentation context; grants no safety authorisation.
Reconciliation documentDevice report, central state and decisionA conflict preserves both states until the outcome is evidenced.

Work assignment

Authoritative attributes
A-35; revision, shift and responsibility
Relationship
The central system maintains the assigned revision.

Device

Authoritative attributes
G-35; identity and monotonically increasing event number
Relationship
The local journal preserves reports awaiting acknowledgement.

Zone information

Authoritative attributes
Z-35; source and freshness timestamp
Relationship
Documentation context; grants no safety authorisation.

Reconciliation document

Authoritative attributes
Device report, central state and decision
Relationship
A conflict preserves both states until the outcome is evidenced.

Permitted state transitions

Starting pointTargetPrecondition
zugeteiltlokal_bearbeitetThe device records the action locally against the assigned revision.
lokal_bearbeitetabgeglichenThe central system checks origin, revision and a complete event sequence.
lokal_bearbeitetklärfallThe central work-order state differs or events are missing.
abgeglichen or klärfallabgeschlossenThe shift supervisor confirms the evidenced actual outcome.
zugeteiltstorniertCancellation is delivered and acknowledged before confirmed local execution.
abgeschlossen or storniertterminalNew execution is rejected; late reports are retained as investigation evidence.

zugeteilt

Target
lokal_bearbeitet
Precondition
The device records the action locally against the assigned revision.

lokal_bearbeitet

Target
abgeglichen
Precondition
The central system checks origin, revision and a complete event sequence.

lokal_bearbeitet

Target
klärfall
Precondition
The central work-order state differs or events are missing.

abgeglichen or klärfall

Target
abgeschlossen
Precondition
The shift supervisor confirms the evidenced actual outcome.

zugeteilt

Target
storniert
Precondition
Cancellation is delivered and acknowledged before confirmed local execution.

abgeschlossen or storniert

Target
terminal
Precondition
New execution is rejected; late reports are retained as investigation evidence.

Atomic changes and versions

Content reference
Each device maintains a monotonically increasing event number within its own identity namespace. Data-centre receipt time and reported action time remain separate. Stale central device information cannot reliably establish whether a person has already performed the work.
Shared commit
The shift work order API checks the device, work order revision, local event number, actual action time and report, then writes the business change, command result and any pending work in one transaction. Commit makes these changes durably visible together. Before commit, rollback ends the attempt without partial effects.
Concurrency
The central change and offline completion both use revision 2. If completion wins, it is recorded and the change conflicts. If the change wins, the late completion opens an investigation case; the actual report is preserved rather than discarded as though the action never happened.
Terminal completion
After abgeschlossen, replay creates no second completion. A late new report for a cancelled work order creates an investigation task rather than silently reactivating it.

Cover the full scope of the case

Concrete rule
Central and local device clocks may differ. Ordering relies on device identity and event number, rather than time alone. Replacing a device requires a new identity or documented continuation; event numbers must not silently restart from zero.

Derive storage needs from access patterns

Authoritative relational datastore
The central system maintains the assigned revision. The local journal preserves reports awaiting acknowledgement. The design therefore selects a relational metadata store with uniqueness constraints and short transactions. Historical versions remain referenceable; a rebuildable read model must not overwrite authoritative state.
Large content and measurement series
Derived views and extensive measurement or event histories are read separately according to their access patterns. Binding state decisions remain in the authoritative datastore.

A conflict preserves both the original report and the central state

A conflict preserves both the original report and the central state

A conflict preserves both the original report and the central state.

The central change and offline completion both use revision 2. If completion wins, it is recorded and the change conflicts. If the change wins, the late completion opens an investigation case; the actual report is preserved rather than discarded as though the action never happened.

After abgeschlossen, replay creates no second completion. A late new report for a cancelled work order creates an investigation task rather than silently reactivating it. The exercise specifies the input and expected result.

Alternative considered
Separate unversioned changes allow an older state to overwrite the newer one.
Trade-off
Changes to work order A-35 are serialized briefly.
Reassess
Measured waiting times while a gateway uploads 1000 buffered events after reconnecting justify reviewing transaction duration.

Try it yourself

Explain the two possible winner orders in the case contract. Also determine the behaviour after terminal completion.

A hint for your attempt

Content revision and aggregate version have different tasks.

Compare with a possible solution
Concurrency
The central change and offline completion both use revision 2. If completion wins, it is recorded and the change conflicts. If the change wins, the late completion opens an investigation case; the actual report is preserved rather than discarded as though the action never happened.
Completion
After abgeschlossen, replay creates no second completion. A late new report for a cancelled work order creates an investigation task rather than silently reactivating it.

Apply to your project

Which states must remain protected in your model against late replay?

Next, the local gateway buffers independently of the central system.