CN113672576A - File sharing method and terminal equipment - Google Patents

File sharing method and terminal equipment Download PDF

Info

Publication number
CN113672576A
CN113672576A CN202011565581.5A CN202011565581A CN113672576A CN 113672576 A CN113672576 A CN 113672576A CN 202011565581 A CN202011565581 A CN 202011565581A CN 113672576 A CN113672576 A CN 113672576A
Authority
CN
China
Prior art keywords
file
terminal device
identifier
target
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011565581.5A
Other languages
Chinese (zh)
Inventor
陈曦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to PCT/CN2021/081199 priority Critical patent/WO2021227646A1/en
Priority to US17/998,767 priority patent/US20230195695A1/en
Priority to EP21803105.2A priority patent/EP4137957A4/en
Publication of CN113672576A publication Critical patent/CN113672576A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a file sharing method and device. The method comprises the steps that a first terminal device opens a target file to be shared, a file identifier and an index identifier of a mapping file are created in a distributed file system, a first file descriptor which is used for accessing the target file in an open state and is associated with the index identifier is generated for a first distributed file service in the first terminal device, and file sharing information containing the file identifier is sent to a second terminal device. And the second terminal equipment opens the mapping file according to the file identifier in the file sharing information and generates a second file descriptor for accessing the mapping file in the open state for a second application program in the second terminal equipment. The second application program requests to access the mapping file according to the second file descriptor, so that a second distributed file service in the second terminal device sends a file access request containing the index identifier, and the first distributed file service accesses the target file according to the first file descriptor associated with the index identifier.

Description

