docs: consolidate documentation into organized structure

- Move 12 markdown files from root to docs/ subdirectories
- Organize documentation by category:
  • docs/troubleshooting/ (1 file)  - Technical troubleshooting guides
  • docs/deployment/      (4 files) - Deployment and security documentation
  • docs/guides/          (3 files) - Feature-specific guides
  • docs/planning/        (4 files) - Planning and improvement proposals

Root directory cleanup:
- Reduced from 16 to 4 markdown files in root
- Only essential project files remain:
  • CLAUDE.md (AI instructions)
  • README.md (Main project readme)
  • CLEANUP_PLAN.md (Current cleanup plan)
  • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements)

This improves:
 Documentation discoverability
 Logical organization by purpose
 Clean root directory
 Better maintainability
This commit is contained in:
2025-10-05 11:05:04 +02:00
parent 887847dde6
commit 5050c7d73a
36686 changed files with 196456 additions and 12398919 deletions

View File

@@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateDeadLetterJobsTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('dead_letter_jobs', function ($table) {
// Primary key
$table->string('id', 26)->primary();
// Job references
$table->string('original_job_id', 26)->index();
$table->string('dead_letter_queue', 100)->index();
$table->string('original_queue', 50)->index();
// Job data
$table->text('job_payload');
// Failure information
$table->text('failure_reason');
$table->string('exception_type', 255)->nullable();
$table->longText('stack_trace')->nullable();
// Attempt tracking
$table->integer('failed_attempts');
$table->integer('retry_count')->default(0);
// Timestamps
$table->timestamp('failed_at')->index();
$table->timestamp('moved_to_dlq_at')->index();
$table->timestamp('last_retry_at')->nullable();
// Composite indexes for efficient querying
$table->index(['dead_letter_queue', 'moved_to_dlq_at']);
$table->index(['original_queue', 'failed_at']);
$table->index(['retry_count', 'last_retry_at']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('dead_letter_jobs');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140002");
}
public function getDescription(): string
{
return "Create Dead Letter Jobs Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
/**
* Migration für Distributed Locks Tabelle
*/
final readonly class CreateDistributedLocksTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('distributed_locks', function ($table) {
// Lock Key - Primary Key
$table->string('lock_key', 255)->primary();
// Worker der den Lock hält
$table->string('worker_id', 32);
// Timestamps
$table->timestamp('acquired_at')->default('CURRENT_TIMESTAMP');
$table->timestamp('expires_at');
// Indexes
$table->index('worker_id', 'idx_lock_worker');
$table->index('expires_at', 'idx_lock_expires');
$table->index(['worker_id', 'expires_at'], 'idx_lock_worker_expires');
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('distributed_locks');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_19_144000");
}
public function getDescription(): string
{
return 'Create distributed_locks table for distributed job processing locks';
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
/**
* Migration für Failover Events Tabelle
*/
final readonly class CreateFailoverEventsTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('failover_events', function ($table) {
// Auto-incrementing ID
$table->id();
// Job der betroffen war
$table->string('job_id', 32);
// Worker die beim Failover beteiligt waren
$table->string('failed_worker_id', 32);
$table->string('new_worker_id', 32)->nullable();
// Event Typ
$table->enum('event_type', [
'worker_failure',
'job_reassignment',
'recovery_completed',
'manual_failover'
]);
// Zusätzliche Event-Daten
$table->json('event_data')->nullable()->comment('Additional failover context and metrics');
// Timestamps
$table->timestamp('failover_at')->default('CURRENT_TIMESTAMP');
// Indexes
$table->index('job_id', 'idx_failover_job');
$table->index('failed_worker_id', 'idx_failover_failed_worker');
$table->index('new_worker_id', 'idx_failover_new_worker');
$table->index('event_type', 'idx_failover_event_type');
$table->index('failover_at', 'idx_failover_time');
$table->index(['failed_worker_id', 'failover_at'], 'idx_failover_worker_time');
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('failover_events');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_19_151000");
}
public function getDescription(): string
{
return 'Create failover_events table for tracking worker failover and recovery events';
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,65 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
/**
* Migration für Job Assignments Tabelle
*/
final readonly class CreateJobAssignmentsTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_assignments', function ($table) {
// Job ID - eindeutige Zuordnung
$table->string('job_id', 32)->primary();
// Worker der den Job verarbeitet
$table->string('worker_id', 32);
// Queue Name für Statistiken
$table->string('queue_name', 255);
// Assignment Timestamp
$table->timestamp('assigned_at')->default('CURRENT_TIMESTAMP');
// Indexes
$table->index('worker_id', 'idx_assignment_worker');
$table->index('queue_name', 'idx_assignment_queue');
$table->index(['worker_id', 'assigned_at'], 'idx_assignment_worker_time');
$table->index('assigned_at', 'idx_assignment_time');
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_assignments');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_19_145000");
}
public function getDescription(): string
{
return 'Create job_assignments table for tracking job-to-worker assignments';
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateJobChainsTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_chains', function ($table) {
// Primary key
$table->string('id', 26)->primary();
// Chain identification
$table->string('chain_id', 26)->unique()->index();
$table->string('name', 255)->index();
// Chain configuration
$table->json('job_ids'); // Array of job IDs in execution order
$table->string('execution_mode', 20)->index(); // sequential, parallel, conditional
$table->boolean('stop_on_failure')->default(true)->index();
// Additional data
$table->json('metadata')->nullable();
// Status tracking
$table->string('status', 20)->default('pending')->index(); // pending, running, completed, failed
$table->timestamp('started_at')->nullable()->index();
$table->timestamp('completed_at')->nullable()->index();
// Timestamps
$table->timestamp('created_at')->index();
$table->timestamp('updated_at');
// Composite indexes for efficient querying
$table->index(['status', 'created_at']);
$table->index(['execution_mode', 'status']);
$table->index(['stop_on_failure', 'status']);
$table->index(['started_at', 'completed_at']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_chains');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140005");
}
public function getDescription(): string
{
return "Create Job Chains Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,72 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateJobDependenciesTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_dependencies', function ($table) {
// Primary key
$table->string('id', 26)->primary();
// Job references
$table->string('dependent_job_id', 26)->index();
$table->string('depends_on_job_id', 26)->index();
// Dependency configuration
$table->string('dependency_type', 20)->index(); // completion, success, conditional
$table->text('condition_expression')->nullable();
// Status tracking
$table->boolean('is_satisfied')->default(false)->index();
$table->timestamp('satisfied_at')->nullable();
// Timestamps
$table->timestamp('created_at')->index();
$table->timestamp('updated_at');
// Composite indexes for efficient querying
$table->index(['dependent_job_id', 'is_satisfied']);
$table->index(['depends_on_job_id', 'dependency_type']);
$table->index(['is_satisfied', 'satisfied_at']);
$table->index(['dependency_type', 'created_at']);
// Unique constraint to prevent duplicate dependencies
$table->unique(['dependent_job_id', 'depends_on_job_id', 'dependency_type']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_dependencies');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140004");
}
public function getDescription(): string
{
return "Create Job Dependencies Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateJobHistoryTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_history', function ($table) {
// Auto-incrementing primary key
$table->id();
// Job reference
$table->string('job_id', 26)->index();
// Status transition
$table->string('old_status', 20)->nullable();
$table->string('new_status', 20)->index();
// Error information
$table->text('error_message')->nullable();
// Timestamp
$table->timestamp('changed_at')->index();
// Additional metadata
$table->json('metadata')->nullable();
// Composite indexes for efficient querying
$table->index(['job_id', 'changed_at']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_history');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140001");
}
public function getDescription(): string
{
return "Create Job History Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateJobIndexTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_index', function ($table) {
// ULID primary key
$table->string('job_id', 26)->primary();
// Job status and metadata
$table->string('status', 20)->index();
$table->string('queue_type', 50)->index();
$table->integer('priority')->index();
$table->integer('attempts')->default(0);
$table->integer('max_attempts')->default(3);
// Timestamps
$table->timestamp('created_at')->index();
$table->timestamp('updated_at');
$table->timestamp('started_at')->nullable();
$table->timestamp('completed_at')->nullable()->index();
$table->timestamp('scheduled_for')->nullable()->index();
// Error handling
$table->text('error_message')->nullable();
// Composite indexes for efficient querying
$table->index(['status', 'queue_type']);
$table->index(['status', 'attempts', 'max_attempts']);
$table->index(['status', 'completed_at']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_index');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140000");
}
public function getDescription(): string
{
return "Create Job Index Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,83 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateJobMetricsTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_metrics', function ($table) {
// Primary key
$table->string('id', 26)->primary();
// Job identification
$table->string('job_id', 26)->index();
$table->string('queue_name', 100)->index();
// Status and execution tracking
$table->string('status', 20)->index(); // pending, running, completed, failed
$table->integer('attempts')->default(0)->index();
$table->integer('max_attempts')->default(3);
// Performance metrics
$table->float('execution_time_ms')->default(0)->index();
$table->integer('memory_usage_bytes')->default(0)->index();
// Error tracking
$table->text('error_message')->nullable();
// Timestamps
$table->timestamp('created_at')->index();
$table->timestamp('updated_at');
$table->timestamp('started_at')->nullable()->index();
$table->timestamp('completed_at')->nullable()->index();
$table->timestamp('failed_at')->nullable()->index();
// Additional data
$table->json('metadata')->nullable();
// Composite indexes for efficient querying
$table->index(['queue_name', 'status']);
$table->index(['status', 'created_at']);
$table->index(['job_id', 'attempts']);
$table->index(['queue_name', 'completed_at']);
$table->index(['queue_name', 'failed_at']);
$table->index(['execution_time_ms', 'status']);
$table->index(['memory_usage_bytes', 'status']);
$table->index(['created_at', 'completed_at', 'status']); // For throughput calculations
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_metrics');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140006");
}
public function getDescription(): string
{
return "Create Job Metrics Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
final readonly class CreateJobProgressTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_progress', function ($table) {
// Primary key
$table->string('id', 26)->primary();
// Job reference
$table->string('job_id', 26)->index();
// Progress tracking
$table->decimal('percentage', 5, 2)->index(); // 0.00 to 100.00
$table->text('message');
$table->string('step_name', 100)->nullable()->index();
// Additional data
$table->json('metadata')->nullable();
// Status flags
$table->boolean('is_completed')->default(false)->index();
$table->boolean('is_failed')->default(false)->index();
// Timestamp
$table->timestamp('updated_at')->index();
// Composite indexes for efficient querying
$table->index(['job_id', 'updated_at']);
$table->index(['job_id', 'is_completed']);
$table->index(['is_completed', 'updated_at']);
$table->index(['percentage', 'updated_at']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_progress');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_31_140003");
}
public function getDescription(): string
{
return "Create Job Progress Table";
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
/**
* Migration für Queue Workers Tabelle
*/
final readonly class CreateQueueWorkersTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('queue_workers', function ($table) {
// Primary Key - Worker ID (Hash basiert auf hostname + PID + Timestamp)
$table->string('id', 32)->primary();
// Worker Identification
$table->string('hostname', 255);
$table->integer('process_id');
$table->string('version', 20)->default('1.0.0');
// Queue Configuration
$table->json('queues')->comment('Queues that this worker handles');
$table->integer('max_jobs')->default(10)->comment('Maximum concurrent jobs');
$table->integer('current_jobs')->default(0)->comment('Currently running jobs');
// Worker Status
$table->boolean('is_active')->default(true);
$table->timestamp('registered_at')->default('CURRENT_TIMESTAMP');
$table->timestamp('last_heartbeat')->nullable();
// Performance Metrics
$table->decimal('cpu_usage', 5, 2)->default(0)->comment('CPU usage percentage (0-100)');
$table->bigInteger('memory_usage_bytes')->default(0)->comment('Memory usage in bytes');
// Worker Capabilities
$table->json('capabilities')->nullable()->comment('Worker capabilities/features');
// Indexes
$table->index(['hostname', 'process_id'], 'idx_worker_host_process');
$table->index(['is_active', 'last_heartbeat'], 'idx_worker_active_heartbeat');
$table->index('last_heartbeat', 'idx_worker_heartbeat');
$table->index('current_jobs', 'idx_worker_current_jobs');
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('queue_workers');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_19_143000");
}
public function getDescription(): string
{
return 'Create queue_workers table for distributed job processing';
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,72 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
/**
* Migration für Worker Health Checks Tabelle
*/
final readonly class CreateWorkerHealthChecksTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('worker_health_checks', function ($table) {
// Auto-incrementing ID
$table->id();
// Worker der überprüft wurde
$table->string('worker_id', 32);
// Health Status
$table->enum('status', ['healthy', 'warning', 'critical']);
$table->integer('score')->default(0)->comment('Health score 0-100');
// Detaillierte Metriken als JSON
$table->json('metrics')->nullable()->comment('Detailed metrics (CPU, memory, etc.)');
$table->json('issues')->nullable()->comment('Critical issues found');
$table->json('warnings')->nullable()->comment('Warning conditions');
// Timestamps
$table->timestamp('checked_at')->default('CURRENT_TIMESTAMP');
// Indexes
$table->index('worker_id', 'idx_health_worker');
$table->index(['worker_id', 'checked_at'], 'idx_health_worker_time');
$table->index('checked_at', 'idx_health_time');
$table->index('status', 'idx_health_status');
$table->index(['status', 'checked_at'], 'idx_health_status_time');
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('worker_health_checks');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_12_19_150000");
}
public function getDescription(): string
{
return 'Create worker_health_checks table for monitoring worker health status';
}
public function getDomain(): string
{
return "Framework";
}
}

View File

@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Framework\Queue\Migrations;
use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Schema;
/**
* Create job_batches table for batch job tracking
*/
final class Migration_2024_10_02_140000_CreateJobBatchesTable implements Migration
{
public function up(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->createIfNotExists('job_batches', function ($table) {
// Primary identification
$table->string('batch_id', 64)->primary();
$table->string('name', 255);
// Job tracking
$table->json('job_ids');
$table->string('status', 20)->default('pending')->index();
$table->integer('total_jobs')->default(0);
$table->integer('processed_jobs')->default(0);
$table->integer('failed_jobs')->default(0);
// Configuration and metadata
$table->json('options')->nullable();
// Timestamps for lifecycle tracking
$table->timestamp('created_at')->default('CURRENT_TIMESTAMP');
$table->timestamp('started_at')->nullable();
$table->timestamp('completed_at')->nullable();
$table->timestamp('failed_at')->nullable();
$table->timestamp('cancelled_at')->nullable();
// Indexes for efficient querying
$table->index(['status', 'created_at']);
$table->index('created_at');
$table->index(['status', 'total_jobs']);
});
$schema->execute();
}
public function down(ConnectionInterface $connection): void
{
$schema = new Schema($connection);
$schema->dropIfExists('job_batches');
$schema->execute();
}
public function getVersion(): MigrationVersion
{
return MigrationVersion::fromTimestamp("2024_10_02_140000");
}
public function getDescription(): string
{
return 'Create job_batches table for tracking batch job processing';
}
}