Protected global variables with mutex; minor optimizations; corrected doxygen documen...
[profile/ivi/persistence-client-library.git] / src / persistence_client_library_prct_access.h
1 #ifndef PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H
2 #define PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H
3
4 /******************************************************************************
5  * Project         Persistency
6  * (c) copyright   2012
7  * Company         XS Embedded GmbH
8  *****************************************************************************/
9 /******************************************************************************
10  * This Source Code Form is subject to the terms of the
11  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed
12  * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 ******************************************************************************/
14  /**
15  * @file           persistence_client_library_prct_access.h
16  * @ingroup        Persistence client library
17  * @author         Ingo Huerner
18  * @brief          Header of persistence resource configuration config
19  *                 table access functions
20  * @see
21  */
22
23 #include "persistence_client_library_data_organization.h"
24
25 /**
26  * @brief Create database search key and database location path
27  *
28  * @param dbContext the database context
29  * @param resource_id the resource id
30  * @param dbKey the array where the database key will be stored
31  * @param dbPath the array where the database location path will be stored
32  *
33  * @return 1 if shared database and 0 if local database or PersistenceStoragePolicy_LastEntry
34  *         when no valid database has been found
35  */
36 int get_db_path_and_key(PersistenceInfo_s* dbContext, const char* resource_id, char dbKey[], char dbPath[]);
37
38
39
40 /**
41  * @brief Create database search key and database location path
42  *
43  * @param dbContext the database context
44  * @param resource_id the resource id
45  * @param isFile identifier if this resource is a file (used for file/key creation if resource does not exist)
46  * @param dbKey the array where the database key will be stored
47  * @param dbPath the array where the database location path will be stored
48  *
49  * @return 0 or a negative value with one of the following errors: EPERS_NOKEYDATA or EPERS_NOPRCTABLE
50  */
51 int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsigned int isFile, char dbKey[], char dbPath[]);
52
53
54
55 /**
56  * @brief get the resource configuration table gvbd database by id
57  *
58  * @return i Handle to the gvdb database table or negative value if no valid database has been found
59  */
60 int get_resource_cfg_table_by_idx(int i);
61
62
63 /**
64  * @brief mark the resource configuration table as closed
65  *
66  * @param i the index
67  */
68 void invalidate_resource_cfg_table(int i);
69
70
71
72 #endif /* PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H */