File sharing method and terminal equipment
Technical Field
The embodiment of the application relates to the technical field of terminals, in particular to a file sharing method and terminal equipment.
Background
Before an Application (APP) deployed in a terminal device accesses a local file stored in the terminal device, the APP may request a system kernel of the terminal device to open (open) the local file, and obtain a File Descriptor (FD) returned to the APP by the system kernel. In addition, the system kernel can create a file structure body of the local file, and maintain the mapping relation between the file descriptor and the file structure body in a file descriptor table corresponding to the application program; wherein the file structure of the local file may represent the local file in an open state. During the process of accessing the local file, such as reading/writing (write) the local file, the application program can provide the corresponding file descriptor to the system kernel; the system kernel can find the corresponding file structure body, namely the local file in the open state, according to the file descriptor and the file descriptor table corresponding to the application program, and then perform access operation on the corresponding local file according to the found file structure body, so as to complete the access of the application program to the local file.
Since different terminal devices each have their own system kernel and memory, an application program deployed in one terminal device cannot directly access a local file stored in another terminal device.
Disclosure of Invention
The embodiment of the application provides a file sharing method and terminal equipment, wherein a second application program can access a target file shared by a first application program, the first application program is deployed in the first terminal equipment, the second application program is deployed in the second terminal equipment, and the target file is a local file stored in the first terminal equipment.
In a first aspect, an embodiment of the present application provides a file sharing method, which is applied to a first terminal device, where the first terminal device deploys a first distributed file service. The method comprises the following steps: firstly, opening a target file, wherein the target file is a local file which is stored in a first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system. And then, creating metadata of a mapping file corresponding to the target file in the distributed file system, wherein the metadata of the mapping file comprises a file identifier and an index identifier of the mapping file. And then generating a first file descriptor for accessing the target file in the open state for the first distributed file service, and establishing an association relation between the first file descriptor and the index identifier. And then sending the file sharing information containing the file identification to the second terminal equipment.
In a second aspect, an embodiment of the present application provides a file sharing method corresponding to the first aspect, which is applied to a second terminal device, where the second terminal device deploys a second distributed file service. The method comprises the following steps: receiving file sharing information from a first terminal device, wherein the first terminal device and a second terminal device belong to the same distributed file system, the file sharing information comprises a file identifier of a mapping file corresponding to a target file in the distributed file system, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device. And then, opening the mapping file according to the file identifier. A second file descriptor for accessing the mapped file in the open state is then generated for the second application and provided to the second application.
With reference to the first and second aspects, when a user desires to access a target file using a second application, the second distributed file service may first receive a second file access request of the second application for the mapped file in the open state, the second file access request including a request parameter and a second file descriptor; and then sending a first file access request to the first terminal device, wherein the first file access request comprises a request parameter and an index identifier of the mapping file, and the index identifier is obtained from metadata of the mapping file according to the file identifier. The first distributed file service can correspondingly receive a first file access request from the second terminal, then query the association relationship established in the first terminal equipment according to the index identifier, determine a first file descriptor for accessing the target file stored in the open state, and access the target file in the open state according to the request parameter and the first file descriptor. Therefore, the second application program can complete cross-device access to the target file stored in the first terminal device by accessing the mapping file stored in the open state.
In a third aspect, an embodiment of the present application provides a file sharing method, which is applied to a first terminal device, where the first terminal device deploys a first distributed file service. The method comprises the following steps: firstly, opening a target file, wherein the target file is a local file which is stored in a first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system. And then generating a temporary identifier and establishing an association relation between the temporary identifier and the target file in the open state. And then sending the file sharing information containing the temporary identifier to the second terminal equipment.
In a fourth aspect, an embodiment of the present application provides a file sharing method corresponding to the third aspect, which is applied to a second terminal device, where the second terminal device deploys a second distributed file service. The method comprises the following steps: the file sharing method comprises the steps that file sharing information from first terminal equipment is received, the first terminal equipment and second terminal equipment belong to the same distributed file system, the file sharing information comprises a temporary identifier, an association relation between the temporary identifier and a target file in an open state is established in the first terminal equipment, and the target file is a local file which is stored in the first terminal equipment and is to be shared to the second terminal equipment. Then, a temporary file in an open state is created in the second terminal device. A second file descriptor for accessing the temporary file in the open state is then generated for the second application, and the second file descriptor and the temporary identification are provided to the second application.
With reference to the first and second aspects, when a user desires to access a target file using a second application, the second distributed file service may first receive a second file access request of the second application for a temporary file in an open state, where the second file access request includes a second file descriptor, a temporary identifier, and a request parameter; and then sending a first file access request to the first terminal equipment, wherein the first file access request comprises request parameters and a temporary identifier. The first distributed file service can correspondingly receive a first file access request from the second terminal equipment; and then, according to the temporary identifier, querying the association relation to determine the target file in the open state, and according to the request parameter, accessing the target file in the open state. Therefore, the second application program can complete cross-device access to the target file stored in the first terminal device by accessing the temporary file in the open state.
In a fifth aspect, a file sharing apparatus is provided, which is applied to a first terminal device, where the first terminal device deploys a first distributed file service. The device includes: the local file management unit is used for opening a target file; the target file is a local file which is stored in a first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system. The distributed file management unit is used for creating metadata of a mapping file corresponding to a target file in a distributed file system; the metadata of the mapping file comprises a file identifier and an index identifier of the mapping file. And the file descriptor transfer unit is used for serving the first distributed file, generating a first file descriptor for accessing the target file in the open state, and establishing an association relation between the first file descriptor and the index identifier. The data sending unit is used for sending the file sharing information to the second terminal equipment; wherein the file sharing information includes a file identifier. The first distributed file service is used for receiving a first file access request from the second terminal, wherein the first file access request comprises a request parameter and an index identifier; querying the association relation according to the index identifier to determine a first file descriptor; and accessing the target file in the open state according to the request parameter and the first file descriptor.
In a sixth aspect, an embodiment of the present application provides a file sharing apparatus corresponding to the fifth aspect, which is applied to a second terminal device, where a second distributed file service is deployed in the second terminal device. The device includes: a data transceiving unit for receiving file sharing information from a first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information comprises a file identifier of a mapping file corresponding to a target file in the distributed file system, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device. And the file management unit opens the mapping file according to the file identifier. And the file descriptor transfer unit is used for generating a second file descriptor for accessing the mapping file in the open state for the second application program and providing the second file descriptor for the second application program. The second distributed file service is used for receiving a second file access request of a second application program to the mapping file in the open state, wherein the second file access request comprises a request parameter and a second file descriptor; and sending a first file access request to the first terminal device, wherein the first file access request comprises a request parameter and an index identifier of the mapping file, and the index identifier is obtained from metadata of the mapping file according to the file identifier.
A seventh aspect provides a file sharing apparatus, which is applied to a first terminal device, where the first terminal device deploys a first distributed file service. The device includes: the local file management unit is used for opening a target file; the target file is a local file which is stored in a first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system. And the incidence relation management unit is used for generating the temporary identifier and establishing the incidence relation between the temporary identifier and the target file in the open state. The data transceiving unit is used for sending the file sharing information to the second terminal equipment; wherein the file sharing information comprises a temporary identifier. The first distributed file service is used for receiving a first file access request from the second terminal equipment, wherein the first file access request comprises a request parameter and a temporary identifier; inquiring the association relation according to the temporary identifier, and determining the target file in an open state; and accessing the target file in the open state according to the request parameters.
In an eighth aspect, an embodiment of the present application provides a file sharing apparatus corresponding to the seventh aspect, which is applied to a second terminal device, where a second distributed file service is deployed in the second terminal device. The device includes: a data transceiving unit for receiving file sharing information from a first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information comprises a temporary identifier, an association relation between the temporary identifier and a target file in an open state is established in the first terminal device, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device. And the file management unit is used for creating the temporary file in the open state in the second terminal equipment. And the file descriptor transfer unit is used for generating a second file descriptor for accessing the temporary file in the open state for the second application program and providing the second file descriptor and the temporary identifier for the second application program. The second distributed file service is used for receiving a second file access request of a second application program to the temporary file in the open state, wherein the second file access request comprises a second file descriptor, a temporary identifier and a request parameter; and sending a first file access request to the first terminal device, wherein the first file access request comprises request parameters and a temporary identifier.
In a ninth aspect, there is provided a terminal device comprising a memory and a processor, the memory having stored therein computer program instructions/code, the processor implementing the method of any one of the first to fourth aspects when executing the computer program instructions/code.
A tenth aspect provides a computer readable storage medium for storing computer program instructions/code which, when executed by a processor of a terminal device, cause the terminal device to implement the method of any one of the first to fourth aspects.
In an eleventh aspect, there is provided a computer program product comprising computer program instructions/code which, when run on a computer, cause the computer to perform the method of any of the first to fourth aspects above.
In the above various aspects, the first distributed file service may send a metadata synchronization message to the second terminal device, the metadata synchronization message including metadata of the mapped file.
In the above aspects, the first terminal device may further send a file sharing request to the second terminal device, where the file sharing request includes a global identifier of the target file, and the global identifier is a unique identifier of the target file in the first terminal device. The second terminal device may provide the file sharing request to the second application program, and send a file sharing response containing the global identifier to the second terminal device in response to a user triggering operation of the global identifier through the second application program. Accordingly, the first terminal device may open the target file in response to the file sharing response from the second terminal device. Therefore, the user can access the target file as required through the second application program according to the service requirement of the user.
In the above aspects, the file sharing request may further include a first application identifier of the first application, the first application being deployed in the first terminal device and having a right to access the target file, the first application identifier being a unique identifier of the first application in the first terminal device. Accordingly, the file sharing response sent by the second terminal device may further include the first application identification. The first terminal device may then open the target file via the first application in response to a file sharing response from the second terminal device and including the global identification and the first application identification. In other words, the object file is opened by the first application program having the access right to the object file, so that the second application program can access the object file in the opened state in the subsequent process.
In the above aspects, the global identification of the target file comprises a uniform resource locator, URI, of the target file. The URI of the target file may specifically include a file information field, where the file information field is a storage path of the target file or a mapping character string corresponding to the storage path.
In the above aspects, the URI of the target file may further include a device information field, and the device information field is a device identifier of the first terminal device or a mapping character string corresponding to the device identifier.
In the above aspects, the URI of the target file further includes: the application information field specifically includes a first application identifier of the first application program or a mapping character string corresponding to the first application identifier.
In the above aspects, the file sharing request further includes a second application identifier of the second application program; and the second application program is deployed in the second terminal equipment, and the second application identifier is the unique identifier of the second application program in the second terminal equipment.
Drawings
The drawings that accompany the detailed description can be briefly described as follows.
Fig. 1 is one of schematic diagrams of different terminal devices sharing an object file provided in an embodiment of the present application;
fig. 2 is a second schematic diagram illustrating different terminal devices sharing a target file according to an embodiment of the present application;
fig. 3 is a flowchart of a file sharing method provided in an embodiment of the present application;
FIG. 4a is one of exemplary graphical user interfaces displayed by a terminal device in an embodiment of the present application;
FIG. 4b is a second exemplary graphical representation for an interface displayed by a terminal device in an embodiment of the present application;
FIG. 4c is a diagram of an exemplary graphic displayed by the terminal device for the third interface in the embodiment of the present application;
FIG. 5 is a flow chart of another file sharing method provided in an embodiment of the present application;
fig. 6 is a schematic diagram of a file sharing apparatus provided in an embodiment of the present application;
fig. 7 is a second schematic diagram of a file sharing apparatus provided in an embodiment of the present application;
FIG. 8 is a third schematic diagram of a file sharing device according to an embodiment of the present application;
FIG. 9 is a fourth schematic diagram of a file sharing device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a terminal device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
In the embodiment of the present application, the term "and/or" is only used to describe the association relationship of the associated objects, and means that there may be three relationships; for example, "a and/or B" may mean: a exists alone, B exists alone, and A and B exist at the same time. The term "plurality" means two or more and "several" means one or more unless otherwise stated. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise. The terms "first", "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicit indication of indicated technical features; thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
In the embodiments of the present application, words such as "exemplary," "such as," or "for example" are used to mean serving as an example, instance, or illustration, and are intended to present relevant concepts in a concrete fashion. Any embodiment or design described as "exemplary," "such as," or "for example" is not necessarily to be construed as preferred or advantageous over other embodiments or designs.
In this embodiment, the terminal device may be a mobile phone, a television, a sound device, a wearable device, a tablet computer, a Personal Digital Assistant (PDA), a laptop computer (laptop), a mobile computer, an Augmented Reality (AR) device, a Virtual Reality (VR) device, an Artificial Intelligence (AI) device, or the like.
In terms of hardware architecture, a terminal device may include at least a memory and a processor. The system can also comprise modules/units such as a display screen, a camera, a communication interface, a sensor and the like, which are used for supporting the terminal equipment to realize information interaction with the outside.
As for the software structure, the software system of the terminal device may adopt a hierarchical architecture, an event-driven architecture, a micro-core architecture, a cloud architecture, or the like. Taking a software system of a layered architecture adopted by a terminal device as an example, the software system of the layered architecture can be generally divided into four layers, which are an application layer, an application framework layer, a system library, an Android runtime (Android runtime) and a kernel layer from top to bottom, each layer has clear roles and division of labor, and the layers communicate with each other through a software interface.
The application layer includes an application program deployed in the terminal device. Illustratively, the application layer includes, but is not limited to, a Launcher (Launcher), a file manager, a file editor, and the like.
The application framework layer may provide an Application Programming Interface (API) and a programming framework for the application, and may further include some predefined functional modules/services.
The system library, the android runtime, the kernel layer, and the like may be referred to as an underlying system, and the underlying system includes functional modules and hardware drivers for providing display and file management services, such as a surface manager (surface manager) located in the system library and a display driver located in the kernel layer.
The runtime is responsible for scheduling and management of the whole software system, including the core library and the virtual machine. Computer programs of the application layer and the application framework layer run in a virtual machine. Specifically, the virtual machine may execute java files of the application layer and the application framework layer as binary files.
The system library may also include a plurality of functional modules other than the surface manager. Including, for example, status monitoring services, Media Libraries, three-dimensional graphics engines (e.g., OpenGL for Embedded Systems), and two-dimensional graphics engines, among others.
The kernel layer is a layer between hardware and software, comprises a plurality of hardware drivers and provides a process management basis, a file management basis, a system security authority management basis and a system and hardware equipment communication basis. Illustratively, the kernel layer may include a display driver, a camera driver, an audio driver, a touch driver, and several local file systems.
The local file system is used for organizing and distributing the storage resources of the terminal equipment and managing the local files stored in the storage. For example, the local file system may be responsible for creating, reading, and modifying local files. In addition, the local file system may include, but is not limited to, the Linux file systems such as Ext2, Ext3, Ext4, and Fuse.
The technical scheme provided in the embodiment of the application is suitable for the following service scenes: the first application program shares an object file to the second application program, the first application program is deployed in the first terminal device, the second application program is deployed in the second terminal device, and the object file is a local file or a distributed file stored in the first terminal device.
Typically, the different end devices each have their own system kernel and memory. The second application deployed in the second terminal device does not have direct access to the local file stored in the first terminal device. As shown in fig. 1, when a first application (application 2011) requests a second application (application 2012) to share a target file (local file 2031) in the local file system 2021, the first terminal device (terminal 101) needs to transmit the file content of the local file 2031 to the second terminal device (terminal 102). The terminal device 102 creates and stores a local file 2032 containing the file content in its local file system 2022; application programs 2012 may access local file 2032.
The technical scheme provided in the embodiment of the application aims to realize cross-device direct access to the target file.
Fig. 2 is a schematic diagram of different terminal devices sharing an object file provided in this embodiment of the present application. As shown in fig. 2, the distributed file system 10 includes a terminal device 101 and a terminal device 102. A distributed file service 2041 is deployed in the terminal device 101, and a distributed file service 2042 is deployed in the terminal device 102. The distributed file service may be located in an application layer or a kernel layer of a software system of the terminal device.
In the distributed file system 10, the metadata of each distributed file can be stored on the terminal devices, and the metadata of each distributed file can be synchronized between different terminal devices as needed or in time. Or, the distributed file system 10 further includes a master server (master server)/name node (name node), the metadata of each distributed file is stored in the master server, and the terminal device obtains the metadata of the distributed file from the master server/name node as needed or on time.
The distributed file system 10 may include or be an improvement over the foregoing exemplary distributed file systems, pvfs (parallel virtual file system), Lustre file system, panfs (panaas file system), google fs (google file system), or other various types of centralized or decentralized distributed file systems.
The terminal device 101 may further deploy a file sharing apparatus 61, and the terminal device 102 may further deploy a file sharing apparatus 62, so that the terminal device 101 and the terminal device 102 can perform mutual cooperation to support cross-device access to the local file 2031 of the application program 2012 according to their respective deployed distributed file services.
Based on the system framework shown in fig. 2, the embodiment of the present application provides a file sharing method. As illustrated in fig. 3, the method may include, but is not limited to, some or all of the steps illustrated in fig. 3.
In step 301, the terminal device 101 obtains configuration information of the terminal device 102.
The terminal device 101 may receive configuration information of the terminal device 102 from the terminal device 102. Similarly, the terminal device 101 may send its own configuration information to other terminal devices in the distributed file system 10.
The configuration information of the terminal device 102 at least includes a device identifier of the terminal device 102. The device identifier of the terminal device 102 may specifically be an Internet Protocol (IP) address or a media access control address (MAC) of the terminal device 102.
In some embodiments, the configuration information of the terminal device 102 may further include: the respective application identities of several application programs deployed in the terminal device 102. The application identifier of the application program may specifically be a name of an installation package of the application program or a unique identifier assigned to the application program. In addition, for any application program deployed in the terminal device 102, if the application program has the right to access the distributed file, that is, has the right to call the distributed file service 2042, the application identifier of the application program is included in the configuration information of the terminal device 102.
In step 3021, the terminal apparatus 101 determines the local file 2031 as a target file to be shared.
In step 3022, the terminal apparatus 101 determines the terminal apparatus 102 for accessing the target file.
In some embodiments, terminal device 101 runs application 2011 and displays a graphical user interface for application 2011. The user can execute the business operation in the graphical user interface, and the file sharing device 61 disposed in the terminal device 101 determines the target file to be shared and the terminal device 102 for accessing the target file according to the business operation executed by the user in the graphical user interface.
Illustratively, the terminal device 101 may be a mobile phone, and the terminal device 102 may be a tablet computer; application 2011 can be a file manager and application 2012 can be a file editor. The file manager has access rights to local files with file names "file 1" and "file 2", and the user desires to share the local file 2031 with the file name "file 1" in the mobile phone to the file editor in the tablet computer, and edit the local file 2031 through the file editor in the tablet computer.
First, the handset may display a graphical user interface as shown in FIG. 4a through the file manager. The user can make the local file 2031 having a file name of "file 1" be determined as the target file to be shared by continuously pressing the area where the word "file 1" is located.
The terminal device 101 then displays a graphical user interface as shown in fig. 4 b. The graphic user interface can not only display each local file in a list and indicate the determined target file, but also display icons or words for supporting various specific types of management on the target file. For example, a "share" icon for supporting sharing of a target file to other users through a specified communication manner, a "copy" icon for supporting copying of the target file, a "move" icon for moving the target file to change a storage path of the target file, and "open mode" and "rename" words under "more" list items, wherein the "rename" word is used for supporting modification of a file name of the target file, and the "open mode" word is used for supporting initiation of sharing of the target file.
The user may then cause the terminal device to display a graphical user interface as shown in fig. 4c by touching/pressing the "open mode" word. Assume that, of the current devices, device 1 and device 2 displayed on the graphical user interface, device 1 represents a device name of the tablet computer, where the device name of the terminal device corresponds to the device identifier of the terminal device. Based on this assumption, the user may cause the tablet computer to be determined as the terminal device 102 for accessing the target file by pressing/touching the area where the word "device 1" is located.
When the configuration information of the terminal device 102 contains several application identifiers, similar to the terminal device 102 determined to be used for accessing the target file, after the user selects "device 1" as the terminal device 102 used for accessing the target file, the application identifiers contained in the configuration information of "device 1", such as "photo", "file editor", and "PDF", may also be correspondingly displayed in the graphical user interface shown in fig. 4 c. The user may further touch/press the area where the "file editor" is located, causing the "file editor" deployed in the tablet computer to be determined as the application 2012 for accessing the target file.
It should be noted that fig. 4a, fig. 4b, and fig. 4c are only used to assist in describing the technical solutions provided in the embodiments of the present application, and are used to support the graphical user interface of the terminal device 102 for determining the target file to be shared and for accessing the target file, and may also have other layouts and page jump relationships. In addition, it is also possible to perform step 3021 first and then step 3022; for example, an icon associated with the file sharing apparatus 61 may be set in one graphical user interface of the application 2011, the user may touch/press the icon in the graphical user interface, so that the terminal device 101 displays another graphical user interface supported by the file sharing apparatus 61, the user may perform a corresponding business operation in the other graphical user interface, so that the terminal device 101 determines a target file to be shared, a graphical user interface of the terminal device 102 for accessing the target file, and an application 2012 for accessing the target file.
When the configuration information of the terminal device 102 includes a plurality of application identifiers, similar to the terminal device 102 determined to be used for accessing the target file, the terminal device 101 may further display an application selection interface through the file sharing apparatus 61. According to the application selection operation performed by the user in the application selection interface, an application program 2012 for accessing the target file is determined. The application selection interface may display each application identifier included in the configuration information of the terminal device 102.
In step 303, the terminal device 101 determines the global identifier of the target file. The global identifier of the target file is a unique identifier of the target file in the terminal device 101, and is used for supporting the search of the target file.
In some embodiments, the global identification of the target file may be a storage path of the target file or a mapping string corresponding to the storage path.
In some embodiments, the global identification of the target file may be the URI of the target file. The URI of the target file is used at least for a character string identifying the name/location of the target file in the terminal device 101.
Illustratively, the URI of the target file specifically includes a device information field and a file information field.
Illustratively, the URI of the target file specifically includes a device information field, an application information field, and a file information field.
In the above examples, the file information field may be a storage path of the target file or a mapping character string corresponding to the storage path.
In the above examples, the device information field may be a device identification of the terminal device 101 or a mapping character string corresponding to the device identification. The device identifier of the terminal device 101 may specifically be an IP address of the terminal device 101, or another identifier that is obtained based on the IP address/MAC address of the terminal device 101 and that can be resolved by a Domain Name System (DNS).
In the above examples, the application information field may be an application id of the application program 2011 that requests the sharing of the target file, or a mapping character string corresponding to the application id.
Based on the above examples, the URI of the target file may further include a protocol identifier (e.g., http, ftp, mailto, or file), and other terminal devices including the terminal device 102 may perform an access operation on the target file through a corresponding communication protocol based on the protocol identifier included in the URI of the target file.
In step 304, the terminal apparatus 101 transmits a file sharing request to the terminal apparatus 102.
Wherein the file sharing request includes a global identification of the target file.
The terminal apparatus 101 determines that the application program 2012 is an application program for accessing the shared file, and the file sharing request may further include an application identifier of the application program 2012.
The terminal apparatus 101 may complete the above steps 301 to 304 with the support of the file sharing device 61.
After receiving the file sharing request, the terminal device 102 executes step 305, runs the application program 2012 and provides the file sharing request to the application program 2012.
The application 2012 for accessing the object file may be determined by the terminal apparatus 101.
The application 2012 for accessing the target file may be autonomously selected by the user holding the terminal apparatus 102 or predetermined by the terminal apparatus 102.
In other words, the file sharing apparatus 62 in the terminal device 10 may trigger the terminal device 102 to start and run the application program 2012 according to the application identifier of the application program 2012 included in the file sharing request received by the file sharing apparatus, or according to the application identifier of the application program 2012 preset by the file sharing apparatus, or according to the application identifier of the application program 2012 selected by the user. Next, the file sharing apparatus 62 may provide the file sharing request to the application program 2012 according to the application identifier of the application program 2012. Finally, the global identification of the target file contained in the file sharing request is presented through the graphical user interface of the application program 2012. In this way, the user can know one or more of information such as a terminal device requesting to share the target file with the user, an application requesting to share the target file with the user, the target file to be shared, and the like. In addition, the user may also perform a trigger operation on the global identifier of the target file in the graphical user interface of the application program 2012, such as touching/clicking an area where the global identifier is located in the graphical user interface, and responding to the file sharing request from the terminal device 101.
The terminal device 102 may execute step 306 to send a file sharing response to the terminal device 101 in response to the user's triggering operation on the global identifier of the target file under the support of the file sharing apparatus 62.
Wherein the file sharing response comprises a global identification of the target file.
The terminal device 101 responds to the file sharing response from the terminal device 102 with the support of the file sharing means 61, and executes step 307 to open the target file according to the global identifier of the target file.
In some embodiments, the terminal device 101 parses the global identifier from the terminal device 102 through the file sharing apparatus 61, determines the application 2011 requesting to share the target file according to the application information field in the global identifier, and finds the target file stored in the terminal device 101 according to the file information field in the global identifier. Next, the application 2011 is triggered by the file sharing apparatus 61, so that the application 2011 requests the system kernel of the terminal device 101 to open the target file.
The system kernel of the terminal device 101 may create a file structure of the target file according to a file open request of the application program 2011 for the target file. The file structure of the target file represents the target file in the open state.
It should be noted that, if the target file is an internal file of the application program 2011, the target file may be first converted from the internal file of the application program 2011 into a public file accessible by other application programs according to the application information field in the global identifier of the target file, and then the target file that has been converted into the public file may be opened by the application program 2011. Taking the example that the terminal device 101 adopts an Android-based software system, the internal file of the application program 2011 can be converted into a public file through a provider mechanism provided by the Android-based software system.
Next, the terminal device 101 executes step 3081, and creates metadata of a mapping file corresponding to the target file in the distributed file system 10 through the distributed file service 2041.
Specifically, the file sharing apparatus 61 in the terminal device 101 may call the distributed file service 2041 to complete creating metadata of the mapping file corresponding to the target file in the distributed file system 10.
The metadata of the mapped file may include: the file identification of the mapped file in the distributed file system 10, and the index identification (or handle) used to support access to the mapped file. And may also include the device identification of terminal device 101.
The file identification of the mapped file may include the path of the mapped file in the directory tree of the distributed file system 10. Illustratively, in the directory tree of the distributed file system, the root directory is "AA", and the root directory "AA" includes a first-level subdirectory "BB". When the terminal apparatus 101 creates metadata of the mapping file, the second-level subdirectory "CC" is created under the first-level subdirectory "BB". Then the file identification of the mapped file may be "AA/BB/CC".
The directory tree of the distributed file system can be maintained by a user, that is, the file identifier of the distributed file can be created or modified autonomously by the user, so the file identifier of the distributed file is not usually used as the unique identifier of the distributed file. When maintaining the file identifier of the mapping file in the distributed file system 10, the distributed file service 2041 may assign an index identifier to the mapping file according to a predetermined policy, where the index identifier is a unique identifier of the mapping file in the distributed file system.
Thus, for the application program at the user side, a file access request for accessing the mapping file can be initiated to the distributed file service according to the file identifier of the mapping file; in the case of distributed file system 10, distributed file service 2042 may access the mapped file based on the index identification of the mapped file.
It should be noted that, after the creation of the metadata of the mapping file corresponding to the target file is completed, the file content of the mapping file is not really written in the distributed file system 10, but the index identifier of the mapping file and the target file in the open state are subjected to association processing in the subsequent process, so that the file content of the target file in the open state is used as the file content of the mapping file. Thus, when an application accesses a mapped file, it accesses the target file substantially.
Next, the terminal device 102 performs step 3082 to receive the metadata synchronization message.
The metadata synchronization message includes metadata of the mapped file corresponding to the target file.
The specific implementation of step 3081 and step 3082 may vary depending on the architecture of distributed file system 10.
In one example, the metadata of the distributed files is managed by the terminal device 101. In step 3081, the distributed file service 2041 may independently complete creating metadata of the mapping file corresponding to the target file, and send the metadata of the mapping file to the distributed file service 2042.
In one example, the terminal device 101 is only used as a data node for storing the distributed file in the distributed file system 10, and the metadata of the distributed file is uniformly managed by the master server. In step 3081, the distributed file service 2041 may perform information interaction with the master control server/other terminal devices to complete creating metadata of the mapping file corresponding to the target file in the master control server; in step 3082, metadata synchronization messages from the master server/other terminal devices may be received by the distributed file service 2042.
Next, the terminal device 101 executes step 309, generates a first file descriptor for accessing the target file in the open state for the distributed file service 2041, and establishes an association relationship between the first file descriptor and the index identifier.
Specifically, the file descriptor table of the distributed file service 2041 may be looked up to know the file descriptors already occupied by the distributed file service 2041. Then, a first file descriptor is generated that has not been occupied by the distributed file service 2041. Finally, the association relationship between the first file descriptor and the file structure of the target file is established in the file descriptor table, and the first file descriptor is returned to the distributed file service 2041, so that the generation of the first file descriptor for accessing the target file in the open state for the distributed file service 2041 is completed.
Next, the terminal apparatus 101 executes step 310 to transmit the file sharing information to the terminal apparatus 102.
The file sharing information may include a file identification of the mapped file.
In some embodiments, the file sharing information may also include an application identification for application program 2012.
The terminal device 102 may receive the file sharing information through the file sharing apparatus 62, and perform step 311, open the mapped file according to the file identification of the mapped file, generate a second file descriptor for accessing the mapped file in the open state for the application program 2012, and provide the second file descriptor to the application program 2012.
Specifically, first, the file sharing means 62 may receive file sharing information from the terminal device 101. Then, the file sharing apparatus 62 calls the distributed file service 2042 to open the mapped file according to the file identifier of the mapped file. Next, a second file descriptor for accessing the mapped file in the open state is generated for the application 2012 by a method similar to the aforementioned method of generating the first file descriptor for accessing the target file in the open state for the distributed file service 2041. In this manner, the application program 2012 can access the mapped file in the open state through the second file descriptor. Since the file content of the mapped file is substantially the file content of the target file in the open state, when the mapping program 2012 accesses the mapped file, the target file is substantially accessed, that is, the local file 2031 stored in the terminal apparatus 101 is substantially accessed.
It should be noted that, when the terminal opens the mapping file, the distributed file service 2042 may determine the index identifier of the mapping file from the metadata of the mapping file according to the file identifier of the mapping file. Next, the terminal device 102 receives a file access request of the application program 2012 to the mapped file in the open state through the distributed file service 2042, step 312.
The file access request comprises a second file descriptor and corresponding request parameters. The request parameter may include a file access type or type indication information for indicating a file access type, for example, including "read" or "write", or include type indication information for indicating that a file access type is "read" or "write". When the file access type is "write", the request parameters may also include the contents of the file to be written.
The terminal device 102 then executes step 313 to send a file access request to the terminal device 101 via the distributed file service 2042. The file access request includes an index identifier of the mapped file and a request parameter included in the file access request from the application program 2012.
The terminal device 101 receives the file access request from the distributed file service 2042 through the distributed file service 2041, then executes step 314, determines the first file descriptor associated with the index identifier of the mapped file through the distributed file service 2041, and accesses the target file in the open state according to the first file descriptor and the request parameter.
Specifically, the distributed file service 2041 may determine, from the established association relationship, a first file descriptor for accessing the target file in the open state according to the index identifier of the mapped file included in the file access request. Then, according to the file access type and the first file descriptor included in the request parameter, an interface function corresponding to the file access type in the system kernel is called, so that the interface function searches the file structure of the target file from the file descriptor table of the distributed file service 2041 according to the first file descriptor, and then, an access operation is performed on the target file based on the searched file structure.
Based on the system framework shown in fig. 2, another file sharing method is also provided in the embodiment of the present application. As illustrated in fig. 5, the method may include, but is not limited to, some or all of the steps illustrated in fig. 5.
Unlike the embodiment shown in fig. 3, after step 307, the terminal apparatus 101 executes step 508, generates a temporary identifier, and establishes an association relationship between the temporary identifier and the target file in the open state.
Specifically, the file structure of the target file represents the target file in the open state. The temporary identifier is a unique identifier of the file structure of the target file in the terminal apparatus 101. The association relationship between the temporary identifier and the file structure of the target file can be established, and the association relationship between the temporary identifier and the target file in the open state is established.
Next, the terminal apparatus 101 executes step 509 to transmit the file sharing information to the terminal apparatus 102.
The file sharing information at least includes the temporary identifier, and optionally includes an application identifier of the application program 2012.
After the terminal device 102 receives the file sharing information from the terminal device 101, step 510 is executed to create a temporary file in an open state by the distributed file service 2042.
Specifically, the terminal apparatus 101 may receive the file sharing information through the file sharing device 62. Next, the file sharing apparatus 62 may send a file open request to the distributed file service 2042, where the file open request includes indication information and a file identifier of a predetermined distributed file, and the indication information is used to instruct the distributed file service 2042 to create a nameless temporary file, that is, to instruct the distributed file service to create a nameless file structure.
Next, the terminal apparatus 102 executes step 511, generates a second file descriptor for accessing the temporary file in the open state for the application program 2012, and provides the temporary identifier and the second file descriptor to the application program 2012.
The terminal device 102 may generate a second file descriptor for accessing the temporary file in the open state for the application 2012 by a method similar to the aforementioned method of generating the first file descriptor for accessing the object file in the open state for the distributed file service 2041. The predetermined distributed file may be a root directory of the distributed file system 10, or may be other distributed files in the distributed file system 10.
Next, the terminal device 102 executes step 512, and receives a file access request of the application 2012 to the temporary file in the open state through the distributed file service 2042.
The file access request comprises a temporary identifier, a second file descriptor and corresponding request parameters.
Next, the terminal apparatus 102 transmits a file access request to the terminal apparatus 101 through the distributed file service 2032 at step 513. Wherein the file access request comprises the temporary identifier and corresponding request parameters.
After receiving the file access request from the distributed file service 2042 through the distributed file service 2041, the terminal device 101 executes step 514, determines the target file in the open state associated with the temporary identifier through the distributed file service 2041, and accesses the target file in the open state according to the request parameter.
Specifically, the distributed file service may determine, according to the temporary identifier included in the file access request, the target file in the open state from the established association relationship, that is, determine the file structure of the target file. Then, according to the file access type contained in the request parameter, calling an interface function corresponding to the file access type in the system kernel, and enabling the interface function to perform access operation on the target file according to the file structure body of the target file
In some embodiments, the system kernel of the terminal apparatus 101 may further close the target file in the open state in response to a file close request to the target file by the application program 2011. That is, the file structure of the target file is deleted from the terminal apparatus 101, and the application 2012 cannot continue accessing the target file across apparatuses.
Based on the same concept as the foregoing method embodiment, the embodiment of the present application further provides a file sharing apparatus, which may be deployed as the file sharing apparatus 61 in the terminal device 101 as the first terminal device. As shown in fig. 6, the apparatus may include: a local file management unit 611 for opening a target file; the target file is a local file which is stored in the first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system. A distributed file management unit 612, configured to create metadata of a mapping file corresponding to the target file in the distributed file system; wherein the metadata of the mapping file comprises a file identifier and an index identifier of the mapping file. A file descriptor transferring unit 613, configured to generate a first file descriptor for accessing the target file in an open state for the first distributed file service, and establish an association relationship between the first file descriptor and the index identifier. A data sending unit 614, configured to send file sharing information to the second terminal device; wherein the file sharing information includes the file identification.
Based on the same concept as the foregoing method embodiment, another file sharing apparatus is also provided in the embodiment of the present application, and the apparatus may be deployed as the file sharing apparatus 61 in the terminal device 101 as the first terminal device. As shown in fig. 7, the apparatus may include: a local file management unit 615 for opening a target file; the target file is a local file which is stored in the first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system. And an association relationship management unit 616, configured to generate a temporary identifier, and establish an association relationship between the temporary identifier and the target file in an open state. A data transceiving unit 617, configured to send file sharing information to the second terminal device; wherein the file sharing information includes the temporary identifier.
Based on the same concept as the foregoing method embodiment, another file sharing apparatus is also provided in the embodiment of the present application, and the apparatus may be deployed as the file sharing apparatus 62 in the terminal device 102 as the second terminal device. As shown in fig. 8, the apparatus includes: a data transceiving unit 621 configured to receive file sharing information from the first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information includes a file identifier of a mapping file corresponding to a target file in the distributed file system, and the target file is a local file stored in the first terminal device and to be shared to the second terminal device. A file opening unit 622, configured to open the mapping file according to the file identifier. A file descriptor transfer unit 623, configured to generate, for a second application, a second file descriptor for accessing the mapped file in the open state, and provide the second file descriptor to the second application.
Based on the same concept as the foregoing method embodiment, another file sharing apparatus is also provided in the embodiment of the present application, and the apparatus may be deployed as the file sharing apparatus 62 in the terminal device 102 as the second terminal device. As shown in fig. 9, the apparatus includes: a data transceiving unit 624, configured to receive file sharing information from the first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information includes a temporary identifier, an association relationship between the temporary identifier and a target file in an open state is established in the first terminal device, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device. A file management unit 625, configured to create a temporary file in an open state in the second terminal device; a file descriptor transferring unit 626, configured to generate, for a second application, a second file descriptor for accessing the temporary file in the open state, and provide the second file descriptor and the temporary identifier to the second application.
In the above various aspects, the first distributed file service may send a metadata synchronization message to the second terminal device, the metadata synchronization message including metadata of the mapped file.
In the above aspects, the first terminal device may further send a file sharing request to the second terminal device, where the file sharing request includes a global identifier of the target file, and the global identifier is a unique identifier of the target file in the first terminal device. The second terminal device may provide the file sharing request to the second application program, and send a file sharing response containing the global identifier to the second terminal device in response to a user triggering operation of the global identifier through the second application program. Accordingly, the first terminal device may open the target file in response to the file sharing response from the second terminal device. Therefore, the user can access the target file as required through the second application program according to the service requirement of the user.
In each of the above file sharing apparatuses, the file sharing request may further include a first application identifier of the first application, the first application being deployed in the first terminal device and having a right to access the target file, the first application identifier being a unique identifier of the first application in the first terminal device. Accordingly, the file sharing response may also include the first application identification. The file sharing means in the first terminal device may open the object file by the first application in response to the file sharing response including the global identifier and the first application identifier.
In each of the above file sharing apparatuses, the global identifier of the target file includes the URI of the target file. The URI of the target file may specifically include a file information field, where the file information field is a storage path of the target file or a mapping character string corresponding to the storage path.
In each of the above file sharing apparatuses, the URI of the target file may further include a device information field, where the device information field is a device identifier of the first terminal device or a mapping character string corresponding to the device identifier.
In each of the above file sharing apparatuses, the URI of the target file further includes: the application information field specifically includes a first application identifier of the first application program or a mapping character string corresponding to the first application identifier.
In each of the above file sharing apparatuses, the file sharing request further includes a second application identifier of a second application program; the second application program is deployed in the second terminal device, and the second application identifier is the unique identifier of the second application program in the second terminal device.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application. Therefore, the embodiment of the application also provides a terminal device and a computer readable storage medium.
As shown in fig. 10, terminal device 100 may include a processor 1001, a memory 1002, and a communication interface 1003. Wherein the communication interface 1003 is used for communicating with other terminal devices. The memory 1002 stores computer program instructions/code which, when executed by the processor 1001: the terminal device 100, as the terminal device 101, implements the method performed by the terminal device 101 in the embodiment shown in fig. 3 or fig. 5; or the terminal device 100 as the terminal device 102, implements the method performed by the terminal device 102 in the embodiment shown in fig. 3 or fig. 5.
The computer readable storage medium is used for storing computer program instructions/code which, when executed by a processor of a terminal device, cause the terminal device to function as the terminal device 101, implementing the method performed by the terminal device 101 in the embodiment shown in fig. 3 or fig. 5; or cause the terminal device to be the terminal device 102, implementing the method performed by the terminal device 102 in the embodiment shown in fig. 3 or fig. 5.
It should be understood that, in various embodiments of the present application, the sequence numbers of the above-mentioned processes do not imply an order of execution, and the order of execution of the processes should be determined by their functions and inherent logic, and should not limit the implementation processes of the embodiments of the present application.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the network device may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
It will be appreciated that the above-described apparatus embodiments are illustrative, and that the division of the modules/units, for example, is merely one logical division, and that in actual implementation there may be additional divisions, for example, where multiple units or components may be combined or integrated into another system, or where some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The above embodiments are only specific examples of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present application, and all the changes or substitutions should be covered by the scope of the embodiments of the present application
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present application, and do not limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (30)

