pub struct ValuesWatcher { /* private fields */ }Expand description
Watches the values directory for changes, reloading if there are any. If the directory does not exist we do not panic
Does not do an initial fetch, assumes the caller has already loaded values. Child thread may panic if we run out of memory or cannot create more threads.
Uses polling for now, could use inotify or similar later on.
Some important notes:
- If the thread panics and dies, there is no built in mechanism to catch it and restart
- If a config map is unmounted, we won’t reload until the next file modification (because we don’t catch the deletion event)
- If any namespace fails validation, we keep all old values (even the namespaces that passed validation)
- If we have a steady stream of readers our writer may starve for a while trying to acquire the lock
- stop() will block until the thread gets joined
Implementations§
Source§impl ValuesWatcher
impl ValuesWatcher
Sourcepub fn new(
values_path: &Path,
registry: Arc<SchemaRegistry>,
values: Arc<RwLock<ValuesByNamespace>>,
) -> ValidationResult<Self>
pub fn new( values_path: &Path, registry: Arc<SchemaRegistry>, values: Arc<RwLock<ValuesByNamespace>>, ) -> ValidationResult<Self>
Creates a new ValuesWatcher struct and spins up the watcher thread
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValuesWatcher
impl !RefUnwindSafe for ValuesWatcher
impl Send for ValuesWatcher
impl Sync for ValuesWatcher
impl Unpin for ValuesWatcher
impl !UnwindSafe for ValuesWatcher
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
Mutably borrows from an owned value. Read more