feat(assign): implement camera-to-agent assignment with failover and strategy support
Multi-agent sites need automatic camera distribution, failover when an agent goes offline, and rebalancing when new agents join. Adds CameraAssignment entity with audit trail, 4 assignment strategies (RoundRobin, GpuPriority, LeastCameras, Failover), a Hangfire failover job that checks for stale heartbeats every 60s, a discovery coordinator for leader election, 6 REST endpoints, EF migration, and DI registration.
This commit is contained in:
1 parent
2152fca3c6
commit
159da2ca26
13 files changed
+2248
No files matched your search
@@ -567,6 +567,44 @@ namespace Heimdall.Infrastructure.Migrations
|
||||
b.ToTable("cameras", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Heimdall.Domain.Entities.CameraAssignment", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AgentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("AssignedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CameraId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTime?>("ReleasedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AssignedAt");
|
||||
|
||||
b.HasIndex("AgentId", "ReleasedAt")
|
||||
.HasFilter("\"ReleasedAt\" IS NULL");
|
||||
|
||||
b.HasIndex("CameraId", "ReleasedAt")
|
||||
.IsUnique()
|
||||
.HasFilter("\"ReleasedAt\" IS NULL");
|
||||
|
||||
b.ToTable("camera_assignments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Heimdall.Domain.Entities.CameraCredentials", b =>
|
||||
{
|
||||
b.Property<Guid>("CameraId")
|
||||
@@ -1149,6 +1187,25 @@ namespace Heimdall.Infrastructure.Migrations
|
||||
b.Navigation("Site");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Heimdall.Domain.Entities.CameraAssignment", b =>
|
||||
{
|
||||
b.HasOne("Heimdall.Domain.Entities.Agent", "Agent")
|
||||
.WithMany()
|
||||
.HasForeignKey("AgentId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Heimdall.Domain.Entities.Camera", "Camera")
|
||||
.WithMany()
|
||||
.HasForeignKey("CameraId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Agent");
|
||||
|
||||
b.Navigation("Camera");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Heimdall.Domain.Entities.CameraCredentials", b =>
|
||||
{
|
||||
b.HasOne("Heimdall.Domain.Entities.Camera", "Camera")
|
||||
|
||||
Reference in new issue
Block a user