Skip to content

Commit 8671da0

Browse files
chore: update docs
1 parent 621cba1 commit 8671da0

1 file changed

Lines changed: 39 additions & 16 deletions

File tree

docs/detailed-architecture.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ Arius.Core/
7070
│ │ │ ├── ArchiveCommand.cs # Command definition
7171
│ │ │ ├── ArchiveCommandHandler.cs # Command handler
7272
│ │ │ ├── ArchiveCommandValidator.cs # FluentValidation
73+
│ │ │ ├── HandlerContext.cs # Immutable context record
74+
│ │ │ ├── HandlerContextBuilder.cs # Context initialization
7375
│ │ │ └── ...
7476
│ │ │
7577
│ │ └── Restore/
7678
│ │ ├── RestoreCommand.cs
7779
│ │ ├── RestoreCommandHandler.cs
7880
│ │ ├── RestoreCommandValidator.cs
81+
│ │ ├── HandlerContext.cs # Immutable context record
82+
│ │ ├── HandlerContextBuilder.cs # Context initialization
7983
│ │ └── ...
8084
│ │
8185
│ └── Queries/ # Read operations (CQRS)
@@ -87,7 +91,8 @@ Arius.Core/
8791
│ └── PointerFileEntries/
8892
│ ├── PointerFileEntriesQuery.cs
8993
│ ├── PointerFileEntriesQueryHandler.cs
90-
│ ├── HandlerContextBuilder.cs
94+
│ ├── HandlerContext.cs # Immutable context record
95+
│ ├── HandlerContextBuilder.cs # Context initialization
9196
│ └── ...
9297
9398
└── Shared/ # Shared infrastructure & domain
@@ -109,37 +114,55 @@ Arius.Core/
109114

110115
## Core Concepts Flow
111116

117+
### HandlerContext Pattern
118+
119+
Each feature uses a **HandlerContext** pattern to encapsulate dependencies and initialization:
120+
- **HandlerContext**: Immutable record containing all validated dependencies
121+
- **HandlerContextBuilder**: Fluent builder that initializes and validates the context
122+
- Separates complex setup logic from business logic
123+
- Enables easy testing by allowing dependency injection
124+
112125
```
113126
┌─────────────┐
114127
│ Command │ (e.g., ArchiveCommand)
115128
└──────┬──────┘
116129
117130
118-
┌─────────────────┐
119-
│ Validator │ (FluentValidation)
120-
└──────┬──────────┘
131+
┌──────────────────────┐
132+
│ HandlerContextBuilder│ Build context with dependencies
133+
│ - Validate command │
134+
│ - Init Azure Blob │
135+
│ - Setup StateRepo │
136+
│ - Config FileSystem │
137+
└──────┬───────────────┘
138+
139+
140+
┌──────────────────────┐
141+
│ HandlerContext │ Immutable record with:
142+
│ (Immutable Record) │ - Command/Query
143+
│ │ - ArchiveStorage (Azure + Encryption)
144+
│ │ - StateRepository (SQLite)
145+
│ │ - FilePairFileSystem (Zio)
146+
│ │ - Hasher (SHA256)
147+
└──────┬───────────────┘
121148
122149
123150
┌─────────────────┐
124-
│ Command Handler│
151+
│ Command Handler│ Business logic using context
125152
└──────┬──────────┘
126153
127-
├─────▶ FilePairFileSystem ─────▶ Local File Operations
128-
│ (Read/Write pointer + binary files)
154+
├─────▶ context.FileSystem ─────▶ Local File Operations
155+
(Read/Write pointer + binary files)
129156
130-
├─────▶ StateRepository ─────▶ SQLite
131-
│ (Track uploaded files, metadata)
157+
├─────▶ context.StateRepository ─────▶ SQLite
158+
(Track uploaded files, metadata)
132159
133-
├─────▶ BlobStorage ─────▶ Azure Blob Storage
134-
│ (Upload/download encrypted blobs)
160+
├─────▶ context.ArchiveStorage ─────▶ Azure Blob Storage
161+
(Upload/download encrypted blobs)
135162
136-
├─────▶ Crypto Services ─────▶ AES256 Encryption
137-
138-
└─────▶ Hashing Services ─────▶ SHA256 Hash calculation
163+
└─────▶ context.Hasher ─────▶ SHA256 Hash calculation
139164
```
140165

141-
---
142-
143166
# 2. Arius.Cli - Command Line Interface
144167

145168
```

0 commit comments

Comments
 (0)