Tizen 2.1 base
[framework/multimedia/media-server.git] / common / include / media-server-db-svc.h
1 /*
2  *  Media Server
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Yong Yeon Kim <yy9875.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 /**
23  * This file defines api utilities of contents manager engines.
24  *
25  * @file                media-server-db-svc.h
26  * @author      Yong Yeon Kim(yy9875.kim@samsung.com)
27  * @version     1.0
28  * @brief
29  */
30 #ifndef _MEDIA_SERVER_DB_SVC_H_
31 #define _MEDIA_SERVER_DB_SVC_H_
32
33 #include "media-server-types.h"
34 #if MS_INOTI_ENABLE
35 typedef int (*CHECK_ITEM)(const char*, const char*, char **);
36 typedef int (*CONNECT)(void**, char **);
37 typedef int (*DISCONNECT)(void*, char **);
38 typedef int (*CHECK_ITEM_EXIST)(void*, const char*, int, char **);
39 typedef int (*INSERT_ITEM_BEGIN)(void*, int, char **);
40 typedef int (*INSERT_ITEM_END)(void*, char **);
41 typedef int (*INSERT_ITEM)(void*, const char*, int, const char*, char **);
42 typedef int (*INSERT_ITEM_IMMEDIATELY)(void*, const char*, int, const char*, char **);
43 typedef int (*MOVE_ITEM_BEGIN)(void*, int, char **);
44 typedef int (*MOVE_ITEM_END)(void*, char **);
45 typedef int (*MOVE_ITEM)(void*, const char*, int, const char*, int, const char*, char **);
46 typedef int (*SET_ALL_STORAGE_ITEMS_VALIDITY)(void*, int, int, char **);
47 typedef int (*SET_ITEM_VALIDITY_BEGIN)(void*, int, char **);
48 typedef int (*SET_ITEM_VALIDITY_END)(void*, char **);
49 typedef int (*SET_ITEM_VALIDITY)(void*, const char*, int, const char*, int, char **);
50 typedef int (*DELETE_ITEM)(void*, const char*, int, char **);
51 typedef int (*DELETE_ALL_ITEMS_IN_STORAGE)(void*, int, char **);
52 typedef int (*DELETE_ALL_INVALID_ITMES_IN_STORAGE)(void*, int, char **);
53 typedef int (*UPDATE_BEGIN)(char **);
54 typedef int (*UPDATE_END)(char **);
55 typedef int (*REFRESH_ITEM)(void*, const char *, int, const char*, char**);
56
57 int
58 ms_load_functions(void);
59
60 void
61 ms_unload_functions(void);
62
63 int
64 ms_connect_db(void ***handle);
65
66 int
67 ms_disconnect_db(void ***handle);
68
69 int
70 ms_validate_item(void **handle, char *path);
71
72 int
73 ms_register_file(void **handle, const char *path, GAsyncQueue* queue);
74
75 int
76 ms_insert_item_batch(void **handle, const char *path);
77
78 int
79 ms_insert_item(void **handle, const char *path);
80
81 int
82 ms_delete_item(void **handle, const char *full_file_path);
83
84 int
85 ms_move_item(void **handle,
86                         ms_storage_type_t src_store_type,
87                         ms_storage_type_t dest_store_type,
88                         const char *src_file_full_path,
89                         const char *dest_file_full_path);
90
91 bool
92 ms_delete_all_items(void **handle, ms_storage_type_t store_type);
93
94 int
95 ms_invalidate_all_items(void **handle, ms_storage_type_t store_type);
96
97 bool
98 ms_delete_invalid_items(void **handle, ms_storage_type_t store_type);
99
100 int
101 ms_refresh_item(void **handle, const char *path);
102
103 int
104 ms_check_exist(void **handle, const char *path);
105
106 /****************************************************************************************************
107 FOR BULK COMMIT
108 *****************************************************************************************************/
109
110 void
111 ms_register_start(void **handle);
112
113 void
114 ms_register_end(void **handle);
115
116 void
117 ms_move_start(void **handle);
118
119 void
120 ms_move_end(void **handle);
121
122 void
123 ms_validate_start(void **handle);
124
125 void
126 ms_validate_end(void **handle);
127 #else
128 typedef int (*CHECK_ITEM)(const char*, const char*, char **);
129 typedef int (*CONNECT)(void**, char **);
130 typedef int (*DISCONNECT)(void*, char **);
131 typedef int (*CHECK_ITEM_EXIST)(void*, const char*, int, char **);
132 typedef int (*INSERT_ITEM_IMMEDIATELY)(void*, const char*, int, const char*, char **);
133 typedef int (*SET_ALL_STORAGE_ITEMS_VALIDITY)(void*, int, int, char **);
134
135 int
136 ms_load_functions(void);
137
138 void
139 ms_unload_functions(void);
140
141 int
142 ms_connect_db(void ***handle);
143
144 int
145 ms_disconnect_db(void ***handle);
146
147 int
148 ms_insert_item(void **handle, const char *path);
149
150 int
151 ms_register_file(void **handle, const char *path);
152
153 int
154 ms_check_exist(void **handle, const char *path);
155
156 int
157 ms_invalidate_all_items(void **handle, ms_storage_type_t store_type);
158 #endif
159
160 #endif /*_MEDIA_SERVER_DB_SVC_H_*/