Skip to main content

ManagedResource

Trait ManagedResource 

Source
pub trait ManagedResource: Sized {
    const TABLE: &'static str;
    const REF_COL: &'static str;
    const AGENT_REF_TABLE: &'static str;
    const BUNDLE_REF_TABLE: &'static str;
    const COLUMNS: &'static [&'static str];
    const UPDATE_COLUMNS: &'static [&'static str];
    const NAME_NOUN: &'static str;
    const ARTICLE_NOUN: &'static str;
    const KIND: &'static str;

    // Required methods
    fn from_row(row: &Row<'_>) -> Result<Self>;
    fn values(&self) -> Vec<Value>;
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn is_global(&self) -> bool;
    fn updated_at(&self) -> i64;
}
Expand description

One managed primitive: its catalog row type plus the names that differ between primitives.

Required Associated Constants§

Source

const TABLE: &'static str

Catalog table, e.g. db_skills.

Source

const REF_COL: &'static str

The ref tables’ column that points at TABLE.id, e.g. skill_id.

Source

const AGENT_REF_TABLE: &'static str

Agent-level ref table (agent_id, REF_COL), e.g. db_agent_skills_ref.

Source

const BUNDLE_REF_TABLE: &'static str

Bundle-level ref table (bundle_id, REF_COL), e.g. db_bundle_skills_ref.

Source

const COLUMNS: &'static [&'static str]

Every column of TABLE, in the order from_row reads them and values produces them. Must include id, name, is_global, created_at and updated_at.

Source

const UPDATE_COLUMNS: &'static [&'static str]

Columns rewritten by ON CONFLICT(id) DO UPDATE — everything a caller may edit; never id, is_global or created_at.

Source

const NAME_NOUN: &'static str

Noun in name-uniqueness errors: “skill name ‘x’ already bound…”.

Source

const ARTICLE_NOUN: &'static str

Noun with article in bundle errors: “cannot bind an MCP server to…”.

Source

const KIND: &'static str

Noun in the cross-channel bind error: “cross-channel MCP server binding…”.

Required Methods§

Source

fn from_row(row: &Row<'_>) -> Result<Self>

Read one row whose leading columns are COLUMNS, in order, from 0.

Source

fn values(&self) -> Vec<Value>

The row’s values in COLUMNS order (is_global as 0/1).

Source

fn id(&self) -> &str

Source

fn name(&self) -> &str

Source

fn is_global(&self) -> bool

Whether this row is a global (catalog-wide) row. Needed by managed_list’s in-memory sort, now that combining a global set with a private set can no longer happen inside one ORDER BY (Phase 2 of SPEC_DURABLE_BINDINGS_2026_09_10.md).

Source

fn updated_at(&self) -> i64

Last-updated timestamp, for the same in-memory sort as is_global.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ManagedResource for McpServer

Source§

const TABLE: &'static str = "db_mcp_servers"

Source§

const REF_COL: &'static str = "mcp_id"

Source§

const AGENT_REF_TABLE: &'static str = "db_agent_mcp_ref"

Source§

const BUNDLE_REF_TABLE: &'static str = "db_bundle_mcp_ref"

Source§

const COLUMNS: &'static [&'static str]

Source§

const UPDATE_COLUMNS: &'static [&'static str]

Source§

const NAME_NOUN: &'static str = "server"

Source§

const ARTICLE_NOUN: &'static str = "an MCP server"

Source§

const KIND: &'static str = "MCP server"

Source§

impl ManagedResource for Skill

Source§

const TABLE: &'static str = "db_skills"

Source§

const REF_COL: &'static str = "skill_id"

Source§

const AGENT_REF_TABLE: &'static str = "db_agent_skills_ref"

Source§

const BUNDLE_REF_TABLE: &'static str = "db_bundle_skills_ref"

Source§

const COLUMNS: &'static [&'static str]

Source§

const UPDATE_COLUMNS: &'static [&'static str]

Source§

const NAME_NOUN: &'static str = "skill"

Source§

const ARTICLE_NOUN: &'static str = "a skill"

Source§

const KIND: &'static str = "skill"