@@ -168,6 +168,8 @@ struct db_conn {
168168 }
169169 };
170170 using ID_ARRAYS = std::map<const char *, std::vector<uint32_t >, xless>;
171+ /* As long as any NOTIFQ object is alive, dbase should be held at least read-locked. */
172+ using NOTIFQ = std::vector<std::pair<DB_NOTIFY_DATAGRAM, ID_ARRAYS>>;
171173
172174 db_conn (db_base &);
173175 ~db_conn ();
@@ -179,20 +181,20 @@ struct db_conn {
179181 db_base_wr_ptr lock_base_wr ();
180182 void update_dynamic (uint64_t folder_id, uint32_t search_flags, const RESTRICTION *prestriction, const LONGLONG_ARRAY *pfolder_ids, db_base &);
181183 void delete_dynamic (uint64_t folder_id, db_base *);
182- void proc_dynamic_event (cpid_t , enum dynamic_event, uint64_t id1, uint64_t id2, uint64_t id3, db_base &);
183- void notify_new_mail (uint64_t folder_id, uint64_t msg_id, db_base &);
184- void notify_message_creation (uint64_t folder_id, uint64_t msg_id, db_base &);
185- void notify_link_creation (uint64_t parent_id, uint64_t msg_id, db_base &);
186- void notify_folder_creation (uint64_t parent_id, uint64_t folder_id, const db_base &);
187- void notify_message_deletion (uint64_t folder_id, uint64_t msg_id, db_base &);
188- void notify_link_deletion (uint64_t parent_id, uint64_t msg_id, db_base &);
189- void notify_folder_deletion (uint64_t parent_id, uint64_t folder_id, const db_base &);
190- void notify_message_modification (uint64_t folder_id, uint64_t msg_id, db_base &);
191- void notify_folder_modification (uint64_t parent_id, uint64_t folder_id, const db_base &);
192- void notify_message_movecopy (BOOL b_copy, uint64_t folder_id, uint64_t msg_id, uint64_t old_fid, uint64_t old_mid, db_base &);
193- void notify_folder_movecopy (BOOL b_copy, uint64_t parent_id, uint64_t folder_id, uint64_t old_pid, uint64_t old_fid, const db_base &);
194- void notify_cttbl_reload (uint32_t table_id, const db_base &);
195- void transport_new_mail (uint64_t folder_id, uint64_t msg_id, uint32_t msg_flags, const char *klass, const db_base &);
184+ void proc_dynamic_event (cpid_t , enum dynamic_event, uint64_t id1, uint64_t id2, uint64_t id3, db_base &, NOTIFQ & );
185+ void notify_new_mail (uint64_t folder_id, uint64_t msg_id, db_base &, NOTIFQ & );
186+ void notify_message_creation (uint64_t folder_id, uint64_t msg_id, db_base &, NOTIFQ & );
187+ void notify_link_creation (uint64_t parent_id, uint64_t msg_id, db_base &, NOTIFQ & );
188+ void notify_folder_creation (uint64_t parent_id, uint64_t folder_id, const db_base &, NOTIFQ & );
189+ void notify_message_deletion (uint64_t folder_id, uint64_t msg_id, db_base &, NOTIFQ & );
190+ void notify_link_deletion (uint64_t parent_id, uint64_t msg_id, db_base &, NOTIFQ & );
191+ void notify_folder_deletion (uint64_t parent_id, uint64_t folder_id, const db_base &, NOTIFQ & );
192+ void notify_message_modification (uint64_t folder_id, uint64_t msg_id, db_base &, NOTIFQ & );
193+ void notify_folder_modification (uint64_t parent_id, uint64_t folder_id, const db_base &, NOTIFQ & );
194+ void notify_message_movecopy (BOOL b_copy, uint64_t folder_id, uint64_t msg_id, uint64_t old_fid, uint64_t old_mid, db_base &, NOTIFQ & );
195+ void notify_folder_movecopy (BOOL b_copy, uint64_t parent_id, uint64_t folder_id, uint64_t old_pid, uint64_t old_fid, const db_base &, NOTIFQ & );
196+ void notify_cttbl_reload (uint32_t table_id, const db_base &, NOTIFQ & );
197+ void transport_new_mail (uint64_t folder_id, uint64_t msg_id, uint32_t msg_flags, const char *klass, const db_base &, NOTIFQ & );
196198 void begin_batch_mode (db_base &);
197199 /* pdb will also be put */
198200 static void commit_batch_mode_release (std::optional<db_conn> &&pdb, db_base_wr_ptr &&base);
@@ -221,6 +223,7 @@ extern BOOL db_engine_vacuum(const char *path);
221223BOOL db_engine_unload_db (const char *path);
222224extern BOOL db_engine_enqueue_populating_criteria (const char *dir, cpid_t , uint64_t folder_id, BOOL recursive, const RESTRICTION *, const LONGLONG_ARRAY *folder_ids);
223225extern bool db_engine_check_populating (const char *dir, uint64_t folder_id);
226+ extern void dg_notify (db_conn::NOTIFQ &&);
224227
225228extern unsigned int g_exmdb_schema_upgrades, g_exmdb_search_pacing;
226229extern unsigned long long g_exmdb_search_pacing_time, g_exmdb_lock_timeout;
0 commit comments