Skip to content

Clarification on Store::wait_until_ready() and Watch Resynchronization #1736

Answered by clux
artsiomkaltovich asked this question in Q&A
Discussion options

You must be logged in to vote

This happens one level above wait_until_ready in

watcher::Event::Init => {
self.buffer = AHashMap::new();
}
watcher::Event::InitApply(obj) => {
let key = obj.to_object_ref(self.dyntype.clone());
let obj = Arc::new(obj.clone());
self.buffer.insert(key, obj);
}
watcher::Event::InitDone => {
let mut store = self.store.write();
// Swap the buffer into the store
std::mem::swap(&mut *store, &mut self.buffer);
// Clear the buffer
// This is preferred over self.buffer.clear(), as clear() will keep the allocated memory for reuse.
// This w…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by artsiomkaltovich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants