pub struct Transaction<T, R>{ /* private fields */ }
Expand description
Allows operations to be batched atomically.
Implementations§
Source§impl<R> Transaction<Identity, R>where
R: ReadRepository,
impl<R> Transaction<Identity, R>where
R: ReadRepository,
pub fn accept( &mut self, revision: Oid, signature: Signature, ) -> Result<(), Error>
pub fn reject(&mut self, revision: Oid) -> Result<(), Error>
pub fn edit( &mut self, revision: Oid, title: impl ToString, description: impl ToString, ) -> Result<(), Error>
pub fn redact(&mut self, revision: Oid) -> Result<(), Error>
Source§impl<R> Transaction<Identity, R>where
R: WriteRepository,
impl<R> Transaction<Identity, R>where
R: WriteRepository,
Source§impl<R> Transaction<Issue, R>where
R: ReadRepository,
impl<R> Transaction<Issue, R>where
R: ReadRepository,
Sourcepub fn assign(
&mut self,
assignees: impl IntoIterator<Item = Did>,
) -> Result<(), Error>
pub fn assign( &mut self, assignees: impl IntoIterator<Item = Did>, ) -> Result<(), Error>
Assign DIDs to the issue.
Sourcepub fn edit_comment(
&mut self,
id: Oid,
body: impl ToString,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>
pub fn edit_comment( &mut self, id: Oid, body: impl ToString, embeds: Vec<Embed<Uri>>, ) -> Result<(), Error>
Edit an issue comment.
Sourcepub fn comment<S>(
&mut self,
body: S,
reply_to: Oid,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
pub fn comment<S>(
&mut self,
body: S,
reply_to: Oid,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
Comment on an issue.
Source§impl<R> Transaction<Patch, R>where
R: ReadRepository,
impl<R> Transaction<Patch, R>where
R: ReadRepository,
pub fn edit( &mut self, title: impl ToString, target: MergeTarget, ) -> Result<(), Error>
pub fn edit_revision( &mut self, revision: RevisionId, description: impl ToString, embeds: Vec<Embed<Uri>>, ) -> Result<(), Error>
Sourcepub fn thread<S>(&mut self, revision: RevisionId, body: S) -> Result<(), Error>where
S: ToString,
pub fn thread<S>(&mut self, revision: RevisionId, body: S) -> Result<(), Error>where
S: ToString,
Start a patch revision discussion.
Sourcepub fn react(
&mut self,
revision: RevisionId,
reaction: Reaction,
location: Option<CodeLocation>,
active: bool,
) -> Result<(), Error>
pub fn react( &mut self, revision: RevisionId, reaction: Reaction, location: Option<CodeLocation>, active: bool, ) -> Result<(), Error>
React on a patch revision.
Sourcepub fn comment<S>(
&mut self,
revision: RevisionId,
body: S,
reply_to: Option<Oid>,
location: Option<CodeLocation>,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
pub fn comment<S>(
&mut self,
revision: RevisionId,
body: S,
reply_to: Option<Oid>,
location: Option<CodeLocation>,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
Comment on a patch revision.
Sourcepub fn comment_edit<S>(
&mut self,
revision: RevisionId,
comment: Oid,
body: S,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
pub fn comment_edit<S>(
&mut self,
revision: RevisionId,
comment: Oid,
body: S,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
Edit a comment on a patch revision.
Sourcepub fn comment_react(
&mut self,
revision: RevisionId,
comment: Oid,
reaction: Reaction,
active: bool,
) -> Result<(), Error>
pub fn comment_react( &mut self, revision: RevisionId, comment: Oid, reaction: Reaction, active: bool, ) -> Result<(), Error>
React a comment on a patch revision.
Sourcepub fn comment_redact(
&mut self,
revision: RevisionId,
comment: Oid,
) -> Result<(), Error>
pub fn comment_redact( &mut self, revision: RevisionId, comment: Oid, ) -> Result<(), Error>
Redact a comment on a patch revision.
Sourcepub fn review_comment<S>(
&mut self,
review: ReviewId,
body: S,
location: Option<CodeLocation>,
reply_to: Option<Oid>,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
pub fn review_comment<S>(
&mut self,
review: ReviewId,
body: S,
location: Option<CodeLocation>,
reply_to: Option<Oid>,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
Comment on a review.
Sourcepub fn review_comment_resolve(
&mut self,
review: ReviewId,
comment: Oid,
) -> Result<(), Error>
pub fn review_comment_resolve( &mut self, review: ReviewId, comment: Oid, ) -> Result<(), Error>
Resolve a review comment.
Sourcepub fn review_comment_unresolve(
&mut self,
review: ReviewId,
comment: Oid,
) -> Result<(), Error>
pub fn review_comment_unresolve( &mut self, review: ReviewId, comment: Oid, ) -> Result<(), Error>
Unresolve a review comment.
Sourcepub fn edit_review_comment<S>(
&mut self,
review: ReviewId,
comment: Oid,
body: S,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
pub fn edit_review_comment<S>(
&mut self,
review: ReviewId,
comment: Oid,
body: S,
embeds: Vec<Embed<Uri>>,
) -> Result<(), Error>where
S: ToString,
Edit review comment.
Sourcepub fn react_review_comment(
&mut self,
review: ReviewId,
comment: Oid,
reaction: Reaction,
active: bool,
) -> Result<(), Error>
pub fn react_review_comment( &mut self, review: ReviewId, comment: Oid, reaction: Reaction, active: bool, ) -> Result<(), Error>
React to a review comment.
Sourcepub fn redact_review_comment(
&mut self,
review: ReviewId,
comment: Oid,
) -> Result<(), Error>
pub fn redact_review_comment( &mut self, review: ReviewId, comment: Oid, ) -> Result<(), Error>
Redact a review comment.
Sourcepub fn review(
&mut self,
revision: RevisionId,
verdict: Option<Verdict>,
summary: Option<String>,
labels: Vec<Label>,
) -> Result<(), Error>
pub fn review( &mut self, revision: RevisionId, verdict: Option<Verdict>, summary: Option<String>, labels: Vec<Label>, ) -> Result<(), Error>
Review a patch revision. Does nothing if a review for that revision already exists by the author.
Sourcepub fn review_edit(
&mut self,
review: ReviewId,
verdict: Option<Verdict>,
summary: String,
labels: Vec<Label>,
embeds: impl IntoIterator<Item = Embed<Uri>>,
) -> Result<(), Error>
pub fn review_edit( &mut self, review: ReviewId, verdict: Option<Verdict>, summary: String, labels: Vec<Label>, embeds: impl IntoIterator<Item = Embed<Uri>>, ) -> Result<(), Error>
Edit a review.
Sourcepub fn review_react(
&mut self,
review: ReviewId,
reaction: Reaction,
active: bool,
) -> Result<(), Error>
pub fn review_react( &mut self, review: ReviewId, reaction: Reaction, active: bool, ) -> Result<(), Error>
React to a review.
Sourcepub fn merge(&mut self, revision: RevisionId, commit: Oid) -> Result<(), Error>
pub fn merge(&mut self, revision: RevisionId, commit: Oid) -> Result<(), Error>
Merge a patch revision.
Source§impl<T, R> Transaction<T, R>
impl<T, R> Transaction<T, R>
Source§impl<T, R> Transaction<T, R>
impl<T, R> Transaction<T, R>
Sourcepub fn initial<G, F, Tx>(
message: &str,
store: &mut Store<'_, T, R>,
signer: &Device<G>,
operations: F,
) -> Result<(ObjectId, T), Error>where
Tx: From<Transaction<T, R>>,
Transaction<T, R>: From<Tx>,
G: Signer<Signature>,
F: FnOnce(&mut Tx, &R) -> Result<(), Error>,
R: ReadRepository + SignRepository + Store<Namespace = PublicKey>,
<T as Cob>::Action: Serialize + Clone,
pub fn initial<G, F, Tx>(
message: &str,
store: &mut Store<'_, T, R>,
signer: &Device<G>,
operations: F,
) -> Result<(ObjectId, T), Error>where
Tx: From<Transaction<T, R>>,
Transaction<T, R>: From<Tx>,
G: Signer<Signature>,
F: FnOnce(&mut Tx, &R) -> Result<(), Error>,
R: ReadRepository + SignRepository + Store<Namespace = PublicKey>,
<T as Cob>::Action: Serialize + Clone,
Create a new transaction to be used as the initial set of operations for a COB.
Source§impl<T, R> Transaction<T, R>
impl<T, R> Transaction<T, R>
Sourcepub fn push(&mut self, action: <T as Cob>::Action) -> Result<(), Error>
pub fn push(&mut self, action: <T as Cob>::Action) -> Result<(), Error>
Add an action to this transaction.
Sourcepub fn extend<I>(&mut self, actions: I) -> Result<(), Error>
pub fn extend<I>(&mut self, actions: I) -> Result<(), Error>
Add actions to this transaction.
Note that we cannot implement std::iter::Extend
because Self::push
validates the action being pushed, and therefore is falliable.
Sourcepub fn embed(
&mut self,
embeds: impl IntoIterator<Item = Embed<Uri>>,
) -> Result<(), Error>
pub fn embed( &mut self, embeds: impl IntoIterator<Item = Embed<Uri>>, ) -> Result<(), Error>
Embed media into the transaction.
Sourcepub fn commit<G>(
self,
msg: &str,
id: ObjectId,
store: &mut Store<'_, T, R>,
signer: &Device<G>,
) -> Result<(T, Oid), Error>where
R: ReadRepository + SignRepository + Store<Namespace = PublicKey>,
<T as Cob>::Action: Serialize + Clone,
G: Signer<Signature>,
pub fn commit<G>(
self,
msg: &str,
id: ObjectId,
store: &mut Store<'_, T, R>,
signer: &Device<G>,
) -> Result<(T, Oid), Error>where
R: ReadRepository + SignRepository + Store<Namespace = PublicKey>,
<T as Cob>::Action: Serialize + Clone,
G: Signer<Signature>,
Commit transaction.
Returns an operation that can be applied onto an in-memory state.
Trait Implementations§
Source§impl<T, R> Debug for Transaction<T, R>
impl<T, R> Debug for Transaction<T, R>
Source§impl<T, R> Default for Transaction<T, R>
impl<T, R> Default for Transaction<T, R>
Source§fn default() -> Transaction<T, R>
fn default() -> Transaction<T, R>
Auto Trait Implementations§
impl<T, R> Freeze for Transaction<T, R>
impl<T, R> RefUnwindSafe for Transaction<T, R>
impl<T, R> Send for Transaction<T, R>
impl<T, R> Sync for Transaction<T, R>
impl<T, R> Unpin for Transaction<T, R>
impl<T, R> UnwindSafe for Transaction<T, R>
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> 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