• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# DistributedDataManager Subsystem
2
3## Introduction
4
5The **DistributedDataManager** subsystem implements persistence of a variety of structured data on a single device and data sync and sharing across devices. It allows application data to be seamlessly processed across devices, ensuring consistent user experience for the same application across devices.
6
7The following figure shows the architecture of the **DistributedDataManager** subsystem.
8
9**Figure 1** Architecture
10
11![](figures/Distributed_data_management_architecture.png)
12
13## Directory Structure
14
15Level 1 and 2 directories of the **DistributedDataManager** subsystem:
16
17```
18distributeddatamgr/          # DistributedDataManager subsystem
19├── data_object              # Distributed data object
20└── data_share               # DataShare
21└── datamgr_service          # Distributed data service (DDS)
22└── kv_store                 # Key-value (KV) store
23└── preferences              # Preferences
24└── relational_store         # Relational Database (RDB) store
25└── udmf                     # Unified Data Management Framework (UDMF)
26
27third_party/                 # Open-source software
28├── bounds_checking_function # bounds_checking_function code
29└── cJSON                    # cJSON code
30└── flatbuffers              # FlatBuffers code
31└── googletest               # GoogleTest code
32└── jsoncpp                  # JsonCpp code
33└── icu                      # ICU code
34└── libuv                    # libuv code
35└── openssl                  # OpenSSL code
36└── sqlite                   # SQLite code
37└── zlib                     # zlib code
38```
39
40## Component Description
41
42### Distributed Data Object
43
44As an object-oriented in-memory data management framework, the distributed data object framework provides APIs for basic data object management, including creating, querying, deleting, modifying, and subscribing to in-memory objects. Moreover, it provides distributed capabilities to implement data object collaboration for the same application between multiple devices that form a Super Device.
45
46JS APIs are provided to help you use distributed data objects like using local data objects. A variety of data types are supported, including basic data types such as number, string, and Boolean, as well as complex data types such as array and nested basic data types.
47
48### DataShare
49
50The **DataShare** module allows an application to share data with other applications. It allows data to be shared across different applications on the same device.
51
52### DDS
53
54The DDS implements database collaboration across devices for applications. Data of different devices is isolated based on a triplet of the account, application, and database. The DDS synchronizes data between trusted devices, delivering a consistent data access experience on different devices.
55
56### KV Store
57
58The distributed KV store provides distributed collaboration of KV stores across devices. By calling the APIs of **distributedKVStore**, applications can save data to distributed KV stores and perform operations, such as adding, deleting, modifying, querying, and synchronizing data in distributed KV stores.
59
60The **distributedKVStore** module provides the following functions:
61
62- [KVManager](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#kvmanager): provides a **KVManager** instance for obtaining KV store information.
63- [KVStoreResultSet](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#kvstoreresultset): provides APIs for accessing the result obtained from a KV store.
64- [Query](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#query): provides APIs for setting predicates for data query.
65- [SingleKVStore](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#singlekvstore): provides APIs for querying and syncing data in single KV stores, which manage data without distinguishing devices.
66- [DeviceKVStore](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#devicekvstore): provides APIs for querying and syncing data in device KV stores, which inherit from [SingleKVStore](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#singlekvstore) and manage data by device.
67
68### Preferences
69
70The **Preferences** module allows quick access to data in KV pairs and storage of a small amount of data for local applications. The data is stored in local files in KV pairs and loaded in memory, which allows for faster access and higher processing efficiency. **Preferences** provides non-relational data storage and is not suitable for storing a large amount of data.
71
721.  The **Preferences** module provides APIs for **preferences** operations.
732.  You can use **getPreferences()** to load the data of a file to a **Preferences** instance. Each file has only one **Preferences** instance. The system stores the instance data in memory through a static container until the application removes the instance from the memory or deletes the file.
743.  After obtaining a **Preferences** instance, the application can call **Preferences** APIs to read data from or write data to the **Preferences** instance, and call **flush()** to save the instance data to a file.
75
76### RDB Store
77
78The RDB store manages data based on relational models. The OpenHarmony RDB store provides a complete mechanism for managing a local database based on the underlying SQLite.
79
80With the SQLite as the persistence engine, the RDB store supports all SQLite features, including transactions, indexes, views, triggers, foreign keys, parameterized queries, prepared SQL statements, and more.
81
82### UDMF
83
84The UDMF provides standard data channels for many-to-many data sharing across applications and provides standard APIs for data access. It also provides standard definitions for data types, such as text and image, to streamline data interaction between different applications and minimize the workload of data type adaptation.
85
86## Repositories Involved
87
88DistributedDataManager
89
90[distributeddatamgr\_data_object](https://gitee.com/openharmony/distributeddatamgr_data_object)
91
92[distributeddatamgr\_data_share](https://gitee.com/openharmony/distributeddatamgr_data_share)
93
94[distributeddatamgr\_datamgr_service](https://gitee.com/openharmony/distributeddatamgr_datamgr_service)
95
96[distributeddatamgr\_kv_store](https://gitee.com/openharmony/distributeddatamgr_kv_store)
97
98[distributeddatamgr\_preferences](https://gitee.com/openharmony/distributeddatamgr_preferences)
99
100[distributeddatamgr\_relational_store](https://gitee.com/openharmony/distributeddatamgr_relational_store)
101
102[distributeddatamgr\_udmf](https://gitee.com/openharmony/distributeddatamgr_udmf)
103
104[third\_party\_bounds_checking_function](https://gitee.com/openharmony/third_party_bounds_checking_function)
105
106[third\_party\_cJSON](https://gitee.com/openharmony/third_party_cJSON)
107
108[third\_party\_flatbuffers](https://gitee.com/openharmony/third_party_flatbuffers)
109
110[third\_party\_googletest](https://gitee.com/openharmony/third_party_googletest)
111
112[third\_party\_jsoncpp](https://gitee.com/openharmony/third_party_jsoncpp)
113
114[third\_party\_icu](https://gitee.com/openharmony/third_party_icu)
115
116[third\_party\_libuv](https://gitee.com/openharmony/third_party_libuv)
117
118[third\_party\_openssl](https://gitee.com/openharmony/third_party_openssl)
119
120[third\_party\_sqlite](https://gitee.com/openharmony/third_party_sqlite)
121
122[third\_party\_zlib](https://gitee.com/openharmony/third_party_zlib)
123