harmony 鸿蒙Distributed File System Overview

  • 2023-06-24
  • 浏览 (498)

Distributed File System Overview

OpenHarmony distributed file system (hmdfs) provides cross-device file access capabilities in the following scenarios:

  • The user uses the editing software on one device to edit the files on another device.

  • Music stored on a tablet can be directly viewed and played by an in-car system.

  • The user uses a tablet to view the photos taken by another device.

The hmdfs provides a globally consistent access view for each device dynamically connected to a network via DSoftBus and allows you to implement high-performance read and write operations on files with low latency by using basic file system APIs.

Distributed File System Architecture

Distributed File System Architecture

  • distributedfile_daemon: listens for device online status, establishes links over DSoftBus, and applies data transfer policies based on the security level of the device.

  • hmdfs: implements a network file system in the kernel and provides cache management, file access, metadata management, and conflict management.

    • Cache management
    • After devices are connected to form a Virtual Device, the hmdfs provides file access capabilities, but does not proactively transmit or copy files. Active copy is required when an application needs to save data to a local directory.
    • The hmdfs ensures close-to-open cache consistency, which allows data to flushed when a client closes a file. Then, the latest data can be read when the file is opened on any other client. The hmdfs does not ensure real-time consistency of the file content.
    • If data written at the remote end has not been flushed to the local end in a timely manner due to network problems, the file system flushes the data to the local end upon the next network access. However, if the data has been modified on the remote end, only the latest data can be flushed.
    • File access
    • OpenHarmony provides the unified ohos.file.fs for accessing files in the local and distributed file systems.
    • The files in the local file system are accessed in overlay mode.
    • The files on another device are accessed over a synchronous network. > NOTE > > symlink is not supported.
    • Metadata management
    • In distributed networking, when a file is created, deleted, or modified on a client, the latest file can be viewed on another client. The speed varies depending on the network status.
    • If a device goes offline, its data is no longer visible to other devices. However, due to the delay in sensing the device offline, the files of some offline devices may also be visible to other devices. Therefore, you need to consider the network delay in application development.
    • Conflict management
    • If a file name conflict occurs on the local and remote devices, the file on the remote device is renamed.
    • If a file name conflict occurs between multiple remote devices, the name of the file with the smallest device access ID is retained and the files on other devices are renamed.
    • If the directory tree already has remote files in networking scenario, a file with duplicate file name cannot be created successfully.
    • The conflict files are renamed in “_conflict_dev_ID” format. The IDs automatically increment from 1.
    • If a local directory and a remote directory have the same name, it does not yield a conflict. If the two directories have files with the same name, “_remote_directory” is added to the end of the remote directory.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙File Management

harmony 鸿蒙Accessing Application Files

harmony 鸿蒙Backup and Restoration Accessed by Applications

harmony 鸿蒙Application Data Backup and Restoration Overview

harmony 鸿蒙Backup and Restoration Triggered by System Applications

harmony 鸿蒙Application File Overview

harmony 鸿蒙Uploading and Downloading an Application File

harmony 鸿蒙Obtaining Application and File System Space Statistics

harmony 鸿蒙Application Sandbox Directory

harmony 鸿蒙Developing a File Manager Application (for System Applications Only)

0  赞