-
Notifications
You must be signed in to change notification settings - Fork 4
snapshots #113
Conversation
async fn get_all_updates_status(&self, uuid: Uuid) -> Result<Vec<UpdateStatus>> { | ||
let (ret, receiver) = oneshot::channel(); | ||
let msg = UpdateMsg::ListUpdates { uuid, ret }; | ||
let _ = self.sender.send(msg).await; | ||
receiver.await.expect("update actor killed.") | ||
} | ||
|
||
async fn update_status(&self, uuid: Uuid, id: u64) -> Result<UpdateStatus> { | ||
let (ret, receiver) = oneshot::channel(); | ||
let msg = UpdateMsg::GetUpdate { uuid, id, ret }; | ||
let _ = self.sender.send(msg).await; | ||
receiver.await.expect("update actor killed.") | ||
} | ||
|
||
async fn delete(&self, uuid: Uuid) -> Result<()> { | ||
let (ret, receiver) = oneshot::channel(); | ||
let msg = UpdateMsg::Delete { uuid, ret }; | ||
let _ = self.sender.send(msg).await; | ||
receiver.await.expect("update actor killed.") | ||
} | ||
|
||
async fn create(&self, uuid: Uuid) -> Result<()> { | ||
let (ret, receiver) = oneshot::channel(); | ||
let msg = UpdateMsg::Create { uuid, ret }; | ||
let _ = self.sender.send(msg).await; | ||
receiver.await.expect("update actor killed.") | ||
} | ||
|
||
async fn snapshot(&self, uuid: Uuid, path: PathBuf) -> Result<()> { | ||
let (ret, receiver) = oneshot::channel(); | ||
let msg = UpdateMsg::Snapshot { uuid, path, ret }; | ||
let _ = self.sender.send(msg).await; | ||
receiver.await.expect("update actor killed.") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be interesting to write a macro that generates all these functions? (for another PR though, this one is already complex enough 😂 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I thought about that a bit, it's not straightforward, but could be a fun little project :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
pub async fn run(self) { | ||
info!( | ||
"Snashot scheduled every {}s.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Snashot scheduled every {}s.", | |
"Snapshot scheduled every {}s.", |
Interesting, thanks I'll look into this ! |
bors merge |
113: snapshots r=MarinPostma a=MarinPostma This pr adds support for snapshoting. The snapshoting process for an index requires that no other update is processing at the same time. A mutex lock has been added to prevent a snapshot from occuring at the same time as an update, while still premitting updates to be pushed. The list of the indexes to snapshot is first retrieved from the `UuidResolver` which also performs its snapshot. This list is passed to the update store, which attempts to acquire a lock on the update store while it snaphots itself and it's associated index store. This means that a snapshot can only be completed once all indexes have finished their ongoing update. This pr also adds refactoring of the code to allow unit testing and mocking, and unit test the snapshot creation. Co-authored-by: mpostma <postma.marin@protonmail.com> Co-authored-by: tamo <irevoire@protonmail.ch> Co-authored-by: marin <postma.marin@protonmail.com>
Build failed: |
😭 Bors hates us |
bors try |
tryBuild succeeded: |
bors merge |
113: snapshots r=MarinPostma a=MarinPostma This pr adds support for snapshoting. The snapshoting process for an index requires that no other update is processing at the same time. A mutex lock has been added to prevent a snapshot from occuring at the same time as an update, while still premitting updates to be pushed. The list of the indexes to snapshot is first retrieved from the `UuidResolver` which also performs its snapshot. This list is passed to the update store, which attempts to acquire a lock on the update store while it snaphots itself and it's associated index store. This means that a snapshot can only be completed once all indexes have finished their ongoing update. This pr also adds refactoring of the code to allow unit testing and mocking, and unit test the snapshot creation. Co-authored-by: mpostma <postma.marin@protonmail.com> Co-authored-by: tamo <irevoire@protonmail.ch> Co-authored-by: marin <postma.marin@protonmail.com>
Build failed: |
@MarinPostma can we remove the failing test since you created https://github.com/meilisearch/transplant/issues/130? |
Yes this is on my to-do, you want to make a release? |
I would to do an alpha release before the end of the week if possible 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfecto !!
bors merge |
113: snapshots r=MarinPostma a=MarinPostma This pr adds support for snapshoting. The snapshoting process for an index requires that no other update is processing at the same time. A mutex lock has been added to prevent a snapshot from occuring at the same time as an update, while still premitting updates to be pushed. The list of the indexes to snapshot is first retrieved from the `UuidResolver` which also performs its snapshot. This list is passed to the update store, which attempts to acquire a lock on the update store while it snaphots itself and it's associated index store. This means that a snapshot can only be completed once all indexes have finished their ongoing update. This pr also adds refactoring of the code to allow unit testing and mocking, and unit test the snapshot creation. Co-authored-by: mpostma <postma.marin@protonmail.com> Co-authored-by: tamo <irevoire@protonmail.ch> Co-authored-by: marin <postma.marin@protonmail.com> Co-authored-by: Marin Postma <postma.marin@protonmail.com>
This PR was included in a batch that successfully built, but then failed to merge into main (it was a non-fast-forward update). It will be automatically retried. |
Merge conflict. |
bors merge |
Build succeeded: |
This pr adds support for snapshoting.
The snapshoting process for an index requires that no other update is processing at the same time. A mutex lock has been added to prevent a snapshot from occuring at the same time as an update, while still premitting updates to be pushed.
The list of the indexes to snapshot is first retrieved from the
UuidResolver
which also performs its snapshot.This list is passed to the update store, which attempts to acquire a lock on the update store while it snaphots itself and it's associated index store.
This means that a snapshot can only be completed once all indexes have finished their ongoing update.
This pr also adds refactoring of the code to allow unit testing and mocking, and unit test the snapshot creation.