Base Mechanism to Concrete Realization Cheat Sheet
Base Mechanism to Concrete Realization Cheat Sheet #
Use this note after identifying:
- normalized path
- write shape
- base mechanism
This is the next step: grounding the mechanism in concrete components.
1. Insert / Create #
Used for:
- create post
- create order
- create comment
- create file
Typical realization:
- primary OLTP store
- Postgres / MySQL / DynamoDB / Cassandra row insert
- optional idempotency key table
- optional event emitted for downstream projections
Mental model:
- mostly store-centered
- plus optional async fanout
2. Versioned Overwrite #
Used for:
- edit profile
- rename file
- update document title
- update feature flag
Typical realization:
- primary OLTP store
- version column / ETag / update timestamp guard
- optional cache invalidation
- optional projection refresh
Mental model:
- mostly store-centered
- often plus cache and projection updates
3. Guarded Conditional Update #
Used for:
- follow/unfollow
- revoke share
- cancel booking
- approve refund
- accept suggestion
- restore file
Typical realization:
- primary OLTP store with:
- conditional update
WHERE version = ?- or explicit state predicate
- optional transaction if multiple rows are affected
- optional async workers updating counters, search, feed, or audit
Mental model:
- source-truth store
- plus async secondary systems
4. Append Log / Append Table #
Used for:
- comments
- audit log
- activity events
- bids
- metrics/spans
Typical realization:
- append-only DB table
- or Kafka / Pulsar / event log
- or time-series store
- optional projection/index builders
Mental model:
- append store for truth
- downstream consumers for views and indexes
5. Materialized View #
Used for:
- home feed
- search results
- leaderboard
- top K
- dashboard
- hashtag search
Typical realization:
- source-truth store
- change stream / outbox / event queue
- async worker(s)
- read-model store:
- feed table
- Redis sorted set
- Elasticsearch/OpenSearch index
- precomputed aggregation table
Mental model:
- almost always multi-component
6. Counter / Projection Update #
Used for:
- follower count
- like count
- top-tag stats
- aggregate ratings
Typical realization:
- source-truth store
- async delta consumer or synchronous write-through
- counter table / Redis / aggregate row
- periodic recompute or repair job
Mental model:
- store + worker
- sometimes cache layer
7. Claim / Lease #
Used for:
- worker claims job
- lock acquire
- worker claims reminder delivery
- executor claims action
Typical realization:
- primary coordination store or source-truth row
- expiry timestamp
- claim token / epoch / fencing token
- heartbeat / renew path
- timeout worker to reclaim expired claims
Mental model:
- store + timeout worker + token semantics
8. Guarded Update + Hold / Lease #
Used for:
- seat hold
- room hold
- appointment slot hold
Typical realization:
- inventory/resource store
- hold record or held-state field
- conditional write / transaction
- expiry scheduler/worker
- booking workflow object on confirmation
Mental model:
- resource store + hold store/state + expiry worker
9. Guarded Frontier Update #
Used for:
- campaign recipient frontier
- crawler cursor
- scheduler next-fire cursor
- batch progress marker
Typical realization:
- frontier row/document in store
- worker or scheduler claims range
- conditional version update on frontier
- batch/run records optionally created
Mental model:
- store + scheduler/worker loop
10. Due Scan + Create Target #
Used for:
- reminders becoming due
- delayed tasks becoming runnable
- retries after backoff
- scheduled notifications
Typical realization:
- scheduled object table indexed by
run_at - scheduler scan loop
- create runnable job in queue/table
- worker claim/lease path after creation
Mental model:
- store + due-time index + scheduler + queue/worker
11. Versioned Snapshot Publication #
Used for:
- feature flags
- policy engine
- config delivery
- API key validator snapshot
Typical realization:
- control-plane source store
- snapshot builder / recompute job
- distribution channel:
- watch stream
- long poll
- push channel
- local in-memory cache on evaluators/consumers
Mental model:
- control-plane store + publisher + local cache
12. Search Index #
Used for:
- document search
- business search
- channel search
- skill search
Typical realization:
- source-truth store
- indexing pipeline / outbox consumer
- Elasticsearch / OpenSearch / Typesense / similar
- query frontend
Mental model:
- source store + indexing worker + search engine
13. Ranking / Top K #
Used for:
- trending hashtags
- top creators
- weekly top performers
- top restaurants
Typical realization:
- source-truth store
- aggregate stats store
- ranking materializer
- heap / sorted set / ranked table
- optional Redis cache
Mental model:
- source store + stats pipeline + ranked projection
14. Workflow Orchestration #
Used for:
- refund processing
- checkout
- booking confirmation
- moderation review
- campaign sending
Typical realization:
- workflow state row/object
- maybe local transaction across a few source rows
- async job queue for side effects
- outbox/event publishing
- retry / reconciliation workers
Mental model:
- workflow store + async workers + outbox
Quick Grouping #
Mostly store-centered #
- insert/create
- versioned overwrite
- guarded conditional update
- source read
Usually store + async workers #
- counters
- top K
- search indexing
- feed materialization
- audit trails
- workflow side effects
Usually store + scheduler/claim logic #
- holds with expiry
- delayed jobs
- reminders
- leases/locks
- frontier processing
Usually control-plane + local cache #
- config
- feature flags
- policy engines
- API key validation snapshots
Interview One-Liner #
After I pick a base mechanism, I ground it in concrete components: source-truth store for correctness, async workers for projections and side effects, schedulers for due-time or expiry logic, search/ranking systems for derived reads, and local caches or snapshots for hot-path evaluation when bounded staleness is acceptable.