1. A file sharing method is applied to a first terminal device, wherein the first terminal device deploys a first distributed file service, and the method comprises the following steps:
opening a target file; the target file is a local file which is stored in the first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system;
in the distributed file system, creating metadata of a mapping file corresponding to the target file; wherein the metadata of the mapping file comprises a file identifier and an index identifier of the mapping file;
generating a first file descriptor for accessing the target file in an open state for the first distributed file service, and establishing an association relation between the first file descriptor and the index identifier;
sending file sharing information to the second terminal equipment; wherein the file sharing information comprises the file identification;
receiving a first file access request from the second terminal through the first distributed file service, wherein the first file access request comprises a request parameter and the index identifier; inquiring the incidence relation according to the index identification to determine the first file descriptor; and accessing the target file in an open state according to the request parameter and the first file descriptor.
2. The method of claim 1, further comprising:
sending a metadata synchronization message to the second terminal device through the first distributed file service; wherein the metadata synchronization message includes metadata of the mapped file.
3. A file sharing method is applied to a first terminal device, wherein the first terminal device deploys a first distributed file service, and the method comprises the following steps:
opening a target file; the target file is a local file which is stored in the first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system;
generating a temporary identifier, and establishing an association relation between the temporary identifier and the target file in an open state;
sending file sharing information to the second terminal equipment; wherein the file sharing information includes the temporary identifier;
receiving a first file access request from the second terminal device through the first distributed file service, wherein the first file access request comprises a request parameter and the temporary identifier; inquiring the association relation according to the temporary identifier, and determining the target file in an open state; and accessing the target file in an open state according to the request parameter.
4. The method of any of claims 1 to 3, further comprising:
sending a file sharing request to the second terminal device; wherein the file sharing request comprises a global identifier of the target file, and the global identifier is a unique identifier of the target file in the first terminal device;
the opening of the target file specifically includes: and responding to a file sharing response which is from the second terminal equipment and comprises the global identification, and opening the target file.
5. The method of claim 4,
the file sharing request further comprises a first application identifier of the first application program; the first application program is deployed in the first terminal equipment and has the authority of accessing the target file, and the first application identification is the unique identification of the first application program in the first terminal equipment;
the opening the target file in response to the file sharing response from the second terminal device and including the global identifier of the target file specifically includes: and responding to a file sharing response which is from the second terminal equipment and comprises the global identification and the first application identification, and opening the target file through the first application program.
6. The method of claim 4,
the global identification of the target file comprises a uniform resource locator (URI) of the target file; the URI of the target file specifically includes a file information field, where the file information field is a storage path of the target file or a mapping character string corresponding to the storage path.
7. The method of claim 6, wherein the URI of the target file further comprises:
a device information field, wherein the device information field specifically includes a device identifier of the first terminal device or a mapping character string corresponding to the device identifier;
and/or the presence of a gas in the gas,
an application information field, the application information field specifically including a first application identifier of the first application program or a mapping string corresponding to the first application identifier.
8. A file sharing method is applied to a second terminal device, wherein a second distributed file service is deployed in the second terminal device, and the method comprises the following steps:
receiving file sharing information from a first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information includes a file identifier of a mapping file corresponding to a target file in the distributed file system, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device;
opening the mapping file according to the file identifier;
generating a second file descriptor for a second application to access the mapped file in an open state and providing the second file descriptor to the second application;
receiving, by the second distributed file service, a second file access request of the second application to the mapped file in the open state, the second file access request including a request parameter and the second file descriptor; and sending a first file access request to the first terminal device, wherein the first file access request comprises the request parameter and an index identifier of the mapping file, and the index identifier is obtained from metadata of the mapping file according to the file identifier.
9. The method of claim 8, further comprising: receiving, by the second distributed file service, a metadata synchronization message from the first terminal device; wherein the metadata synchronization message includes metadata of the mapped file.
10. A file sharing method is applied to a second terminal device, wherein the second terminal device deploys a second distributed file service, and the method comprises the following steps:
receiving file sharing information from a first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information comprises a temporary identifier, an association relation between the temporary identifier and a target file in an open state is established in the first terminal device, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device;
creating a temporary file in an open state in the second terminal device;
generating a second file descriptor for accessing the temporary file in the open state for a second application program, and providing the second file descriptor and the temporary identifier to the second application program;
receiving, by the second distributed file service, a second file access request of the second application program for the temporary file in the open state, where the second file access request includes the second file descriptor, the temporary identifier, and the request parameter; and sending a first file access request to the first terminal device, wherein the first file access request comprises the request parameter and the temporary identifier.
11. The method of any of claims 8 to 10, further comprising:
receiving a file sharing request from the first terminal device; wherein the file sharing request comprises a global identifier of the target file, and the global identifier is a unique identifier of the target file in the first terminal device;
providing the file sharing request to the second application;
responding to the triggering operation of the user on the global identifier through the second application program, and sending a file sharing response to the second terminal device; wherein the file sharing response includes the global identification.
12. The method of claim 11,
the file sharing request further comprises a first application identifier of the first application program; the first application program is deployed in the first terminal equipment and has the authority of accessing the target file, and the first application identification is the unique identification of the first application program in the first terminal equipment;
the file sharing response further includes the first application identification.
13. The method of claim 11,
the global identification of the target file comprises a uniform resource locator (URI) of the target file; the URI of the target file specifically includes a file information field, where the file information field is a storage path of the target file or a mapping character string corresponding to the storage path.
14. The method of claim 13, wherein the URI of the target file further comprises:
a device information field, wherein the device information field specifically includes a device identifier of the first terminal device or a mapping character string corresponding to the device identifier;
and/or the presence of a gas in the gas,
an application information field, the application information field specifically including a first application identifier of the first application program or a mapping string corresponding to the first application identifier.
15. A file sharing apparatus, applied to a first terminal device, where a first distributed file service is deployed, the apparatus comprising:
the local file management unit is used for opening a target file; the target file is a local file which is stored in the first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system;
the distributed file management unit is used for creating metadata of a mapping file corresponding to the target file in the distributed file system; wherein the metadata of the mapping file comprises a file identifier and an index identifier of the mapping file;
a file descriptor transfer unit, configured to generate, for the first distributed file service, a first file descriptor for accessing the target file in an open state, and establish an association relationship between the first file descriptor and the index identifier;
a data sending unit, configured to send file sharing information to the second terminal device; wherein the file sharing information comprises the file identification;
the first distributed file service is configured to receive a first file access request from the second terminal, where the first file access request includes a request parameter and the index identifier; inquiring the incidence relation according to the index identification to determine the first file descriptor; and accessing the target file in an open state according to the request parameter and the first file descriptor.
16. The apparatus of claim 15, wherein the first distributed file service is further configured to send a metadata synchronization message to the second terminal device; wherein the metadata synchronization message includes metadata of the mapped file.
17. A file sharing apparatus, applied to a first terminal device, where a first distributed file service is deployed, the apparatus comprising:
the local file management unit is used for opening a target file; the target file is a local file which is stored in the first terminal device and is to be shared to a second terminal device, and the first terminal device and the second terminal device belong to the same distributed file system;
the incidence relation management unit is used for generating a temporary identifier and establishing the incidence relation between the temporary identifier and the target file in an open state;
the data receiving and sending unit is used for sending file sharing information to the second terminal equipment; wherein the file sharing information includes the temporary identifier;
the first distributed file service is configured to receive a first file access request from the second terminal device, where the first file access request includes a request parameter and the temporary identifier; inquiring the association relation according to the temporary identifier, and determining the target file in an open state; and accessing the target file in an open state according to the request parameter.
18. The apparatus of any one of claims 15 to 17,
the data receiving and sending unit is further configured to send a file sharing request to the second terminal device; wherein the file sharing request comprises a global identifier of the target file, and the global identifier is a unique identifier of the target file in the first terminal device;
the local file management unit is specifically configured to open the target file in response to a file sharing response from the second terminal device and including the global identifier.
19. The apparatus of claim 18,
the file sharing request further comprises a first application identifier of the first application program; the first application program is deployed in the first terminal equipment and has the authority of accessing the target file, and the first application identification is the unique identification of the first application program in the first terminal equipment;
the local file management unit is specifically configured to open the target file through the first application in response to a file sharing response from the second terminal device and including the global identifier and the first application identifier.
20. The apparatus of claim 18,
the global identification of the target file comprises a uniform resource locator (URI) of the target file; the URI of the target file specifically includes a file information field, where the file information field is a storage path of the target file or a mapping character string corresponding to the storage path.
21. The apparatus of claim 20, wherein the URI of the target file further comprises:
a device information field, wherein the device information field specifically includes a device identifier of the first terminal device or a mapping character string corresponding to the device identifier;
and/or the presence of a gas in the gas,
an application information field, the application information field specifically including a first application identifier of the first application program or a mapping string corresponding to the first application identifier.
22. A file sharing apparatus is applied to a second terminal device, where a second distributed file service is deployed in the second terminal device, and includes:
a data transceiving unit for receiving file sharing information from a first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information includes a file identifier of a mapping file corresponding to a target file in the distributed file system, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device;
the file opening unit is used for opening the mapping file according to the file identifier;
a file descriptor transfer unit for generating a second file descriptor for accessing the mapped file in the open state for a second application program, and providing the second file descriptor to the second application program;
the second distributed file service is used for receiving a second file access request of the second application program to the mapping file in the open state, and the second file access request comprises a request parameter and the second file descriptor; and sending a first file access request to the first terminal device, wherein the first file access request comprises the request parameter and an index identifier of the mapping file, and the index identifier is obtained from metadata of the mapping file according to the file identifier.
23. The apparatus of claim 22, wherein the second distributed file service is further configured to receive a metadata synchronization message from the first terminal device; wherein the metadata synchronization message includes metadata of the mapped file.
24. A file sharing apparatus is applied to a second terminal device, where the second terminal device deploys a second distributed file service, and includes:
a data transceiving unit for receiving file sharing information from a first terminal device; the first terminal device and the second terminal device belong to the same distributed file system, the file sharing information comprises a temporary identifier, an association relation between the temporary identifier and a target file in an open state is established in the first terminal device, and the target file is a local file which is stored in the first terminal device and is to be shared to the second terminal device;
a file management unit configured to create a temporary file in an open state in the second terminal device;
a file descriptor transfer unit, configured to generate, for a second application, a second file descriptor for accessing the temporary file in an open state, and provide the second file descriptor and the temporary identifier to the second application;
the second distributed file service is used for receiving a second file access request of the second application program to the temporary file in the open state, wherein the second file access request comprises the second file descriptor, the temporary identifier and the request parameter; and sending a first file access request to the first terminal device, wherein the first file access request comprises the request parameter and the temporary identifier.
25. The apparatus of any one of claims 22 to 24,
the data receiving and sending unit is further configured to receive a file sharing request from the first terminal device; wherein the file sharing request comprises a global identifier of the target file, and the global identifier is a unique identifier of the target file in the first terminal device;
the data transceiving unit is further configured to provide the file sharing request to the second application;
the data receiving and sending unit is further configured to send a file sharing response to the second terminal device in response to a trigger operation of the user on the global identifier through the second application program; wherein the file sharing response includes the global identification.
26. The apparatus of claim 25,
the file sharing request further comprises a first application identifier of the first application program; the first application program is deployed in the first terminal equipment and has the authority of accessing the target file, and the first application identification is the unique identification of the first application program in the first terminal equipment;
the file sharing response further includes the first application identification.
27. The apparatus of claim 25,
the global identification of the target file comprises a uniform resource locator (URI) of the target file; the URI of the target file specifically includes a file information field, where the file information field is a storage path of the target file or a mapping character string corresponding to the storage path.
28. The apparatus of claim 27, wherein the URI of the target file further comprises:
a device information field, wherein the device information field specifically includes a device identifier of the first terminal device or a mapping character string corresponding to the device identifier;
and/or the presence of a gas in the gas,
an application information field, the application information field specifically including a first application identifier of the first application program or a mapping string corresponding to the first application identifier.
29. A terminal device comprising a memory having stored therein computer program instructions/code and a processor which, when executing the computer program instructions/code, implements the method of any of claims 1 to 7 or claims 8 to 14.
30. A computer readable storage medium storing computer program instructions/code which, when executed by a processor of a terminal device, causes the terminal device to implement the method of any of claims 1 to 7 or claims 8 to 14.
CN202011565581.5A 2020-05-15 2020-12-25 File sharing method and terminal equipment Pending CN113672576A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2021/081199 WO2021227646A1 (en) 2020-05-15 2021-03-17 File sharing method and terminal device
US17/998,767 US20230195695A1 (en) 2020-05-15 2021-03-17 File Sharing Method and Terminal Device
EP21803105.2A EP4137957A4 (en) 2020-05-15 2021-03-17 File sharing method and terminal device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010414299 2020-05-15
CN2020104142990 2020-05-15

