1e41f4b71Sopenharmony_ci# DistributedDataManager Subsystem
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Introduction
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe **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.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciThe following figure shows the architecture of the **DistributedDataManager** subsystem.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Figure 1** Architecture
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci![](figures/Distributed_data_management_architecture.png)
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## Directory Structure
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciLevel 1 and 2 directories of the **DistributedDataManager** subsystem:
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci```
18e41f4b71Sopenharmony_cidistributeddatamgr/          # DistributedDataManager subsystem
19e41f4b71Sopenharmony_ci├── data_object              # Distributed data object
20e41f4b71Sopenharmony_ci└── data_share               # DataShare
21e41f4b71Sopenharmony_ci└── datamgr_service          # Distributed data service (DDS)
22e41f4b71Sopenharmony_ci└── kv_store                 # Key-value (KV) store
23e41f4b71Sopenharmony_ci└── preferences              # Preferences
24e41f4b71Sopenharmony_ci└── relational_store         # Relational Database (RDB) store
25e41f4b71Sopenharmony_ci└── udmf                     # Unified Data Management Framework (UDMF)
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_cithird_party/                 # Open-source software
28e41f4b71Sopenharmony_ci├── bounds_checking_function # bounds_checking_function code
29e41f4b71Sopenharmony_ci└── cJSON                    # cJSON code
30e41f4b71Sopenharmony_ci└── flatbuffers              # FlatBuffers code
31e41f4b71Sopenharmony_ci└── googletest               # GoogleTest code
32e41f4b71Sopenharmony_ci└── jsoncpp                  # JsonCpp code
33e41f4b71Sopenharmony_ci└── icu                      # ICU code
34e41f4b71Sopenharmony_ci└── libuv                    # libuv code
35e41f4b71Sopenharmony_ci└── openssl                  # OpenSSL code
36e41f4b71Sopenharmony_ci└── sqlite                   # SQLite code
37e41f4b71Sopenharmony_ci└── zlib                     # zlib code
38e41f4b71Sopenharmony_ci```
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci## Component Description
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci### Distributed Data Object
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ciAs 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.
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciJS 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.
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci### DataShare
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ciThe **DataShare** module allows an application to share data with other applications. It allows data to be shared across different applications on the same device.
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci### DDS
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ciThe 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.
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci### KV Store
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ciThe 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.
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ciThe **distributedKVStore** module provides the following functions:
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci- [KVManager](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#kvmanager): provides a **KVManager** instance for obtaining KV store information.
63e41f4b71Sopenharmony_ci- [KVStoreResultSet](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#kvstoreresultset): provides APIs for accessing the result obtained from a KV store.
64e41f4b71Sopenharmony_ci- [Query](../application-dev/reference/apis-arkdata/js-apis-distributedKVStore.md#query): provides APIs for setting predicates for data query.
65e41f4b71Sopenharmony_ci- [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.
66e41f4b71Sopenharmony_ci- [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.
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci### Preferences
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ciThe **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.
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci1.  The **Preferences** module provides APIs for **preferences** operations.
73e41f4b71Sopenharmony_ci2.  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.
74e41f4b71Sopenharmony_ci3.  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.
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci### RDB Store
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ciThe 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.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ciWith 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.
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci### UDMF
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ciThe 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.
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci## Repositories Involved
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ciDistributedDataManager
89e41f4b71Sopenharmony_ci
90e41f4b71Sopenharmony_ci[distributeddatamgr\_data_object](https://gitee.com/openharmony/distributeddatamgr_data_object)
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci[distributeddatamgr\_data_share](https://gitee.com/openharmony/distributeddatamgr_data_share)
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ci[distributeddatamgr\_datamgr_service](https://gitee.com/openharmony/distributeddatamgr_datamgr_service)
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci[distributeddatamgr\_kv_store](https://gitee.com/openharmony/distributeddatamgr_kv_store)
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci[distributeddatamgr\_preferences](https://gitee.com/openharmony/distributeddatamgr_preferences)
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci[distributeddatamgr\_relational_store](https://gitee.com/openharmony/distributeddatamgr_relational_store)
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci[distributeddatamgr\_udmf](https://gitee.com/openharmony/distributeddatamgr_udmf)
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci[third\_party\_bounds_checking_function](https://gitee.com/openharmony/third_party_bounds_checking_function)
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci[third\_party\_cJSON](https://gitee.com/openharmony/third_party_cJSON)
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci[third\_party\_flatbuffers](https://gitee.com/openharmony/third_party_flatbuffers)
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci[third\_party\_googletest](https://gitee.com/openharmony/third_party_googletest)
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci[third\_party\_jsoncpp](https://gitee.com/openharmony/third_party_jsoncpp)
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci[third\_party\_icu](https://gitee.com/openharmony/third_party_icu)
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci[third\_party\_libuv](https://gitee.com/openharmony/third_party_libuv)
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci[third\_party\_openssl](https://gitee.com/openharmony/third_party_openssl)
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci[third\_party\_sqlite](https://gitee.com/openharmony/third_party_sqlite)
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci[third\_party\_zlib](https://gitee.com/openharmony/third_party_zlib)
123