1# Distributed Data Management 2 3 4## Introduction 5 6**Distributed Data Management Subsystem** 7 8The Distributed Data Management subsystem can persistently store various structured data of a single device. It also supports data synchronization and sharing across devices. With the Distributed Data Management subsystem, application data can be seamlessly processed across devices, ensuring consistent user experience for the same application across devices. 9 10 11**Subsystem Architecture** 12 13**Figure 1** Architecture 14 15 16![](figures/Distributed_data_management_architecture.png) 17 18## Directory Structure 19 20Level 1 and 2 directories of the distributed data management subsystem: 21 22``` 23distributeddatamgr/ # Distributed Data Management subsystem 24├── data_object # Distributed data object 25└── data_share # DataShare 26└── datamgr_service # Data service 27└── kv_store # Key-value (KV) store 28└── preferences # Preferences 29└── relational_store # Relational database (RDB) store 30 31third_party/ # Open-source software 32├── flatbuffers # FlatBuffers code 33└── sqlite # SQLite code 34``` 35 36## Module Description 37 38### Distributed Data Object 39 40The distributed data object management framework is an object-oriented in-memory data management framework. It provides APIs for basic data object management, such as 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. 41 42The **Distributed Data Object** module provides JS APIs to help you use distributed data objects like using local data objects. The distributed data objects support basic data types, such as number, string, and Boolean, as well as complex data types, such as array and nested basic types. 43 44### DataShare 45 46The **DataShare** module allows an application to manage its own data and share data with other applications. Currently, data can be shared only between applications on the same device. 47 48### DDS 49 50The Distributed Data Service (DDS) implements database collaboration across devices for applications. The DDS isolates data 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. 51 52### Preferences 53 54The **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 provide non-relational data storage and are not suitable for storing a large amount of data. 55 561. The **Preferences** module provides APIs for **preferences** operations. 572. You can use **getPreferences()** to load the content of a specified 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. 583. After obtaining a **Preferences** instance, the application can call the APIs of **Preferences** to read data from or write data to the **Preferences** instance, and call **flush()** to save the instance data to a file. 59 60### RDB Store 61 62The RDB manages data based on relational models. The OpenHarmony RDB module provides a complete mechanism for managing local databases based on the underlying SQLite. 63 64With the SQLite as the persistence engine, the RDB module supports all SQLite features, including transactions, indexes, views, triggers, foreign keys, parameterized queries, prepared SQL statements, and more. 65 66 67 68## Repositories Involved 69 70Distributed Data Management Subsystem 71 72[distributeddatamgr\_data_object](https://gitee.com/openharmony/distributeddatamgr_data_object) 73 74[distributeddatamgr\_data_share](https://gitee.com/openharmony/distributeddatamgr_data_share) 75 76[distributeddatamgr\_preferences](https://gitee.com/openharmony/distributeddatamgr_preferences) 77 78[distributeddatamgr\_relational_store](https://gitee.com/openharmony/distributeddatamgr_relational_store) 79 80[distributeddatamgr\_kv_store](https://gitee.com/openharmony/distributeddatamgr_kv_store) 81 82[third\_party\_sqlite](https://gitee.com/openharmony/third_party_sqlite) 83 84[third\_party\_flatbuffers](https://gitee.com/openharmony/third_party_flatbuffers) 85