Skip to content

brokkr-models::models::agent_generator_registrations

Rust

Agent Generator Registration Module

Subscription join table between agents and generators.

An agent must be registered with a generator before any of that generator’s stacks can be targeted at it. Agents opt in; the broker enforces the check in authorize_target_mutation.

pub

Derives: Queryable, Selectable, Identifiable, Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash, ToSchema

A registration linking an agent to a generator scope.

Name Type Description
id Uuid
agent_id Uuid
generator_id Uuid
registered_at DateTime<Utc>

pub

Derives: Insertable, Debug, Clone, Serialize, Deserialize, ToSchema

Data required to insert a new registration.

Name Type Description
agent_id Uuid
generator_id Uuid

pub

fn new(agent_id: Uuid, generator_id: Uuid) -> Result<Self, String>
Source
pub fn new(agent_id: Uuid, generator_id: Uuid) -> Result<Self, String> {
if agent_id.is_nil() {
return Err("Invalid agent ID".to_string());
}
if generator_id.is_nil() {
return Err("Invalid generator ID".to_string());
}
Ok(NewAgentGeneratorRegistration {
agent_id,
generator_id,
})
}