f9e2d3c534b1fabc96504ba7f5936c058134204a
[platform/core/system/sync-agent.git] / src / framework / data-adapter / agent_handler_manager_internal.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef AGENT_HANDLER_MANAGER_INTERNAL_H_
19 #define AGENT_HANDLER_MANAGER_INTERNAL_H_
20
21 #include "data-adapter/common_internal.h"
22 #include "data-adapter/agent_handler_manager.h"
23 #include "account/manager.h"
24
25 /**
26  * @file                agent_handler_manager_internal.h
27  * @brief       Interface list to use framework Common DataBase
28  */
29
30 /** @addtogroup data_adapter
31  *      @{
32  */
33
34 /**
35  * @brief Alloc the agent db handler manager
36  * @return Operation result
37  * @retval SYNC_AGENT_DA_SUCCESS success
38  * @retval SYNC_AGENT_DA_ERR_DB_HANDLER_MGR error
39  */
40 sync_agent_da_return_e da_alloc_agentdb_handler_mgr(void);
41
42 /**
43  * @brief Free the agent db handler manager
44  * @return Operation result
45  * @retval SYNC_AGENT_DA_SUCCESS success
46  * @retval SYNC_AGENT_DA_ERR_DB_HANDLER_MGR error
47  */
48 sync_agent_da_return_e da_free_agentdb_handler_mgr(void);
49
50 /**
51  * @brief Delete all accounts data from Email-Service, Contacts-Service database, Calendar-Service database, Agent database
52  * @return Operation result
53  * @retval SYNC_AGENT_DA_SUCCESS success
54  * @retval SYNC_AGENT_DA_ERRORS error
55  */
56 sync_agent_da_return_e da_clear_all_database_account(void);
57
58 /**
59  * @brief Delete one account data from Email-Service, Contacts-Service database, Calendar-Service database, Agent database
60  * @param[in] account_id account id of sync-agent-framework
61  * @return Operation result
62  * @retval SYNC_AGENT_DA_SUCCESS success
63  * @retval SYNC_AGENT_DA_ERR_DELETE_LAST_ACCOUNT success ( delete last account )
64  * @retval SYNC_AGENT_DA_ERRORS error
65  */
66 sync_agent_da_return_e da_delete_all_database_account(int account_id);
67
68 /**
69  * @brief Create agent database
70  * @return Operation result
71  * @retval SYNC_AGENT_DA_SUCCESS success
72  * @retval SYNC_AGENT_DA_ERR_CLOSE_FAILED error
73  */
74 sync_agent_da_return_e da_create_agent_default_table_wrapper(void);
75
76 /**
77  * @brief Insert account into account_tbl
78  * @param[in]   account account information
79  * @return Operation result
80  * @retval account id (positive number) success
81  * @retval -1 error
82  */
83 int da_add_fw_account_id(sync_agent_fw_account_s * account);
84
85 /**
86  * @brief Update account data
87  * @param[in]   account account information
88  * @return Operation result
89  * @retval SYNC_AGENT_DA_SUCCESS success
90  * @retval negative value error
91  */
92 sync_agent_da_return_e da_update_fw_account_id(sync_agent_fw_account_s * account);
93
94 /**
95  * @brief Delete account data from agent database
96  * @param[in]   account_id account id that user want to delete
97  * @return Operation result
98  * @retval SYNC_AGENT_DA_SUCCESS success
99  * @retval negative value error
100  */
101 sync_agent_da_return_e da_delete_fw_account_id(int account_id);
102
103 /**
104  * @brief Get account data from agent database
105  * @param[in] account_id account id of account data that user want to get
106  * @param[in] account as returned by da_get_fw_account_info() - account data
107  * @return Operation result
108  * @retval SYNC_AGENT_DA_SUCCESS success
109  * @retval negative value error
110  */
111 sync_agent_da_return_e da_get_fw_account_info(int account_id, sync_agent_fw_account_s ** account);
112
113 /**
114  * @brief Get all account data from agent database
115  * @param[in] list as returned by da_get_all_fw_account_info() - list of sync_agent_fw_account_s
116  * @return Operation result
117  * @retval SYNC_AGENT_DA_SUCCESS success
118  * @retval negative value error
119  */
120 sync_agent_da_return_e da_get_all_fw_account_info(GList ** list);
121
122 /**
123  * @brief Get account data by access name from agent database
124  * @param[in] access_name database access name
125  * @param[in] list as returned by da_get_fw_account_info_by_access_name() - list of sync_agent_fw_account_s
126  * @return Operation result
127  * @retval SYNC_AGENT_DA_SUCCESS success
128  * @retval negative value error
129  */
130 sync_agent_da_return_e da_get_fw_account_info_by_access_name(char *access_name, GList ** list);
131
132 /**
133  * @brief Checking whether the account id exist in account_tbl
134  * @param[in] account_id account id
135  * @return Checking result
136  * @retval 1 exist
137  * @retval 0 (or error value) not exist
138  */
139 int da_is_exist_account_id(int account_id);
140
141 /**
142  * @brief Delete folder from folder_tbl by folder id
143  * @param[in]   folder_id folder id
144  * @return Operation result
145  * @retval SYNC_AGENT_DA_SUCCESS success
146  * @retval negative value error
147  */
148 sync_agent_da_return_e da_delete_folder_by_folder_id_wrapper(char *folder_id);
149
150 /**
151  * @brief Get folder id from folder_tbl
152  * @param[in]   account_id account id
153  * @param[in]   item_type_id item type id
154  * @param[in]   service_id service id
155  * @param[in]   folder_type_id folder type id
156  * @return Operation result
157  * @retval folder id success
158  * @retval NULL error
159  */
160 char *da_get_folder_id_by_service_id_wrapper(int account_id, int item_type_id, char *service_id, int folder_type_id);
161
162 /**
163  * @brief Get all item id from item_tbl
164  * @return Operation result
165  * @retval array of item id success
166  * @retval NULL error
167  */
168 sync_agent_da_id_list_s *da_get_all_item_id_wrapper(void);
169
170 /**
171  * @brief Checking whether the item_id exist in item_tbl
172  * @param[in]   item_id item id
173  * @return Checking result
174  * @retval 1 exist
175  * @retval 0 (or error value) not exist
176  */
177 int da_is_exist_item_wrapper(char *item_id);
178
179 /**
180  * @brief Insert itemChangelog into account_item_changelog_tbl
181  * @param[in]   account_id account id
182  * @param[in]   item_changelog array of itemChangelog info
183  * @param[in]   count count of itemChangelog info
184  * @return Operation result
185  * @retval SYNC_AGENT_DA_SUCCESS success
186  * @retval negative value error
187  */
188 sync_agent_da_return_e da_add_item_changelog_wrapper(int account_id, sync_agent_da_item_changelog_s * item_changelog, int count);
189
190 /**
191  * @brief Set operation id and syncStatus to account_item_changelog_tbl
192  * @param[in]   account_id account id
193  * @param[in]   item_changelog itemChangelog info (operationId, syncStatus, accessName, itemId)
194  * @return Operation result
195  * @retval SYNC_AGENT_DA_SUCCESS success
196  * @retval negative value error
197  */
198 sync_agent_da_return_e da_set_item_changelog_operation_id_wrapper(int account_id, sync_agent_da_item_changelog_s * item_changelog);
199
200 /**
201  * @brief Checking whether the item id exist in account_item_changelog_tbl
202  * @param[in]   account_id account id
203  * @param[in]   item_id item id
204  * @return Checking result
205  * @retval 1 exist
206  * @retval 0(or error value) not exist
207  */
208 int da_is_exist_item_changelog_wrapper(int account_id, char *item_id);
209
210 /**
211  * @brief Insert id_provider into id_provider_tbl
212  * @param[in]   id_provider id provider info
213  * @return Operation result
214  * @retval SYNC_AGENT_DA_SUCCESS success
215  * @retval negative value error
216  */
217 sync_agent_da_return_e da_add_id_provider_wrapper(sync_agent_da_id_provider_s * id_provider);
218
219 /**
220  * @brief Get id_provider from id_provider_tbl
221  * @param[in]   id_provider_code id provider code
222  * @param[in] id_provider as returned by da_get_id_provider_wrapper() - id provider info
223  * @return Operation result
224  * @retval SYNC_AGENT_DA_SUCCESS success
225  * @retval negative value error
226  */
227 sync_agent_da_return_e da_get_id_provider_wrapper(unsigned int id_provider_code, sync_agent_da_id_provider_s ** id_provider);
228
229 /**
230  * @brief Update id provider in id_provider_tbl
231  * @param[in]   id_provider id provider info
232  * @return Operation result
233  * @retval SYNC_AGENT_DA_SUCCESS success
234  * @retval negative value error
235  */
236 sync_agent_da_return_e da_update_id_provider_wrapper(sync_agent_da_id_provider_s * id_provider);
237
238 /**
239  * @brief       Insert id_page into id_page_tbl
240  * @param[in]   id_page id page info
241  * @param[in] page_byte_size page byte size
242  * @return Operation result
243  * @retval SYNC_AGENT_DA_SUCCESS success
244  * @retval negative value error
245  */
246 sync_agent_da_return_e da_add_id_page_wrapper(sync_agent_da_id_page_s * id_page, unsigned int page_byte_size);
247
248 /**
249  * @brief Delete id_page from id_page_tbl by page index
250  * @param[in]   id_provider_code id provider code
251  * @param[in]   page_index page index
252  * @return Operation result
253  * @retval SYNC_AGENT_DA_SUCCESS success
254  * @retval negative value error
255  */
256 sync_agent_da_return_e da_delete_id_page_wrapper(unsigned int id_provider_code, unsigned int page_index);
257
258 /**
259  * @brief       Get id_page into id_page_tbl
260  * @param[in] id_provider_code id provider code
261  * @param[in]   page_index page index
262  * @param[in]   page_bit as returned by da_get_id_page_wrapper() - page bit
263  * @return Operation result
264  * @retval SYNC_AGENT_DA_SUCCESS success
265  * @retval negative value error
266  */
267 sync_agent_da_return_e da_get_id_page_wrapper(unsigned int id_provider_code, unsigned int page_index, char **page_bit);
268
269 /**
270  * @brief       Get count of page index
271  * @param[in]   id_provider_code id provider code
272  * @param[in]   count as returned by da_get_id_page_index_wrapper() - count of page index
273  * @return Operation result
274  * @retval SYNC_AGENT_DA_SUCCESS success
275  * @retval negative value       error
276  */
277 sync_agent_da_return_e da_get_id_page_index_wrapper(unsigned int id_provider_code, int *count);
278
279 /**
280  * @brief       Insert id_page into id_page_tbl
281  * @param[in]   id_page id_page info
282  * @param[in]   page_byte_size page_bit's byte size
283  * @return Operation result
284  * @retval SYNC_AGENT_DA_SUCCESS success
285  * @retval negative value error
286  */
287 sync_agent_da_return_e da_update_id_page_wrapper(sync_agent_da_id_page_s * id_page, unsigned int page_byte_size);
288
289 /**
290  * @brief Add the handler pointer to handler hash table
291  * @param[in]   key     unique key to distinguish handler pointer
292  * @param[in]   handler db handler pointer
293  * @return Operation result
294  * @retval SYNC_AGENT_DA_SUCCESS success
295  * @retval SYNC_AGENT_DA_ERR_DB_HANDLER_MGR error
296  */
297 sync_agent_da_return_e da_add_agent_handler(unsigned int key, SYNC_AGENT_DA_HANDLER * handler);
298
299 /**
300  * @brief Add the handler pointer to handler hash table
301  * @param[in]   key unique key to distinguish handler pointer
302  * @return Operation result
303  * @retval SYNC_AGENT_DA_SUCCESS success
304  * @retval SYNC_AGENT_DA_ERR_DB_HANDLER_MGR error
305  */
306 sync_agent_da_return_e da_remove_agent_handler(unsigned int key);
307
308 /**
309  * @brief Add the handler pointer to handler hash table
310  * @param[in]   key     unique key to distinguish handler pointer
311  * @return Operation result
312  * @retval SYNC_AGENT_DA_SUCCESS success
313  * @retval SYNC_AGENT_DA_ERR_DB_HANDLER_MGR error
314  */
315 SYNC_AGENT_DA_HANDLER *da_get_agent_handler(unsigned int key);
316
317 /**
318  * @brief Get all account_id from account_tbl
319  * @param[in] count as returned by da_get_account_id_list() - count of account id
320  * @return Operation result
321  * @retval array of account id success
322  * @retval NULL error
323  */
324 int *da_get_account_id_list(int *count);
325
326 /**
327  * @brief       Insert folder into folder_tbl
328  * @param[in]   folder array of folder info
329  * @param[in] count as returned by da_add_folder_internal() - count of folder info
330  * @return Operation result
331  * @retval SYNC_AGENT_DA_SUCCESS success
332  * @retval negative value error
333  */
334 sync_agent_da_return_e da_add_folder_internal(sync_agent_da_folder_s * folder, int count);
335
336 /**
337  * @brief Get folder id from folder_tbl by folder type id
338  * @param[in]   account_id account id
339  * @param[in]   item_type_id item type id
340  * @param[in]   folder_type_id folder type id
341  * @return Operation result
342  * @retval folder id success
343  * @retval NULL error
344  */
345 sync_agent_da_id_list_s *da_get_folder_id_by_folder_type_id_internal(int account_id, int item_type_id, int folder_type_id);
346
347 /**
348  * @brief Get all folder_id_list from folder_tbl by data_store_id
349  *                              Get all the folders in account and data store
350  * @param[in]   account_id account id
351  * @param[in]   item_type_id item type id
352  * @return Operation result
353  * @retval array of folder id success
354  * @retval NULL error
355  */
356 sync_agent_da_id_list_s *da_get_folder_id_list_by_item_type_id_internal(int account_id, int item_type_id);
357
358 /**
359  * @brief Get item from folder_tbl
360  *                              Belonging to different account of folder get folder with the same service_id
361  * @param[in]   account_id account id
362  * @param[in]   folder_id folder id
363  * @param[in]   count as returned by da_get_item_mapping_service_id_by_folder_id_internal() - count of item info
364  * @return Operation result
365  * @retval array of folder info success
366  * @retval NULL error
367  */
368 sync_agent_da_folder_s *da_get_item_mapping_service_id_by_folder_id_internal(int account_id, char *folder_id, int *count);
369
370 /**
371  * @brief       Insert item into item_tbl - currently unused function
372  * @param[in]   item array of item info
373  * @param[in]   count count of item info
374  * @return Operation result
375  * @retval SYNC_AGENT_DA_SUCCESS success
376  * @retval negative value error
377  */
378 sync_agent_da_return_e da_add_item_internal(sync_agent_da_item_s * item, int count);
379
380 /**
381  * @brief       Insert item into item_tbl
382  * @param[in]   item array of item info
383  * @param[in]   count count of item info
384  * @param[in] item_id as returned by sync_agent_add_item_new() - id of newly added item
385  * @return Operation result
386  * @retval SYNC_AGENT_DA_SUCCESS success
387  * @retval negative value error
388  */
389 sync_agent_da_return_e sync_agent_add_item_new(sync_agent_da_item_s * item, int count, char **item_id);
390
391 /**
392  * @brief Delete item from item_tbl by item id
393  * @param[in]   item_id item id
394  * @return Operation result
395  * @retval SYNC_AGENT_DA_SUCCESS success
396  * @retval negative value error
397  */
398 sync_agent_da_return_e da_delete_item_by_item_id_internal(char *item_id);
399
400 /**
401  * @brief Delete item from item_tbl by account id and item type id
402  * @param[in]   account_id account id
403  * @param[in]   item_type_id item type id
404  * @return Operation result
405  * @retval SYNC_AGENT_DA_SUCCESS success
406  * @retval negative value error
407  */
408 sync_agent_da_return_e da_delete_item_by_item_type_id_internal(int account_id, int item_type_id);
409
410 /**
411  * @brief Delete item from item_tbl by account id and item type id and row that checked delete from changelog tbl
412  * @param[in]   account_id account id
413  * @param[in]   item_type_id item type id
414  * @return Operation result
415  * @retval SYNC_AGENT_DA_SUCCESS success
416  * @retval negative value error
417  */
418 sync_agent_da_return_e da_delete_item_and_changelog_by_item_type_id_internal(int account_id, int item_type_id);
419
420 /**
421  * @brief Get item id from item_tbl
422  * @param[in]   account_id account id
423  * @param[in]   service_id service id
424  * @param[in]   item_type_id item type id
425  * @return Operation result
426  * @retval item id success
427  * @retval NULL error
428  */
429 char *da_get_item_id_internal(int account_id, char *service_id, int item_type_id);
430
431 /**
432  * @brief Get item information from item_tbl
433  * @param[in]   item_id item id
434  * @return Operation result
435  * @retval item info success
436  * @retval NULL error
437  */
438 sync_agent_da_item_s *da_get_item_internal(char *item_id);
439
440 /**
441  * @brief Get all id in folder from item_tbl
442  * @param[in]   folder_id folder id
443  * @param[in]   column_name column name (COLUMN_NAME_ITEM_ID or COLUMN_NAME_SERVICE_ID)
444  * @return Operation result
445  * @retval array of item id success
446  * @retval NULL error
447  */
448 sync_agent_da_id_list_s *da_get_item_id_list_internal(char *folder_id, sync_agent_da_column_name_e column_name);
449
450 /**
451  * @brief Get item from item_tbl by account id
452  *                              Get all the items in account
453  * @param[in]   account_id account id
454  * @param[in]   item_type_id item type id
455  * @param[in]   count as returned by da_get_item_by_account_id_internal() - count of item info
456  * @return Operation result
457  * @retval array of item info success
458  * @retval NULL error
459  */
460 sync_agent_da_item_s *da_get_item_by_account_id_internal(int account_id, int item_type_id, int *count);
461
462 /**
463  * @brief Get item data from item_tbl and account_item_changelog_tbl
464  *                              Among the items that belong to the itemTypeId, Search for item info belong to the changelog
465  * @param[in]   account_id account id
466  * @param[in]   item_type_id item type id
467  * @param[in]   count as returned by da_get_item_info_by_item_type_id_internal() - count of item data
468  * @return Operation result
469  * @retval array of item data success
470  * @retval NULL error
471  */
472 sync_agent_da_item_info_s *da_get_item_info_by_item_type_id_internal(int account_id, int item_type_id, int *count);
473
474 /**
475  * @brief Get item from item_tbl
476  *                              Belonging to different account of item get item with the same service_id
477  * @param[in]   account_id account id
478  * @param[in]   item_id item id
479  * @param[in]   count as returned by da_get_item_mapping_service_id_by_item_id_internal() - count of item info
480  * @return Operation result
481  * @retval array of item info success
482  * @retval NULL error
483  */
484 sync_agent_da_item_s *da_get_item_mapping_service_id_by_item_id_internal(int account_id, char *item_id, int *count);
485
486 /**
487  * @brief Get all id from item_tbl
488  * @param[in]   data_store_id data store id
489  * @return Operation result
490  * @retval array of item id success
491  * @retval NULL error
492  */
493 sync_agent_da_id_list_s *da_get_item_id_list_by_data_store_id_internal(int data_store_id);
494
495 /**
496  * @brief Get item id list
497  * @param[in]   account_id sync-agent-framework account id
498  * @param[in]   data_store_id data store id
499  * @return Operation result
500  * @retval array of item id success
501  * @retval NULL error or not exist
502  */
503 sync_agent_da_id_list_s *da_get_item_id_list_by_data_store_id_with_account_id_internal(int account_id, int data_store_id);
504
505 /**
506  * @brief Get item id list from item_tbl and account_item_changelog_tbl
507  *                              Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id
508  * @param[in]   account_id account id
509  * @param[in]   data_store_id data store id
510  * @param[in]   operation_id operation id
511  * @return Operation result
512  * @retval array of item id success
513  * @retval NULL error
514  */
515 sync_agent_da_id_list_s *da_get_item_id_list_by_operation_id_internal(int account_id, int data_store_id, int operation_id);
516
517 /**
518  * @brief Get item id list from item_tbl and account_item_changelog_tbl
519  *                              Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id and folder_id
520  * @param[in]   account_id account id
521  * @param[in]   folder_id folder id
522  * @param[in]   data_store_id data store id
523  * @param[in]   operation_id operation id
524  * @return Operation result
525  * @retval array of item id success
526  * @retval NULL error
527  */
528 sync_agent_da_id_list_s *da_get_item_id_list_by_operation_id_and_folder_id_internal(int account_id, char *folder_id, int data_store_id, int operation_id);
529
530 /**
531  * @brief Delete itemChangelog from account_item_changelog_tbl by item id
532  * @param[in]   account_id account id
533  * @param[in]   item_id item id
534  * @return Operation result
535  * @retval SYNC_AGENT_DA_SUCCESS success
536  * @retval negative value error
537  */
538 sync_agent_da_return_e da_delete_item_changelog_by_item_id_internal(int account_id, char *item_id);
539
540 /**
541  * @brief Delete itemChangelog from account_item_changelog_tbl by item id list
542  * @param[in]   account_id account id
543  * @param[in]   item_id_list array of item id
544  * @param[in]   count count of item id
545  * @return Operation result
546  * @retval SYNC_AGENT_DA_SUCCESS success
547  * @retval negative value error
548  */
549 sync_agent_da_return_e da_delete_item_changelog_by_item_id_list_internal(int account_id, char **item_id_list, int count);
550
551 /**
552  * @brief Delete itemChangelog from account_item_changelog_tbl by item type id
553  * @param[in]   account_id account id
554  * @param[in]   item_type_id item type id
555  * @return Operation result
556  * @retval SYNC_AGENT_DA_SUCCESS success
557  * @retval negative value error
558  */
559 sync_agent_da_return_e da_delete_item_changelog_by_item_type_id_internal(int account_id, int item_type_id);
560
561 /**
562  * @brief Set syncStatus to account_item_changelog_tbl
563  * @param[in]   account_id account id
564  * @param[in]   item_changelog itemChangelog info (syncStatus, accessName, itemId)
565  * @return Operation result
566  * @retval SYNC_AGENT_DA_SUCCESS success
567  * @retval negative value error
568  */
569 sync_agent_da_return_e da_set_item_changelog_sync_status_internal(int account_id, sync_agent_da_item_changelog_s * item_changelog);
570
571 /**
572  * @brief Set SYNC_WAIT to account_item_changelog_tbl
573  *                              Among the items that match to the itemTypeId and belong to the folder
574  *                              If it existed in account_item_changelog_tbl, set SYNC_WAIT to account_item_changelog_tbl
575  * @param[in]   account_id account id
576  * @param[in]   folder_id_list array of folder id
577  * @param[in]   folder_id_count count of folder id
578  * @param[in]   item_type_id_list array of item type id
579  * @param[in]   item_type_id_count count of item type id
580  * @return Operation result
581  * @retval SYNC_AGENT_DA_SUCCESS success
582  * @retval negative value error
583  */
584 sync_agent_da_return_e da_set_item_changelog_wait_status_internal(int account_id, char **folder_id_list, int folder_id_count, int *item_type_id_list, int item_type_id_count);
585
586 /**
587  * @brief Get itemChangelog info from account_item_changelog_tbl by item id
588  * @remarks Item id that is included in sync_agent_da_item_changelog_s must be set by user when call this function
589  * @param[in]   account_id account id
590  * @param[in]   item_changelog as returned by sync_agent_get_item_changelog_by_item_id() - itemChangelog info (itemId, operationId, syncStatus, accessName)
591  * @return Operation result
592  * @retval SYNC_AGENT_DA_SUCCESS success
593  * @retval negative value error
594  */
595 sync_agent_da_return_e sync_agent_get_item_changelog_by_item_id(int account_id, sync_agent_da_item_changelog_s * item_changelog);
596
597 /**
598  * @brief       Insert anchor into last_anchor_tbl
599  * @param[in]   last_anchor last anchor info
600  * @return Operation result
601  * @retval SYNC_AGENT_DA_SUCCESS success
602  * @retval negative value error
603  */
604 sync_agent_da_return_e da_add_last_anchor_internal(sync_agent_da_last_anchor_s * last_anchor);
605
606 /**
607  * @brief Set last_anchor_server and last_anchor_client to last_anchor_tbl
608  * @param[in]   last_anchor last anchor info
609  * @return Operation result
610  * @retval SYNC_AGENT_DA_SUCCESS success
611  * @retval negative value error
612  */
613 sync_agent_da_return_e da_set_last_anchor_internal(sync_agent_da_last_anchor_s * last_anchor);
614
615 /**
616  * @brief Get last_anchor_server and last_anchor_client from last_anchor_tbl by item type id
617  * @param[in]   account_id account id
618  * @param[in]   item_type_id item type id
619  * @param[in]   count as returned by da_get_last_anchor_by_item_type_id_internal() - count of lastAnchor info
620  * @return Operation result
621  * @retval lastAnchor info success
622  * @retval NULL error
623  */
624 sync_agent_da_last_anchor_s *da_get_last_anchor_by_item_type_id_internal(int account_id, int item_type_id, int *count);
625
626 /**
627  * @brief       Insert mapping into mapping_tbl
628  * @param[in]   mapping mapping info
629  * @return Operation result
630  * @retval SYNC_AGENT_DA_SUCCESS success
631  * @retval negative value error
632  */
633 sync_agent_da_return_e da_add_mapping_internal(sync_agent_da_mapping_s * mapping);
634
635 /**
636  * @brief       Delete mapping from mapping_tbl by account id
637  * @param[in]   account_id account id
638  * @return Operation result
639  * @retval SYNC_AGENT_DA_SUCCESS success
640  * @retval negative value error
641  */
642 sync_agent_da_return_e da_delete_mapping_by_account_id_internal(int account_id);
643
644 /**
645  * @brief Delete mapping from mapping_tbl by luid
646  * @param[in]   account_id account id
647  * @param[in]   luid luid
648  * @return Operation result
649  * @retval SYNC_AGENT_DA_SUCCESS success
650  * @retval negative value error
651  */
652 sync_agent_da_return_e da_delete_mapping_by_luid_internal(int account_id, char *luid);
653
654 /**
655  * @brief Get all mapping info from mapping_tbl by account id
656  *                              Get all the mapping info in account
657  * @param[in]   account_id account id
658  * @param[in]   count as returned by da_get_mapping_by_account_id_internal() - count of mapping info
659  * @return Operation result
660  * @retval array of mapping info success
661  * @retval NULL error
662  */
663 sync_agent_da_mapping_s *da_get_mapping_by_account_id_internal(int account_id, int *count);
664
665 /**
666  * @brief Get luid from mapping_tbl by guid
667  * @param[in]   account_id account id
668  * @param[in] luid luid
669  * @return Operation result
670  * @retval guid guid
671  * @retval NULL error
672  */
673 char *da_get_mapping_guid_internal(int account_id, char *luid);
674
675 /**
676  *      @}
677  */
678
679 #endif                          /* AGENT_HANDLER_MANAGER_INTERNAL_H_ */