v0.25.4
This commit is contained in:
1 parent
e6604e41fc
commit
1dea7f55c8
49 files changed
+4499
-4025
No files matched your search
+34
-5
@@ -20,6 +20,22 @@ impl App {
|
||||
self: &Arc<Self>,
|
||||
update: Update,
|
||||
actor: String,
|
||||
) -> Result<config::Envelope, ApiError> {
|
||||
self.update_as_action(update, actor, None).await
|
||||
}
|
||||
pub async fn restore_as(
|
||||
self: &Arc<Self>,
|
||||
update: Update,
|
||||
actor: String,
|
||||
source_revision: u64,
|
||||
) -> Result<config::Envelope, ApiError> {
|
||||
self.update_as_action(update, actor, Some(source_revision)).await
|
||||
}
|
||||
async fn update_as_action(
|
||||
self: &Arc<Self>,
|
||||
update: Update,
|
||||
actor: String,
|
||||
source_revision: Option<u64>,
|
||||
) -> Result<config::Envelope, ApiError> {
|
||||
let slot = self.update_slots.clone().try_acquire_owned().map_err(|_| {
|
||||
ApiError(
|
||||
@@ -80,11 +96,24 @@ impl App {
|
||||
"configuration changed; reload before saving".into(),
|
||||
));
|
||||
}
|
||||
match this
|
||||
.store
|
||||
.replace_as(expected_revision, &prepared.envelope.config, &actor)
|
||||
.await
|
||||
{
|
||||
let persisted = match source_revision {
|
||||
Some(source) => {
|
||||
this.store
|
||||
.replace_as_restore(
|
||||
expected_revision,
|
||||
&prepared.envelope.config,
|
||||
&actor,
|
||||
source,
|
||||
)
|
||||
.await
|
||||
}
|
||||
None => {
|
||||
this.store
|
||||
.replace_as(expected_revision, &prepared.envelope.config, &actor)
|
||||
.await
|
||||
}
|
||||
};
|
||||
match persisted {
|
||||
Ok(true) => {}
|
||||
Ok(false) => {
|
||||
return Err(ApiError(
|
||||
|
||||
Reference in new issue
Block a user