| 1785 | } |
| 1786 | |
| 1787 | static struct command_result *paginated_refresh(struct command *cmd, |
| 1788 | struct table_desc *td, |
| 1789 | struct db_query *dbq) |
| 1790 | { |
| 1791 | /* In case something was deleted (rare!) we just reload the |
| 1792 | * entire thing */ |
| 1793 | if (td->refresh_needs & REFRESH_DELETED) { |
| 1794 | plugin_log(cmd->plugin, LOG_DBG, "%s: total reload due to delete", td->name); |
| 1795 | /* Since this reloads everything, covers all: updates and creates */ |
| 1796 | td->refresh_needs = REFRESH_UNNECESSARY; |
| 1797 | return default_refresh(cmd, td, dbq); |
| 1798 | } |
| 1799 | |
| 1800 | if (td->refresh_needs & REFRESH_UPDATED) { |
| 1801 | struct out_req *req; |
| 1802 | plugin_log(cmd->plugin, LOG_DBG, |
| 1803 | "%s: records updated, updating from %"PRIu64, td->name, td->last_updated_index + 1); |
| 1804 | td->refresh_needs &= ~REFRESH_UPDATED; |
| 1805 | req = jsonrpc_request_start(cmd, td->cmdname, |
| 1806 | updated_list_done, forward_error, |
| 1807 | dbq); |
| 1808 | json_add_string(req->js, "index", "updated"); |
| 1809 | json_add_u64(req->js, "start", td->last_updated_index + 1); |
| 1810 | return send_outreq(req); |
| 1811 | } |
| 1812 | |
| 1813 | /* No updates, no deletes: the simple case! */ |
| 1814 | plugin_log(cmd->plugin, LOG_DBG, |
| 1815 | "%s: records created, inserting from %"PRIu64, td->name, td->last_created_index + 1); |
| 1816 | return refresh_by_created_index(cmd, td, dbq); |
| 1817 | } |
| 1818 | |
| 1819 | struct refresh_funcs { |
| 1820 | const char *cmdname; |
nothing calls this directly
no test coverage detected