Data and states
Which changes to the post must apply together, and what remains protected after completion?
The contracts require an authoritative datastore for post B-31. 100000 feed references at 64 bytes each total 6400000 bytes, approximately 6.10 MiB for one post before indexes. Large audiences are therefore processed in batches. Content remains central; feed references contain the post identifier and sort timestamp. State and command result are stored together, so the same change request remains recognisable after restart.
Starting point Publication binds the revision and audience.
Assumptions for the example case
A fictional example design for a local community with text posts, a chronological home feed and traceable moderation. A feed projection with lag below 30 seconds is within the assumed target; from 30 seconds, the backlog is displayed and reported. All figures and test targets are illustrative assumptions.
Authoritative data and permitted state transitions
Entities, relationships and states
Business identity, content revision and aggregate version remain distinct.
Domain entities and relationships
| Entity | Authoritative attributes | Relationship |
|---|---|---|
| Post | B-31; creator and authoritative visibility state | Content is independent of many feed references. |
| Publication revision | R-31; content, audience and timestamp | Publication binds this exact revision. |
| Moderation decision | M-31; reason, authorised decision-maker and outcome | History explains the block and its later justified removal. |
| Feed reference | Member, post and sort timestamp | Rebuildable read model; has no authority to grant access. |
Post
- Authoritative attributes
- B-31; creator and authoritative visibility state
- Relationship
- Content is independent of many feed references.
Publication revision
- Authoritative attributes
- R-31; content, audience and timestamp
- Relationship
- Publication binds this exact revision.
Moderation decision
- Authoritative attributes
- M-31; reason, authorised decision-maker and outcome
- Relationship
- History explains the block and its later justified removal.
Feed reference
- Authoritative attributes
- Member, post and sort timestamp
- Relationship
- Rebuildable read model; has no authority to grant access.
Permitted state transitions
| Starting point | Target | Precondition |
|---|---|---|
| entwurf | veröffentlicht | Creator confirms the current revision. |
| veröffentlicht | gesperrt | Moderation confirms justified block. |
| gesperrt | veröffentlicht | Moderation lifts the block after review, recording a new decision. |
| entwurf or veröffentlicht or gesperrt | gelöscht | Creator confirms deletion; content access ends. |
| gelöscht | terminal | Feed replays cannot make the post visible again. |
entwurf
- Target
- veröffentlicht
- Precondition
- Creator confirms the current revision.
veröffentlicht
- Target
- gesperrt
- Precondition
- Moderation confirms justified block.
gesperrt
- Target
- veröffentlicht
- Precondition
- Moderation lifts the block after review, recording a new decision.
entwurf or veröffentlicht or gesperrt
- Target
- gelöscht
- Precondition
- Creator confirms deletion; content access ends.
gelöscht
- Target
- terminal
- Precondition
- Feed replays cannot make the post visible again.
Atomic changes and versions
- Content reference
- 100000 feed references at 64 bytes each total 6400000 bytes, approximately 6.10 MiB for one post before indexes. Large audiences are therefore processed in batches. Content remains central; feed references contain the post identifier and sort timestamp.
- Shared commit
- The community API checks creator, post revision and audience, 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
- Publication and deletion both expect version 3. Deletion first prevents publication. Publication first is followed by deletion after a fresh read; the terminal state gelöscht remains effective against old feed jobs.
- Terminal completion
- After gelöscht, old feed references remain invisible. An identical old replay returns its original result but does not reactivate content.
Cover the full scope of the case
- Concrete rule
- Local deletion ends access to content and media. A minimal technical reference may be retained according to the agreed retention policy so that late feed jobs recognise the removed post. External federation and its deletion guarantees are outside this case.
Derive storage needs from access patterns
- Authoritative relational datastore
- Content exists independently of feed references. Publication binds an exact revision. 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.
Moderation decisions have their own history
Moderation decisions have their own history.
Publication and deletion both expect version 3. Deletion first prevents publication. Publication first is followed by deletion after a fresh read; the terminal state gelöscht remains effective against old feed jobs.
After gelöscht, old feed references remain invisible. An identical old replay returns its original result but does not reactivate content. 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 post B-31 are briefly serialised.
- Reassess
- Measured waiting times for one post reaching 100000 followers 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
- Publication and deletion both expect version 3. Deletion first prevents publication. Publication first is followed by deletion after a fresh read; the terminal state gelöscht remains effective against old feed jobs.
- Completion
- After gelöscht, old feed references remain invisible. An identical old replay returns its original result but does not reactivate content.
Apply to your project
Which states must remain protected in your model against late replay?