You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Qhronos (v0.1.0) is a developer-first scheduling and notification platform. It l
27
27
**Event → Schedule → Occurrence Flow:**
28
28
-**Event:** User-defined intent and configuration, stored in the database.
29
29
-**Schedule:** Actionable plan (stored in Redis) for when the event should be executed. Created by the expander.
30
-
-**Occurrence:**Created only after a scheduled event is executed (dispatched by the dispatcher). Represents the actual attempt to process (dispatch) the event at a specific time, with status and result information.
30
+
-**Occurrence:**A record representing a specific scheduled instance of an Event. For recurring events, these are generated by the Expander. Each Occurrence tracks its lifecycle (e.g., pending, scheduled, dispatched, failed) and the outcome of its execution attempt by the Dispatcher.
31
31
32
32
For system architecture and in-depth design, see [design.md](./design.md).
- Ensures consistent request/response processing and security
104
+
-**Ginzap Logger:** Uses `zap` for structured logging of HTTP requests and responses, including latency, status, etc., via `ginzap.Ginzap` and `ginzap.RecoveryWithZap`.
105
+
-**RequestIDMiddleware:** Injects a unique request ID into the context and logs for improved traceability.
104
106
105
107
### Services
106
108
- Encapsulate business logic not directly tied to HTTP or data access
@@ -112,11 +114,12 @@ Qhronos uses JWT tokens and a master token for API authentication. Access contro
112
114
- Maps Go models to database tables
113
115
114
116
### Scheduler Layer
115
-
- Background jobs for event expansion, webhook dispatch, and cleanup
116
-
- Expander: generates occurrences for recurring events
117
-
- Dispatcher: delivers webhooks for due occurrences, handles retries
118
-
- Cleanup: archives old data and enforces retention policies
119
-
- Uses Redis for coordination and scheduling
117
+
- Background jobs for event expansion, webhook dispatch, and data archival.
118
+
- Uses Redis for coordination and scheduling of tasks.
119
+
-**Core Scheduler (`scheduler.Scheduler`):** Manages the underlying scheduling mechanism in Redis, providing a foundation for other scheduler components like the Expander and Dispatcher to enqueue and manage scheduled tasks.
120
+
-**Expander (`scheduler.Expander`):** Periodically scans for recurring events. For each event, it computes the next set of occurrences based on the `look_ahead_duration` and `expansion_interval` settings and stores them (e.g., in Redis via the Core Scheduler, for the Dispatcher to pick up).
121
+
-**Dispatcher (`scheduler.Dispatcher`):** Retrieves due occurrences from the schedule (e.g., Redis, managed by Core Scheduler). It attempts to deliver the webhook to the event's configured URL, signing with HMAC if configured. Handles retries with backoff on failure, up to a maximum attempt count.
122
+
-**Archival Scheduler (`scheduler.ArchivalScheduler`):** Periodically archives old events, occurrences, and webhook attempts from the primary tables to archive tables based on configured retention policies and archival interval. This helps manage database size and performance.
120
123
121
124
### Models
122
125
- Defines data structures for events, occurrences, tokens, and errors
@@ -163,7 +166,7 @@ Qhronos uses JWT tokens and a master token for API authentication. Access contro
163
166
- Exceeding the limit results in a 429 response.
164
167
165
168
### Archiving & Retention
166
-
- The Cleanup job periodically archives old events, occurrences, and webhook attempts based on retention policies.
169
+
- The **Archival Scheduler** job periodically archives old events, occurrences, and webhook attempts based on retention policies.
167
170
- Archived data is moved to separate tables for long-term storage.
168
171
169
172
### Health & Status Endpoints
@@ -184,7 +187,6 @@ While the schema includes tables for analytics and performance metrics, the curr
@@ -194,7 +196,6 @@ While the schema includes tables for analytics and performance metrics, the curr
194
196
-**occurrences:** Each row represents a scheduled execution of an event, with status and delivery tracking.
195
197
-**webhook_attempts:** Logs each attempt to deliver a webhook for an occurrence, including status and response.
196
198
-**archived_events / archived_occurrences / archived_webhook_attempts:** Long-term storage for data past retention windows.
197
-
-**system_config:** Stores global configuration and retention policies.
198
199
-**analytics_daily / analytics_hourly / performance_metrics:** Tables for aggregated statistics and system performance. **Note:** These tables are present in the schema for future use. As of the current implementation, they are not yet populated or queried by the application logic. Enhanced analytics and reporting are planned for a future release.
199
200
200
201
## 7. API Reference
@@ -213,6 +214,7 @@ While the schema includes tables for analytics and performance metrics, the curr
213
214
| POST | /tokens | Create a new JWT token (admin) |
214
215
| GET | /status | Service status and health info |
0 commit comments