Publications (1)

Publication Number Publication Date
CN113672576A true CN113672576A (en) 2021-11-19

Family

ID=78537980

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011565581.5A Pending CN113672576A (en) 2020-05-15 2020-12-25 File sharing method and terminal equipment

Country Status (1)

Country Link
CN (1) CN113672576A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114048469A (en) * 2022-01-10 2022-02-15 荣耀终端有限公司 Directory operation management method, electronic device and readable storage medium
CN114374690A (en) * 2022-01-21 2022-04-19 荣耀终端有限公司 File sharing method, communication system and electronic equipment
CN114461993A (en) * 2022-01-24 2022-05-10 北京快乐茄信息技术有限公司 File sharing method and device and storage medium
WO2023216989A1 (en) * 2022-05-11 2023-11-16 华为技术有限公司 Method for converting file format, and electronic device
WO2024061129A1 (en) * 2022-09-20 2024-03-28 华为技术有限公司 Data access method, electronic device, and computer readable storage medium
WO2024067166A1 (en) * 2022-09-26 2024-04-04 华为技术有限公司 Method for sharing file, and electronic device and computer-readable storage medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114048469A (en) * 2022-01-10 2022-02-15 荣耀终端有限公司 Directory operation management method, electronic device and readable storage medium
CN114374690A (en) * 2022-01-21 2022-04-19 荣耀终端有限公司 File sharing method, communication system and electronic equipment
CN114374690B (en) * 2022-01-21 2023-10-31 荣耀终端有限公司 File sharing method, communication system and electronic equipment
CN114461993A (en) * 2022-01-24 2022-05-10 北京快乐茄信息技术有限公司 File sharing method and device and storage medium
WO2023216989A1 (en) * 2022-05-11 2023-11-16 华为技术有限公司 Method for converting file format, and electronic device
WO2024061129A1 (en) * 2022-09-20 2024-03-28 华为技术有限公司 Data access method, electronic device, and computer readable storage medium
WO2024067166A1 (en) * 2022-09-26 2024-04-04 华为技术有限公司 Method for sharing file, and electronic device and computer-readable storage medium

