Auto-sync: 2026-04-21 16:03
This commit is contained in:
26
wiki/concepts/Event-Sourcing.md
Normal file
26
wiki/concepts/Event-Sourcing.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "Event Sourcing"
|
||||
type: concept
|
||||
tags: [architecture, event-driven, state-management]
|
||||
---
|
||||
|
||||
## Summary
|
||||
Event Sourcing(事件溯源)是一种软件架构模式,通过存储所有状态变更事件而非仅存储当前状态来重建系统历史。
|
||||
|
||||
## Definition
|
||||
事件溯源将应用状态的所有变更存储为一系列不可变的事件对象。通过重放这些事件,可以重建任意时间点的系统状态。
|
||||
|
||||
## Key Principles
|
||||
- **事件即事实**:状态变更以事件形式持久化,而非覆盖最终状态
|
||||
- **完整审计日志**:天然具备完整的审计追踪能力
|
||||
- **时间旅行调试**:可以重放事件序列重现历史状态
|
||||
- **解耦读写**:写操作存储事件,读操作通过事件投影计算状态
|
||||
|
||||
## Relationship to Project State Management
|
||||
Project State Management 系统将 Event Sourcing 模式应用于项目管理:
|
||||
- 每个项目事件(progress、blocker、decision、pivot)作为不可变事件存储
|
||||
- 项目当前状态通过事件投影计算
|
||||
- 决策上下文通过查询事件历史恢复
|
||||
|
||||
## External Links
|
||||
- [Event Sourcing Pattern - Martin Fowler](https://martinfowler.com/eaaDev/EventSourcing.html)
|
||||
Reference in New Issue
Block a user