void ImageCtx::notify_update() {
state->handle_update_notification();
-
- C_SaferCond ctx;
- image_watcher->notify_header_update(&ctx);
- ctx.wait();
+ ImageWatcher::notify_header_update(md_ctx, header_oid);
}
void ImageCtx::notify_update(Context *on_finish) {
m_notifier.notify(bl, nullptr, on_finish);
}
+void ImageWatcher::notify_header_update(librados::IoCtx &io_ctx,
+ const std::string &oid) {
+ // supports legacy (empty buffer) clients
+ bufferlist bl;
+ ::encode(NotifyMessage(HeaderUpdatePayload()), bl);
+ io_ctx.notify2(oid, bl, image_watcher::Notifier::NOTIFY_TIMEOUT, nullptr);
+}
+
void ImageWatcher::schedule_cancel_async_requests() {
FunctionContext *ctx = new FunctionContext(
boost::bind(&ImageWatcher::cancel_async_requests, this));
void notify_request_lock();
void notify_header_update(Context *on_finish);
+ static void notify_header_update(librados::IoCtx &io_ctx,
+ const std::string &oid);
uint64_t get_watch_handle() const {
RWLock::RLocker watch_locker(m_watch_lock);