Similar Documents

Publication Publication Date Title
CN113672576A (en) File sharing method and terminal equipment
WO2020238751A1 (en) Resource access method under serverless architecture, device, system, and storage medium
CN109194506B (en) Block chain network deployment method, platform and computer storage medium
EP3657358B1 (en) Method, device and system for persistent data processing, and readable storage medium
US10515058B2 (en) Unified file and object data storage
CN111324571B (en) Container cluster management method, device and system
CN108984560B (en) File storage method and device
US6742035B1 (en) Directory-based volume location service for a distributed file system
CN111897623B (en) Cluster management method, device, equipment and storage medium
WO2021227646A1 (en) File sharing method and terminal device
CN106648462B (en) Date storage method and device
CN116034576B (en) Container Orchestration System (COS) service discovery across multiple COS clusters based on COS cluster domain name system
US10496590B2 (en) Enabling redirection policies to be applied based on the windows class of a USB device
CN111651418B (en) Document content downloading method and device, computer equipment and storage medium
CN110928554A (en) Deployment method, device, equipment and storage medium
CN113568758B (en) GPU resource pooling method, system, device and computer readable storage medium
JP2007535753A (en) System and method for user interface providing contact-based resource sharing
CN113377499B (en) Virtual machine management method, device, equipment and readable storage medium
CN114995948A (en) Method, device, equipment and system for downloading secure container mirror image file
CN115086166A (en) Computing system, container network configuration method, and storage medium
CN116760913B (en) Method and system for issuing k8s cluster protocol conversion platform configuration
CN114830105A (en) Data reading method and terminal
CN116346963A (en) Network communication method, device, medium, and program product
CN113691575B (en) Communication method, device and system
CN115525618A (en) Storage cluster, data storage method, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination