summaryrefslogtreecommitdiff
path: root/src/persistence_client_library_prct_access.h
blob: 2aa822e24e561c082a44c4cfe3d19c26a4e82066 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H
#define PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H

/******************************************************************************
 * Project         Persistency
 * (c) copyright   2012
 * Company         XS Embedded GmbH
 *****************************************************************************/
/******************************************************************************
 * This Source Code Form is subject to the terms of the
 * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed
 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
******************************************************************************/
 /**
 * @file           persistence_client_library_prct_access.h
 * @ingroup        Persistence client library
 * @author         Ingo Huerner
 * @brief          Header of persistence resource configuration config
 *                 table access functions
 * @see
 */

#include "persistence_client_library_data_organization.h"

/**
 * @brief Create database search key and database location path
 *
 * @param dbContext the database context
 * @param resource_id the resource id
 * @param dbKey the array where the database key will be stored
 * @param dbPath the array where the database location path will be stored
 *
 * @return 1 if shared database and 0 if local database or PersistenceStoragePolicy_LastEntry
 *         when no valid database has been found
 */
int get_db_path_and_key(PersistenceInfo_s* dbContext, const char* resource_id, char dbKey[], char dbPath[]);



/**
 * @brief Create database search key and database location path
 *
 * @param dbContext the database context
 * @param resource_id the resource id
 * @param isFile identifier if this resource is a file (used for file/key creation if resource does not exist)
 * @param dbKey the array where the database key will be stored
 * @param dbPath the array where the database location path will be stored
 *
 * @return 0 or a negative value with one of the following errors: EPERS_NO_PLUGIN_FUNCT, EPERS_NOKEYDATA or EPERS_NOPRCTABLE
 */
int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsigned int isFile, char dbKey[], char dbPath[]);



/**
 * @brief get the resource configuration table database by id
 *
 * @return i Handle to the database table or negative value if no valid database has been found
 */
int get_resource_cfg_table_by_idx(int i);


/**
 * @brief mark the resource configuration table as closed
 *
 * @param i the index
 */
void invalidate_resource_cfg_table(int i);



#endif /* PERSISTENCE_CLIENT_LIBRARY_ACCESS_HELPER_H */