1 /******************************************************************************
4 * Company XS Embedded GmbH
5 *****************************************************************************/
6 /******************************************************************************
7 * This Source Code Form is subject to the terms of the
8 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
9 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 ******************************************************************************/
12 * @file persistence_client_library_data_organization.c
13 * @ingroup Persistence client library
14 * @author Ingo Huerner
15 * @brief Implementation of persistence database low level access
19 #include "persistence_client_library_data_organization.h"
25 // rrsource configuration database name
26 const char* gResTableCfg = "/resource-table-cfg.itz";
28 /// configurable default database name
29 const char* gConfigDefault = "/configurable-default-data.itz";
31 /// default database name
32 const char* gDefault = "/default-data.itz";
34 /// write through database name
35 const char* gWt = "/wt.itz";
36 /// cached database name
37 const char* gCached = "/cached.itz";
40 /// directory structure node name defintion
41 const char* gNode = "/node";
42 /// directory structure user name defintion
43 const char* gUser = "/user/";
44 /// directory structure seat name defintion
45 const char* gSeat = "/seat/";
48 /// cached path location
49 #define CACHEPREFIX "/Data/mnt-c/"
50 /// write through path location
51 #define WTPREFIX "/Data/mnt-wt/"
53 /// size of cached path string
54 const int gCPathPrefixSize = sizeof(CACHEPREFIX)-1;
55 /// size of write through string
56 const int gWTPathPrefixSize = sizeof(WTPREFIX)-1;
58 /// path for the backup location
59 const char* gBackupPrefix = "/Data/mnt-backup/";
61 /// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
62 const char* gLocalCachePath = CACHEPREFIX "%s";
63 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
64 const char* gLocalWtPath = WTPREFIX "%s";
65 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
66 const char* gSharedCachePath = CACHEPREFIX "%s/shared_group_%x";
67 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
68 const char* gSharedWtPath = WTPREFIX "%s/shared_group_%x";
69 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
70 const char* gSharedPublicCachePath = CACHEPREFIX "%s/shared_public";
71 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
72 const char* gSharedPublicWtPath = WTPREFIX "%s/shared_public";
74 /// path prefix for local cached database: /Data/mnt_c/<appId>/ (<database_name>
75 const char* gLocalCachePathKey = CACHEPREFIX "%s%s";
76 /// path prefix for local write through database /Data/mnt_wt/<appId>/<database_name>
77 const char* gLocalWtPathKey = WTPREFIX "%s%s";
78 /// path prefix for shared cached database: /Data/mnt_c/Shared/Group/<group_no>/<database_name>
79 const char* gSharedCachePathKey = CACHEPREFIX "%s/shared_group_%x%s";
80 /// path prefix for shared write through database: /Data/mnt_wt/Shared/Group/<group_no>/<database_name>
81 const char* gSharedWtPathKey = WTPREFIX "%s/shared_group_%x%s";
82 /// path prefix for shared public cached database: /Data/mnt_c/Shared/Public//<database_name>
83 const char* gSharedPublicCachePathKey = CACHEPREFIX "%s/shared_public%s";
84 /// path prefix for shared public write through database: /Data/mnt_wt/Shared/Public/<database_name>
85 const char* gSharedPublicWtPathKey = WTPREFIX "%s/shared_public%s";
87 /// path prefix for local cached files: /Data/mnt_c/<appId>/<user>/<seat>/<resource>
88 const char* gLocalCacheFilePath = CACHEPREFIX "%s/user/%d/seat/%d/%s";
91 const char* gChangeSignal = "PersistenceResChange";
92 const char* gDeleteSignal = "PersistenceResDelete";
93 const char* gCreateSignal = "PersistenceResCreate";
96 char gNotifykey[DbKeyMaxLen] = {0};
97 unsigned int gNotifyLdbid = 0;
98 unsigned int gNotifyUserNo = 0;
99 unsigned int gNotifySeatNo = 0;
100 pclNotifyStatus_e gNotifyReason = 0;
101 PersNotifyRegPolicy_e gNotifyPolicy = 0;
104 int gTimeoutMs = 5000;
106 int gDbusPendingRvalue = 0;
110 char gAppId[MaxAppNameLen] = {0};
113 /// max key value data size [default 16kB]
114 int gMaxKeyValDataSize = defaultMaxKeyValDataSize;
117 unsigned int gPclInitialized = PCLnotInitialized;
120 DltContext gPclDLTContext;
122 int(* gChangeNotifyCallback)(pclNotification_s * notifyStruct);