brokkr-broker::dal::agent_pod_logs
Rust
DAL for the short-lived agent_pod_logs telemetry table.
Structs
Section titled “Structs”struct AgentPodLogsDAL<'a>
Section titled “struct AgentPodLogsDAL<'a>”pub
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
dal |
&'a DAL |
Methods
Section titled “Methods”create
Section titled “create”pub
fn create( &self, new_line: &NewAgentPodLog,) -> Result<AgentPodLog, diesel::result::Error>Source
pub fn create(&self, new_line: &NewAgentPodLog) -> Result<AgentPodLog, diesel::result::Error> { let conn = &mut self.dal.conn()?; diesel::insert_into(agent_pod_logs::table) .values(new_line) .get_result(conn) }list_for_stack
Section titled “list_for_stack”pub
fn list_for_stack( &self, stack_id: Uuid, since: DateTime<Utc>, limit: i64,) -> Result<Vec<AgentPodLog>, diesel::result::Error>Source
pub fn list_for_stack( &self, stack_id: Uuid, since: DateTime<Utc>, limit: i64, ) -> Result<Vec<AgentPodLog>, diesel::result::Error> { let conn = &mut self.dal.conn()?; agent_pod_logs::table .filter(agent_pod_logs::stack_id.eq(stack_id)) .filter(agent_pod_logs::created_at.ge(since)) .order(agent_pod_logs::created_at.desc()) .limit(limit) .load::<AgentPodLog>(conn) }evict_older_than
Section titled “evict_older_than”pub
fn evict_older_than( &self, cutoff: DateTime<Utc>,) -> Result<usize, diesel::result::Error>Source
pub fn evict_older_than(&self, cutoff: DateTime<Utc>) -> Result<usize, diesel::result::Error> { let conn = &mut self.dal.conn()?; diesel::delete(agent_pod_logs::table.filter(agent_pod_logs::created_at.lt(cutoff))) .execute(conn) }pub
fn count(&self) -> Result<i64, diesel::result::Error>Source
pub fn count(&self) -> Result<i64, diesel::result::Error> { let conn = &mut self.dal.conn()?; agent_pod_logs::table.count().get_result(conn) }