Changed file and key-value API according GENIVI naming conventions
[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 "../include_protected/persistence_client_library_data_organization.h"
24 #include "../include_protected/persistence_client_library_rc_table.h"
25
26 #include <itzam.h>
27
28 /**
29  * @brief Create database search key and database location path
30  *
31  * @param dbContext the database context
32  * @param resource_id the resource id
33  * @param user_no user identification
34  * @param seat_no seat identifier
35  * @param isFile identifier if this resource is a file
36  * @param dbKey the array where the database key will be stored
37  * @param dbPath the array where the database location path will be stored
38  * @param cached_resource flag to identify if the resource is cached (value 1)or write through (value 0)
39  *
40  * @return 1 if shared database and 0 if local database or PersistenceStoragePolicy_LastEntry
41  *         when no valid database has been found
42  */
43 int get_db_path_and_key(PersistenceInfo_s* dbContext, const char* resource_id, unsigned int isFile, char dbKey[], char dbPath[]);
44
45
46
47 /**
48  * Create database search key and database location path
49  *
50  * @param dbContext the database context
51  * @param resource_id the resource id
52  * @param user_no user identification
53  * @param seat_no seat identifier
54  * @param isFile identifier if this resource is a file
55  * @param dbKey the array where the database key will be stored
56  * @param dbPath the array where the database location path will be stored
57  * @param cached_resource flag to identify if the resource is cached (value 1)or write through (value 0)
58  *
59  * @return 0 or a negative value with one of the following errors: EPERS_NOKEYDATA or EPERS_NOPRCTABLE
60  */
61 int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsigned int isFile, char dbKey[], char dbPath[]);
62
63
64
65 /**
66  * @brief get the resource configuration table gvbd database by id
67  *
68  * @return pointer to the gvdb database table or NULL if no valid database has been found
69  */
70 itzam_btree* get_resource_cfg_table_by_idx(int i);
71
72
73
74 #endif /* PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H */