Add daemon-owned Iroh endpoint
This commit is contained in:
parent
b892dc6165
commit
ebc40ed208
14 changed files with 3930 additions and 431 deletions
|
|
@ -47,6 +47,13 @@ impl Store {
|
|||
agent_id TEXT,
|
||||
created_at_ms INTEGER NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS node_endpoints (
|
||||
endpoint_id TEXT PRIMARY KEY,
|
||||
node_id TEXT NOT NULL,
|
||||
agent_id TEXT NOT NULL,
|
||||
transport TEXT NOT NULL,
|
||||
created_at_ms INTEGER NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS resources (
|
||||
resource_id TEXT PRIMARY KEY,
|
||||
kind TEXT NOT NULL,
|
||||
|
|
@ -168,6 +175,20 @@ impl Store {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn upsert_node_endpoint(
|
||||
&self,
|
||||
endpoint_id: &str,
|
||||
node_id: &str,
|
||||
agent_id: &str,
|
||||
transport: &str,
|
||||
) -> Result<(), StoreError> {
|
||||
self.conn.execute(
|
||||
"INSERT OR IGNORE INTO node_endpoints(endpoint_id, node_id, agent_id, transport, created_at_ms) VALUES (?1, ?2, ?3, ?4, ?5)",
|
||||
params![endpoint_id, node_id, agent_id, transport, now_ms()],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn list_resources(&self) -> Result<Vec<StoredResource>, StoreError> {
|
||||
let mut stmt = self.conn.prepare(
|
||||
"SELECT resource_id, kind, name, status FROM resources ORDER BY kind, name, resource_id",
|
||||
|
|
|
|||
Loading…
Reference in a new issue