pub struct ChangesetStore { /* private fields */ }Implementations§
Source§impl ChangesetStore
impl ChangesetStore
pub fn new(db: PgPool) -> Self
Sourcepub async fn create(
&self,
repo_id: RepoId,
session_id: Option<Uuid>,
agent_id: &str,
intent: &str,
base_version: Option<&str>,
agent_name: &str,
) -> Result<Changeset>
pub async fn create( &self, repo_id: RepoId, session_id: Option<Uuid>, agent_id: &str, intent: &str, base_version: Option<&str>, agent_name: &str, ) -> Result<Changeset>
Create a changeset via the Agent Protocol path.
Auto-increments the number per repo using an advisory lock.
Sets source_branch to agent/<agent_name> and target_branch to main
so platform queries that read these NOT NULL columns always succeed.
agent_name is the human-readable name (e.g. “agent-1” or “feature-bot”).
pub async fn get(&self, id: Uuid) -> Result<Changeset>
pub async fn update_status(&self, id: Uuid, status: &str) -> Result<()>
Sourcepub async fn update_status_with_reason(
&self,
id: Uuid,
status: &str,
reason: &str,
) -> Result<()>
pub async fn update_status_with_reason( &self, id: Uuid, status: &str, reason: &str, ) -> Result<()>
Update changeset status and record the reason for the transition.
Sourcepub async fn update_status_if(
&self,
id: Uuid,
new_status: &str,
expected_states: &[&str],
) -> Result<()>
pub async fn update_status_if( &self, id: Uuid, new_status: &str, expected_states: &[&str], ) -> Result<()>
Update changeset status with optimistic locking: the transition only
succeeds when the current state matches one of expected_states.
Returns an error if the row was not updated (state mismatch or not found).
Sourcepub async fn update_status_if_with_reason(
&self,
id: Uuid,
new_status: &str,
expected_states: &[&str],
reason: &str,
) -> Result<()>
pub async fn update_status_if_with_reason( &self, id: Uuid, new_status: &str, expected_states: &[&str], reason: &str, ) -> Result<()>
Like update_status_if but also records a reason for the transition.
pub async fn set_merged(&self, id: Uuid, commit_hash: &str) -> Result<()>
pub async fn upsert_file( &self, changeset_id: Uuid, file_path: &str, operation: &str, content: Option<&str>, ) -> Result<()>
pub async fn get_files(&self, changeset_id: Uuid) -> Result<Vec<ChangesetFile>>
Sourcepub async fn get_files_metadata(
&self,
changeset_id: Uuid,
) -> Result<Vec<ChangesetFileMeta>>
pub async fn get_files_metadata( &self, changeset_id: Uuid, ) -> Result<Vec<ChangesetFileMeta>>
Lightweight query returning only file metadata (path, operation, size) without loading the full content column.
pub async fn record_affected_symbol( &self, changeset_id: Uuid, symbol_id: SymbolId, qualified_name: &str, ) -> Result<()>
pub async fn get_affected_symbols( &self, changeset_id: Uuid, ) -> Result<Vec<(SymbolId, String)>>
Sourcepub async fn list_path_competitors(
&self,
repo_id: RepoId,
path: &str,
) -> Result<Vec<(Uuid, Option<Uuid>, String, DateTime<Utc>)>>
pub async fn list_path_competitors( &self, repo_id: RepoId, path: &str, ) -> Result<Vec<(Uuid, Option<Uuid>, String, DateTime<Utc>)>>
List live competitors on a file path.
Returns every changeset in {submitted, verifying, approved} for
repo_id that has a changeset_files row for path. draft,
merged, rejected, and closed are filtered at the SQL level —
draft is session-local, merged is handled by the AST merger at
dk_merge, and the rest are inert. Policy (self-exclusion, stale
comparison vs. session read timestamp) is applied by the pure
dk_protocol::stale_overlay::is_stale helper.
Used by the STALE_OVERLAY pre-write check in handle_file_write.
Sourcepub async fn find_conflicting_changesets(
&self,
repo_id: RepoId,
base_version: &str,
my_changeset_id: Uuid,
) -> Result<Vec<(Uuid, Vec<String>)>>
pub async fn find_conflicting_changesets( &self, repo_id: RepoId, base_version: &str, my_changeset_id: Uuid, ) -> Result<Vec<(Uuid, Vec<String>)>>
Find changesets that conflict with ours. Only considers changesets merged AFTER our base_version — i.e. changes the agent didn’t know about when it started.
Auto Trait Implementations§
impl !RefUnwindSafe for ChangesetStore
impl !UnwindSafe for ChangesetStore
impl Freeze for ChangesetStore
impl Send for ChangesetStore
impl Sync for ChangesetStore
impl Unpin for ChangesetStore
impl UnsafeUnpin for ChangesetStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more