WO2023109272A1 - 监控方法与装置、电子设备 - Google Patents

监控方法与装置、电子设备 Download PDF

Info

Publication number
WO2023109272A1
WO2023109272A1 PCT/CN2022/124408 CN2022124408W WO2023109272A1 WO 2023109272 A1 WO2023109272 A1 WO 2023109272A1 CN 2022124408 W CN2022124408 W CN 2022124408W WO 2023109272 A1 WO2023109272 A1 WO 2023109272A1
Authority
WO
WIPO (PCT)
Prior art keywords
monitoring
directory
monitored
files
file
Prior art date
Application number
PCT/CN2022/124408
Other languages
English (en)
French (fr)
Inventor
唐迪娅
钟云
芦志朋
Original Assignee
南京欧珀软件科技有限公司
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 南京欧珀软件科技有限公司 filed Critical 南京欧珀软件科技有限公司
Publication of WO2023109272A1 publication Critical patent/WO2023109272A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • 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

Definitions

  • the present invention claims the priority of the earlier application of the application number 202111537172.9 with the title of "monitoring method and device, electronic equipment” submitted on December 15, 2021, and the content of the above-mentioned earlier application is incorporated into this document by way of introduction.
  • the present application relates to the field of computer technology, in particular to a monitoring method and device, and electronic equipment.
  • a distributed file system is composed of multiple (different) electronic devices. Among them, the distributed file system can break the storage boundary between electronic devices, so that files can be freely and safely shared (synchronized/shared/coordinated, etc.) among multiple (different) electronic devices without borrowing third-party applications.
  • the present application provides a monitoring method, device, and electronic equipment, in order to monitor file changes, provide easy-to-operate file change monitoring operations and interfaces, and enable users and developers to call only a small number of interfaces Realize the flexibility, diversity and accuracy monitoring of file changes.
  • the first aspect is a monitoring method of the present application, including:
  • the monitoring thread is used to monitor file changes, the monitoring thread maintains a monitoring queue and an event queue, the monitoring queue is used to store the path of the file that needs to be monitored, and the event queue uses Events corresponding to changes in stored files;
  • the process is controlled to take out the first event from the event queue to complete the monitoring of changes in the target file.
  • the second aspect is a monitoring device of the present application, including:
  • the opening unit is used to open the monitoring thread in the process.
  • the monitoring thread is used to monitor file changes.
  • the monitoring thread maintains a monitoring queue and an event queue.
  • the monitoring queue is used to store the path of the file that needs to be monitored.
  • the event queue is used to store events corresponding to file changes;
  • the adding unit is configured to add the first event corresponding to the change of the target file to the event queue when there is a change in the target file among the files to be monitored;
  • a control unit configured to control the process to take out the first event from the event queue to complete the monitoring of changes in the target file.
  • the third aspect is an electronic device of the present application, including a processor, a memory, and computer programs or instructions stored on the memory, and the processor executes the computer program or instructions to realize the above-mentioned first aspect. Steps in the method designed.
  • the fourth aspect is a computer-readable storage medium of the present application, wherein it stores computer programs or instructions, and when the computer programs or instructions are executed, the steps in the method designed in the above-mentioned first aspect are realized.
  • the fifth aspect is a computer program product of the present application, including computer programs or instructions, wherein, when the computer programs or instructions are executed, the steps in the method designed in the above-mentioned first aspect are realized.
  • Fig. 1 is a schematic diagram of the architecture of a distributed file system according to an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a software and hardware system of an electronic device according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an internal file structure of an electronic device according to an embodiment of the present application.
  • FIG. 4 is a schematic flow chart of a monitoring method in an embodiment of the present application.
  • FIG. 5 is a schematic flow diagram of a comprehensive monitoring of setting directories in an embodiment of the present application.
  • FIG. 6 is a schematic flow diagram of setting a single directory monitoring in an embodiment of the present application.
  • FIG. 7 is a schematic flow diagram of a complete cancel monitoring of a set directory in an embodiment of the present application.
  • FIG. 8 is a schematic flow diagram of setting a single directory cancellation monitoring in an embodiment of the present application.
  • FIG. 9 is a schematic flow diagram of setting file monitoring in an embodiment of the present application.
  • FIG. 10 is a schematic flow diagram of setting file cancellation monitoring in an embodiment of the present application.
  • FIG. 11 is a schematic diagram of an architecture of a local device and a remote device connected through a cross-end channel according to an embodiment of the present application;
  • FIG. 12 is a schematic flow diagram of monitoring file changes in the local device according to an embodiment of the present application.
  • FIG. 13 is a schematic flow diagram of monitoring file changes in a remote device according to an embodiment of the present application.
  • Fig. 14 is a schematic flowchart of another monitoring method according to the embodiment of the present application.
  • FIG. 15 is a block diagram of functional units of a monitoring device according to an embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • At least one in the embodiments of the present application refers to one or more, and multiple refers to two or more.
  • At least one of the following or similar expressions in the embodiments of the present application refer to any combination of these items, including any combination of a single item or a plurality of items.
  • at least one item (piece) of a, b or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b and c.
  • each of a, b, and c may be an element, or a set containing one or more elements.
  • “Sharing” in the embodiment of the present application may be expressed as the same concept as “synchronization”, “sharing”, and “coordination”. Therefore, shared files may be expressed as synchronous files, shared files, collaborative files, and the like.
  • Monitoring in the embodiments of the present application may be expressed as the same concept as “sensing”, “monitoring”, “detection”, “monitoring”, and “capturing”. Therefore, monitoring file changes can be expressed as sensing file changes, capturing file changes, and so on.
  • the files allowed to be monitored may be expressed as files allowed to be sensed, files allowed to be captured, and the like.
  • the files that need to be monitored can be expressed as files that need to be sensed, files that need to be captured, and so on.
  • the modification/change/change of the file by the user on the electronic device A cannot be captured on the electronic device B (such as the remote device), that is, the user is on the electronic device B.
  • the electronic device B such as the remote device
  • the embodiments of the present application need to ensure the consistency, security, privacy and real-time performance of file sharing (synchronization/sharing/collaboration, etc.) in the distributed file system.
  • the following methods can be used:
  • the file monitoring method can limit the scope of changes to specific files, and can realize real-time perception of file changes and timely response.
  • the following methods can exist:
  • One is to monitor file changes based on the ReadDirectorieschanges interface provided by the Windows operating system under the Windows operating system environment.
  • the interface provided by the Windows operating system is limited to the Windows platform, that is, it can only be used on the Windows platform, and cannot be migrated to the Android system at will.
  • One is, under the Linux operating system environment, based on the Inotify kernel feature provided by the Linux operating system, the monitoring of file changes is realized, that is, the monitored file change events are analyzed and processed through the Inotify kernel feature, and key information is extracted. .
  • the file monitoring method based on Linux's Inotify kernel features is mainly used for local modification monitoring on the one hand, and on the other hand directly uses Inotify for file monitoring, which involves creating Inotify instances, adding monitors, creating Epoll instances, and creating Inotify instances.
  • the file descriptor registers Epoll events and other operations, so the method of file monitoring through Inotify is relatively complicated to use, which is not conducive to users and developers.
  • the embodiment of the present application will provide a monitoring method, by configuring (setting/determining) the files that need to be monitored, constructing (creating) the monitoring queue and event queue, and reading the changes (update/ modify/change, etc.), capture the file change event in the event queue, take out the event and analyze and process the event, so as to realize the perception of file change, that is, monitor the file and provide simple and easy-to-operate files
  • Monitoring operations and interfaces enable users and developers to flexibly monitor files by calling only a few interfaces, which is conducive to ensuring the consistency of file sharing (synchronization/sharing/collaboration, etc.) in the distributed file system. Security, privacy and real-time.
  • the embodiment of the present application is beneficial to avoid the limitation of the Windows platform, and realizes the function of detecting file changes on the Android system.
  • the configuration (setting/determination) of the embodiment of the present application allows the operation of the monitored file to be relatively simple, and the scene of file change that can be perceived is richer. For example, you only need to set the top-level directory to automatically realize full monitoring of the directory.
  • it can be to monitor the files in the local device, or to monitor the files in the remote device, that is, to realize cross-terminal (between multiple/different electronic devices) Capture (monitor) changes to a file.
  • the electronic device may be a handheld device, a vehicle-mounted device, a wearable device, an augmented reality (augmented reality, AR) device, a virtual reality (virtual reality, VR) device, a projection device, a projector, or a device connected to a wireless
  • Other devices of the modem can also be various specific forms of user equipment (user equipment, UE), terminal device (terminal device), terminal, mobile phone (smart phone), smart screen, smart TV, smart watch, laptop computer, smart phone, etc. Audio, camera, game controller, microphone, station (station, STA), access point (access point, AP), mobile station (mobile Station, MS), personal digital assistant (personal digital assistant, PDA), personal computer (personal computer, PC) or relay equipment, etc.
  • the electronic device may be a wearable device.
  • the wearable device can also be called a smart wearable device, which is a general term for smart devices that apply wearable technology to intelligently design and develop daily wear, such as smart glasses, smart gloves, smart watches, various specific symptom monitoring, etc. Smart bracelets, smart jewelry, etc.
  • the wearable device is a portable device that can be directly worn on the body, or integrated into the user's clothing or accessories.
  • the wearable device can not only be equipped with a dedicated hardware architecture, but also can be equipped with a dedicated software architecture for data interaction, cloud interaction, etc.
  • the wearable smart device may not rely on other smart devices to realize complete or partial functions.
  • the technical solution of the embodiment of the present application can be applied to a distributed file system to ensure the security, consistency and real-time performance of file sharing (synchronization).
  • the distributed file system may be composed of multiple (different) electronic devices.
  • the distributed file system can break the storage boundary between electronic devices, so that files can be freely and safely shared (synchronized/shared/collaborated, etc.) among multiple (different) electronic devices without borrowing third-party applications.
  • the local device may be referred to as the electronic device currently being operated by the user, and the remote device may be referred to as other devices except the local device.
  • Users can locally trigger file changes on the local device through operations, or remotely trigger file changes on the remote device by operating the local device.
  • the local device and the remote device can realize interconnection and intercommunication through wireless or wired, and can communicate through a special cross-end channel (such as Google remote procedure call (Google remote procedure call, grpc), transmission control protocol (transmission control protocol, TCP) etc.) to realize the sharing of file changes (synchronization/sharing/collaboration, etc.).
  • Google remote procedure call Google remote procedure call, grpc
  • transmission control protocol transmission control protocol, TCP
  • the distributed file system 10 may include at least two electronic devices 110 .
  • at least two electronic devices 110 may include an electronic device 110A, an electronic device 110B, an electronic device 110C, an electronic device 110D, an electronic device 110E, and an electronic device 110F.
  • each of the at least two electronic devices 110 may be connected to each other through a wireless network or wired data communication.
  • the wireless network may include a mobile cellular network (such as a fifth-generation 5G mobile communication network), a wireless local area network (wireless local area network, WLAN), a wide area network (wide area network, WAN), Bluetooth (Bluetooth), wireless Fidelity (wireless fidelity, Wi-Fi), Zigbee (Zigbee), near field communication (near field communication, NFC) or ultra wide band (ultra wide band, UWB), etc.
  • a mobile cellular network such as a fifth-generation 5G mobile communication network
  • WLAN wireless local area network
  • WLAN wide area network
  • WAN wide area network
  • Bluetooth Bluetooth
  • wireless Fidelity wireless fidelity, Wi-Fi
  • Zigbee Zigbee
  • near field communication near field communication
  • UWB ultra wide band
  • the wired data may include HDMI data lines, USB data lines, and the like.
  • Each of the at least two electronic devices 110 may be a device under the same user account.
  • the at least two electronic devices 110 include the mobile phone, desktop computer, smart screen, notebook computer, middle The relay device and smart watch, and the mobile phone, desktop computer, smart screen, laptop, relay device and smart watch can communicate with each other through the wireless network.
  • Each of the at least two electronic devices 110 may be connected to the same WLAN network through a relay device (such as a router).
  • a relay device such as a router
  • the at least two electronic devices 110 include the mobile phone, desktop computer, smart screen, notebook computer, etc.
  • Computer, relay device and smart watch, and the mobile phone, desktop computer, smart screen, laptop, relay device and smart watch form a WLAN network, so that the devices in the WLAN network can communicate with each other through the relay device .
  • Each of the at least two electronic devices 110 can form a peer-to-peer (Peer to Peer, P2P) network through wireless communication (such as Bluetooth, Zigbee, NFC, UWB, etc.).
  • P2P peer-to-peer
  • wireless communication such as Bluetooth, Zigbee, NFC, UWB, etc.
  • a user forms a P2P network by scanning an NFC tag with a mobile phone, a laptop, and a smart watch, and all devices in the P2P network can communicate with each other before.
  • the electronic device When a user operates an electronic device among the at least two electronic devices 110, the electronic device may be called a local device, and other electronic devices other than the electronic device may be called remote devices.
  • the distributed file system 10 may also include other numbers of electronic devices, which are not specifically limited here.
  • the software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture or a cloud architecture.
  • the software and hardware system of the electronic device may include a hardware layer, an operating system layer running on the hardware layer, an application layer running on the operating system layer, and the like.
  • the hardware layer may include CPU, memory management unit (memory management unit, MMU) and memory (also called memory) and other hardware.
  • MMU memory management unit
  • memory also called memory
  • the memory can be used to store software programs and/or modules, and can include a program storage area and a data storage area.
  • the program storage area can be used to store an operating system or a software program required by at least one function.
  • the operating system may be any one or more computer operating systems that implement business processing through processes.
  • Android operating system RTOS (real-time operating system, real-time operating system) operating system, UNIX operating system, Linux operating system, DOS operating system, Windows operating system, Mac operating system, etc.
  • the data storage area may be used to store data required or generated by the operating system or at least one function.
  • the software and hardware system of the electronic device will be described exemplarily below by taking an operating system with a layered architecture as an example.
  • FIG. 2 is a schematic structural diagram of a software and hardware system of an electronic device according to an embodiment of the present application.
  • the operating system layer 230 is stored in the memory 220 .
  • the operating system layer includes a kernel layer 2301 , a system runtime layer 2302 , an application framework layer 2303 and an application layer 2304 .
  • the layers communicate with each other through software interfaces, and the kernel layer 2301 , the system runtime layer 2302 and the application framework layer 2303 belong to the operating system space.
  • the processor 210 can execute computer programs or instructions stored on the memory 220 to realize related operations.
  • the processor 210 can be regarded as a complete system on chip (system on chip, SOC), which can be used to run or load an operating system, and can include one or more processing units.
  • the processor 210 may include a central processing unit (central processing unit, CPU), an application processor (application processor, AP), a microcontroller unit (microcontroller unit, MCU), a single chip microcomputer (single chip microcomputer, SCM), Single-chip microcomputer, graphics processing unit (graphics processing unit, GPU), image signal processor (image signal processor, ISP), controller, digital signal processor (digital signal processor, DSP), field programmable logic gate array (field programmable gate array, FPGA), application-specific integrated circuit (application-specific integrated circuit, ASIC), baseband processor, neural network processor (neural-network processing unit, NPU) and the like at least one. Different processing units can be separated or integrated together.
  • the memory 220 may also be set in the processor 210 .
  • Processor 210 may also include one or more communication interfaces.
  • the communication interface may include a serial peripheral interface (serial peripheral interface, SPI), an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input/output (general-purpose input/output, At least one of a GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, a universal serial bus (universal serial bus, USB) interface, and the like.
  • SPI serial peripheral interface
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver/transmitter
  • MPI mobile industry processor interface
  • MIPI mobile industry processor interface
  • General-purpose input/output General
  • the memory 220 can be used to store computer programs or instructions, can be used to store data, and can be used to store the operating system layer 230 . Wherein, the processor 210 can call the program stored in the memory 220 to run the operating system.
  • the memory 220 can store or cache instructions just used or recycled by the processor 210, and can also store or cache data, and synchronize or transmit the data to other processors for execution.
  • Memory 220 may include random access memory (random access memory, RAM), read-only memory (read-only memory, ROM), erasable programmable read-only memory (erasable programmable read only memory, EPROM) or portable read-only memory (compact disc read-only memory, CD-ROM), etc. at least one item.
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EPROM erasable programmable read only memory
  • portable read-only memory compact disc read-only memory, CD-ROM
  • the kernel layer 2301 can provide underlying drivers for various hardware of electronic devices, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, power management, NFC drivers, UWB drivers, etc.
  • the system runtime layer 2302 can be used to provide main feature support for the operating system through some C/C++ libraries.
  • the SQLite library provides database support
  • the OpenGL/ES library provides 3D drawing support
  • the Webkit library provides browser kernel support.
  • the system runtime layer 2302 can also be used to provide an Android Runtime library (Android Runtime), which mainly provides some core libraries and can allow developers to use scripting languages to write applications.
  • Android Runtime Android Runtime
  • the system runtime layer 2302 can also be used to provide an Android Runtime library (Android Runtime), which mainly provides some core libraries and can allow developers to use scripting languages to write applications.
  • the application framework layer 2303 can be used to provide various application programming interfaces (application programming interface, API) and programming frameworks that may be used to build applications in the application layer 2304, so that developers can create applications by using these APIs.
  • API application programming interface
  • the application framework layer 2303 may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, a message manager, activity manager, package manager, location manager, etc.
  • the application layer 2304 belongs to the user space, and at least one application program (application, also referred to as "application”) runs in the application layer 2304 .
  • application also referred to as "application”
  • these application programs may be native applications built with the operating system, or third-party applications developed by third-party developers.
  • the application layer may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
  • An application may be called an application.
  • An application program refers to a program to complete a certain/multiple specific tasks or have a certain function, and the program runs on the operating system, can run on the application layer to interact with the user, and has a visual user interface.
  • applications can run on the application layer 2304 shown in FIG. 2 .
  • An application can generate (have) a folder, which can be used to store files (data) of the application.
  • a folder For any electronic device, its internal file structure may be shown in FIG. 3 .
  • an application 310 and an application 320 run on the application layer of the electronic device 300 .
  • the application 310 has its own private folder 3101 for saving files (private data) of the application 310, such as pictures, videos, music and documents.
  • the application 310 has the authority to access files (public data) in the public folder 330 .
  • the application 320 has its own private folder 3201 for storing files (private data) of the application 320, such as pictures, videos, music and documents. At the same time, the application 320 also has the right to access files (public data) in the public folder 330 .
  • a process can be a program with certain independent functions, a process of a single task executed by the CPU, or the smallest unit of CPU resource allocation during program execution, and has its own address space (memory space).
  • a thread can be the smallest unit of CPU scheduling, the smallest unit of program execution, an independent execution unit within a process, or a complete process of program execution.
  • a process can consist of at least one thread, and threads can be different lines of execution of code within the process. Processes are independent of each other, but each thread under the same process shares the memory space of the process (including code segment, data set, heap, etc.) and some process-level resources.
  • the directory may be a folder. Therefore, the directory may be a private folder corresponding to the application, a public folder that the application can access, or a file in the internal file structure of the electronic device, which is not specifically limited.
  • the directory structure there are a current directory, a parent directory, and a subdirectory.
  • the parent directory of the current directory is the upper-level directory of the current directory
  • the subdirectory of the current directory is the lower-level directory of the current directory.
  • directory structure c: ⁇ windows ⁇ system32 ⁇ a ⁇ b if the current directory is directory a, directory b is a subdirectory of directory a, directory system32 is the parent directory of directory a, and directory ⁇ windows is also directory a the parent directory of .
  • a file may be a unit defined for the purpose of realizing a certain function or part of a certain software function, and may refer to a collection of data stored on an external storage medium, which may be a computer hard disk or Memory is a collection of information stored on computers or electronic devices, which can be video, audio, text, documents, pictures, programs, music, data, etc., and can be any data generated by electronic devices or operating systems during operation.
  • the file may or may not be in a directory (folder), may be stored in a hard disk or memory, or may be stored in a computer-readable storage medium.
  • a file change may be understood as a file attribute change or a file attribute change.
  • file content changes For example, file permissions change, etc.
  • Changes in file content may include file content deletion, file content modification, file content update, file content addition, and file content creation. For example, delete documents, modify documents, create documents, play music, play videos, view pictures, delete pictures, etc.
  • Changes in file permissions may include changes in file access permissions (such as changing a file from a public file to a private file, changing a file from a private file to a public file, modifying a file so that only administrators or developers can access it, etc.),
  • the monitoring authority of the file changes (such as modifying the file from the unmonitorable state to the monitorable state, changing the file from the monitorable state to the unmonitorable state, changing the file from the monitored state to the unmonitored state, etc.).
  • file changes may be triggered by a user operating an electronic device. For example, the user clicks on an application in the electronic device, the user deletes a certain file in the electronic device, and so on.
  • the user opens the music software in the mobile phone (local device) to play songs.
  • the music software is broadcasting songs
  • the operating system of the mobile phone will perform a corresponding change operation on the files in the application folder of the music software.
  • the mobile phone (local device) is connected to a Bluetooth speaker (remote device) via Bluetooth, and the user controls the mobile phone to make the Bluetooth speaker play songs in the music software of the mobile phone.
  • the user's operation on the mobile phone will be captured by the operating system of the Bluetooth speaker through the cross-port channel, so that the operating system of the Bluetooth speaker will respond to the files in the folder of the Bluetooth speaker's music broadcasting application. change operation.
  • the monitoring status identifier includes a monitoring status identifier of a file and a monitoring status identifier of a directory.
  • each file may have a monitoring status identifier respectively, and the monitoring status identifier may be used to indicate the monitoring status of the file (the monitoring authority of the file), or the monitoring status identifier may be used to indicate whether the file is allowed to be monitor.
  • the monitoring status of the file can be one of monitorable, unmonitorable, and monitored. That is to say, the monitor status identifier of the file can be used to indicate one of monitorable, unmonitorable, and monitored.
  • the monitorable of the file can be used to indicate that the file is allowed to be monitored, but has not been monitored yet. Therefore, the electronic device (operating system) can monitor and process monitorable files.
  • the non-monitoring of the file can be used to indicate that the file is not allowed to be monitored. Therefore, the electronic device (operating system) cannot monitor and process unmonitorable files.
  • the monitored file can be used to indicate that the file is allowed to be monitored and has been monitored. Therefore, the electronic device (operating system) may no longer monitor the monitored file, or may revoke the monitoring of the monitored file to change it to a monitorable or unmonitorable state.
  • the monitoring state of the file can be configured (set) or modified according to the user's instruction, and can also be configured by factory default (default setting).
  • the monitoring state of a file is configured as monitorable by default, that is, allowed to be monitored but not yet monitored.
  • the user can configure the monitoring status of the file as monitorable, unmonitorable, or monitored according to his own needs.
  • the electronic device (operating system) may generate a user's configuration instruction, and execute the configuration instruction to implement a corresponding configuration operation.
  • the user can modify the monitoring status of the file from monitorable to unmonitorable according to his own needs.
  • the electronic device (operating system) may generate a modification instruction of the user, and execute the modification instruction to realize a corresponding modification operation.
  • the monitoring state of a file can be set as monitorable by default, and unmonitorable can only be configured according to the user. That is, unless the monitoring status of the user profile is unmonitorable, the monitoring status of the file will not be unmonitorable.
  • the file When the monitoring status of a user profile is watchable, the file will be appended with a watchable flag.
  • the file When the monitoring status of a user profile is ready to watch, the file will be appended with a watchable flag.
  • each directory can have a monitoring status identifier respectively, and the monitoring status identifier can be used to indicate the monitoring status of the directory (the monitoring authority of the directory), or the monitoring status identifier can be used to indicate the directory (all files under the directory ) is allowed to be monitored.
  • the monitoring status of the directory can be one of monitorable, unmonitorable, and monitored. That is to say, the monitoring status identifier of the directory can be used to indicate one of monitorable, unmonitorable, and monitored.
  • a directory can be monitored, which can be used to indicate that all files in this directory are allowed to be monitored, but have not been monitored yet. Therefore, the electronic device (operating system) can monitor the monitorable directory.
  • the non-monitoring of the directory can be used to indicate that all files in the directory are not allowed to be monitored. Therefore, the electronic device (operating system) cannot monitor the directory that cannot be monitored.
  • the monitored directory can be used to indicate that all files in the directory are allowed to be monitored and have been monitored. Therefore, the electronic device (operating system) may no longer monitor the monitored directory, or may revoke the monitoring of the monitored directory, so that it can be changed to a monitorable or unmonitorable state.
  • monitoring state of the directory will not be recursively configured (set) or modified along with the directory.
  • the monitoring status of the current directory is monitorable, the monitoring status of the subdirectories of the current directory is monitorable, and the monitoring status of the parent directory of the current directory is monitorable, when the monitoring status of the current directory is changed to When unmonitorable, the monitoring status of the subdirectory and the monitoring status of the parent directory will not be modified and remain unchanged.
  • the monitoring state of the directory can be configured (set) or modified according to the user's instruction, and can also be configured by factory default (default setting).
  • the monitoring state of the directory is configured as monitorable by default, that is, allowed to be monitored but not yet monitored.
  • the user can configure the monitoring status of the directory as monitorable, unmonitorable, or monitored according to his own needs.
  • the electronic device (operating system) may generate a user's configuration instruction, and execute the configuration instruction to implement a corresponding configuration operation.
  • the user can modify the monitoring status of the directory from monitorable to unmonitorable according to his own needs.
  • the electronic device (operating system) may generate a modification instruction of the user, and execute the modification instruction to realize a corresponding modification operation.
  • the monitoring state of the directory can be set as monitorable by default, and unmonitorable can only be configured according to the user. That is to say, unless the monitoring status of the user configuration directory is unmonitorable, the monitoring status of the directory will not be unmonitorable.
  • the directory When the monitoring status of the user configuration directory is monitorable, the directory will be attached with a monitorable flag.
  • the directory When the monitoring status of the user configuration directory is unmonitorable, the directory will be attached with an unmonitorable flag.
  • the directory When the monitoring status of the user configuration directory is ready to be monitored, the directory will be appended with a flag that can be monitored.
  • the embodiment of the present application may specifically open a thread as a monitoring thread, and the monitoring thread may be used to monitor file changes.
  • the monitor thread may maintain a monitor queue and an event queue.
  • the monitoring queue can be used to store (store/place, etc.) the paths of files that need to be monitored. Wherein, the monitoring queue is stored sequentially according to the sequence in which the paths are stored. The files that need to be monitored will be specified below.
  • the event queue can be used to store (store/place, etc.) events corresponding to file changes. Among them, the event queue is stored in sequence according to the sequence in which the events are stored.
  • an event can be recognized and operated by a control, can be parsed and processed by a process, can be called a file change event, and can be triggered by a user.
  • Each control (process) has its own identifiable events.
  • the operating system of the electronic device correspondingly generates an event.
  • Step 1 Start a monitoring thread 420 in the user process 410
  • a monitor thread 420 in the user process 410 is started by controlling the kernel 450 .
  • the user process 410 is a process in which the CPU executes a single user task.
  • the user process 410 consists of at least one thread, and there is a thread for monitoring file changes in the at least one thread, that is, the monitoring thread 420 .
  • the monitor thread 420 maintains a monitor queue 430 and an event queue 440 .
  • Step 2 The monitoring thread 420 adds monitoring objects to the monitoring queue 430
  • the monitoring queue 430 stores the path of the monitoring object, such as path 4301 , path 4302 and path 4303 .
  • the path of the monitored object may include a path of a directory and a path of a file.
  • the path of the directory is the path of all the files in the directory, that is, all the files in the directory share the path of the directory.
  • the monitoring queue 430 stores the paths according to the order in which they are stored, for example, the path 4301 is stored in the monitoring queue 430 first, and the path 4303 is stored in the monitoring queue 430 last.
  • Step 3 The kernel 450 obtains the monitoring object from the monitoring queue 430
  • Kernel 450 is the kernel in the operating system.
  • the kernel 450 reads the paths in the monitoring queue 430 in turn, so that the kernel 450 can determine which files in the files that are allowed to be monitored need to be monitored by reading the paths, that is, need Monitored files, so as to monitor these files that need to be monitored.
  • Step 4 The kernel 450 monitors that the file is changed, and adds the event to the event queue 440
  • the kernel 450 monitors (perceives/captures, etc.) that there is a file change in the file that needs to be monitored
  • the event (change event) corresponding to the file change is added to the event queue 440 by the control kernel 450, so that the event queue 440 This event (change event) is stored.
  • event queue 440 stores events in sequence according to the order in which they are stored. For example, event 4401 is stored in the event queue 440 first, and event 4403 is stored in the event queue 440 last.
  • Step 5 The user process 410 takes out the event, parses the event, and generates a notification message
  • the notification message is used to notify the upper layer application layer to perform corresponding file change operations to complete the monitoring (perception/capture, etc.) of file changes.
  • a file or directory has a monitoring status identification. Therefore, in this embodiment of the present application, a file whose monitoring state is monitorable may be referred to as a file allowed to be monitored.
  • the files that are allowed to be monitored may be composed of files whose monitoring status is monitorable (files whose monitoring status flag indicates that they are monitorable).
  • the files allowed to be monitored may be determined by the monitoring status flag.
  • the files that can be monitored can be in the directory, not in the directory, only in the current directory, only in the subdirectory of the current directory, or only in the parent of the current directory
  • you can be in the current directory and the subdirectory of the current directory at the same time you can be in the current directory and the parent directory of the current directory at the same time, you can be in the current directory, the parent directory of the current directory, and the subdirectory of the current directory at the same time, There is no specific limitation on this.
  • the files allowed to be monitored may include files that need to be monitored and files that do not need to be monitored.
  • the embodiment of the present application can provide the following interface to set the monitoring settings of files or directories that are allowed to be monitored, that is, setting monitoring and canceling monitoring, so as to determine the files that need to be monitored, which is conducive to finely dividing the monitoring granularity.
  • Single directory monitoring settings can be used to set (configure) in the files that are allowed to be monitored, only the files in the current directory need to be monitored, and there is no need to recurse to monitor the subdirectories of the current directory.
  • Directory comprehensive monitoring settings can be used to set (configure) in the files that are allowed to be monitored, not only the files in the current directory need to be monitored, but also the files in all subdirectories of the current directory need to be monitored.
  • the files to be monitored determined by the method of "directory comprehensive monitoring setting" can be in the current directory and all subdirectories of the current directory at the same time.
  • the files under the current directory and all subdirectories of the current directory can be newly added to the files to be monitored.
  • Cancel monitoring settings for a single directory can be used to set (configure) in the files that are allowed to be monitored, only need to cancel the monitoring of files in the current directory, without recursing to monitor the subdirectories of the current directory.
  • the files that are only in the current directory can be deleted from the files that need to be monitored by "cancel monitoring settings for a single directory”.
  • the files in the current directory and all subdirectories of the current directory can be deleted from the files that need to be monitored through the method of "fully canceling the monitoring settings of the directory".
  • File monitoring settings can be used to set (configure) the need to monitor single or multiple files among the files allowed to be monitored.
  • files to be monitored determined by means of "file monitoring settings" can be single or multiple.
  • a single or multiple files can be newly added to the files to be monitored by means of "file monitoring settings".
  • Cancel file monitoring settings can be used to set (configure) the need to cancel monitoring for one or more files in the files that are allowed to be monitored.
  • single or multiple files can be deleted from the files that need to be monitored by "cancel file monitoring settings".
  • the files that need to be monitored may be determined from the files that are allowed to be monitored.
  • the files that need to be monitored can be determined from the files that are allowed to be monitored according to the operation instruction.
  • the operation instruction is generated according to the user's own requirements, and the files to be monitored are determined from the files allowed to be monitored according to the operation instruction.
  • the operation instruction can be used to request to execute one of the above-mentioned single directory monitoring setting, directory comprehensive monitoring setting, single directory cancel monitoring setting, directory comprehensive cancel monitoring setting, file monitoring setting, and file monitoring setting canceling.
  • the kernel can add the path of the file to be monitored to the monitoring queue according to the operation instruction, thereby determining the file to be monitored by adding the path; or,
  • the kernel can add or delete a path to the path of the file to be monitored stored in the monitoring queue according to the operation instruction, so as to determine the file to be monitored by adding or deleting the path, or update the required path by adding or deleting the path. Monitored files.
  • Step 1 Request that the directory needs to be monitored
  • an operation instruction is obtained, and the operation instruction may be used to request that the directory comprehensive monitoring setting be performed on the directory, that is, request to monitor the directory.
  • the operation instruction may contain (carry) the path of the directory. Wherein, all the files in the directory can share the path of the directory, that is, the paths of all the files in the directory can be the path of the directory.
  • Step 2 Determine whether all parent directories of the directory are allowed to be monitored
  • the determination may be made according to the above-mentioned monitoring state identification.
  • step 6 If there is a parent directory that is not allowed to be monitored in all parent directories of the directory, that is, "No", it indicates that the parent directory has been configured with a label that cannot be monitored, and then step 6 is performed.
  • Step 3 Add the path of this directory in the monitoring queue
  • the kernel can read the path of the directory in the monitoring queue, so that the files in the directory (automatically all files in the directory) can be determined to be monitored files, or the files in the directory (automatically all files in the directory) can be added to the files to be monitored, so as to realize the monitoring of these files to be monitored.
  • Step 4 Determine whether there are subdirectories under the directory
  • this embodiment of the present application judges whether there are subdirectories under the directory according to the identifier.
  • step 5 If there are subdirectories under the directory, that is, "Yes", go to step 5.
  • Step 5 Add the path of the subdirectory in the monitoring queue
  • the kernel can read the path of the subdirectory in the monitoring queue, so that the files in the subdirectory (automatically all files in the subdirectory file) is determined as the file that needs to be monitored, or the files in the subdirectory (all files in the subdirectory can be automatically added) to the files that need to be monitored, so as to realize the monitoring of these files that need to be monitored .
  • Step 6 Cancel the Execution Request
  • Step 1 Request that the directory needs to be monitored
  • an operation instruction is obtained, and the operation instruction can be used to request that a single directory monitoring setting needs to be performed on a directory, that is, request to monitor the directory.
  • the operation instruction may contain (carry) the path of the directory. Wherein, all the files in the directory can share the path of the directory, that is, the paths of all the files in the directory can be the path of the directory.
  • Step 2 Determine whether the directory is allowed to be monitored
  • the directory is not allowed to be monitored, that is, "No"
  • it indicates that the directory has been configured with a label that cannot be monitored and then perform step 4.
  • the determination may be made according to the above-mentioned monitoring state identification.
  • step 3 If the directory is allowed to be monitored, that is, "Yes", it means that the directory has been configured with a label that can be monitored, and then perform step 3.
  • Step 3 Add the path of this directory in the monitoring queue
  • the kernel can read the path of the directory in the monitoring queue, so that the files in the directory (automatically all files in the directory) can be determined to be monitored files, or the files in the directory (automatically all files in the directory) can be added to the files to be monitored, so as to realize the monitoring of these files to be monitored.
  • Step 4 Cancel the Execution Request
  • Step 1 Request to unmonitor the directory
  • an operation instruction is obtained, and the operation instruction can be used to request that the directory completely cancel the monitoring setting of the directory, that is, request to cancel the monitoring of the directory.
  • the operation instruction may contain (carry) the path of the directory. Wherein, all the files in the directory can share the path of the directory, that is, the paths of all the files in the directory can be the path of the directory.
  • Step 2 Delete the path to the directory in the monitoring queue
  • the kernel By deleting the path of the directory from the monitoring queue, the kernel no longer needs to monitor the files in the directory (all the files in the directory), thereby realizing canceling the monitoring of the directory.
  • Step 3 Determine whether there are subdirectories under the directory
  • this embodiment of the present application judges whether there are subdirectories under the directory according to the identifier.
  • Step 4 Delete the path of the subdirectory in the monitoring queue
  • step 3 By repeating step 3 and step 4, until there is no monitored subdirectory under the directory, it is possible to completely cancel the monitoring settings for the directory.
  • the kernel no longer needs to monitor the files in the subdirectory (all files in the directory), thereby realizing canceling the monitoring of the subdirectory.
  • Step 1 Request to unmonitor the directory
  • an operation instruction is obtained, and the operation instruction can be used to request that the monitoring setting of a single directory needs to be cancelled, that is, request to cancel the monitoring of the directory.
  • the operation instruction may contain (carry) the path of the directory. Wherein, all the files in the directory can share the path of the directory, that is, the paths of all the files in the directory can be the path of the directory.
  • Step 2 Delete the path to the directory in the monitoring queue
  • the kernel By deleting the path of the directory from the monitoring queue, the kernel no longer needs to monitor the files in the directory (all the files in the directory), thereby realizing canceling the monitoring of the directory.
  • the following uses the operation instruction to request execution file monitoring settings as an example for an exemplary description.
  • Step 1 Request that files need to be monitored
  • an operation instruction is obtained, and the operation instruction can be used to request that the file monitoring setting needs to be performed on the file, that is, request to monitor the file.
  • the operation instruction may contain (carry) the path of the file.
  • Step 2 Determine whether the file is allowed to be monitored
  • step 4 If the file is not allowed to be monitored, that is, "No", it indicates that the file has been configured with a label that cannot be monitored, and step 4 is performed at this time.
  • the determination may be made according to the above-mentioned monitoring state identification.
  • step 3 If the file is allowed to be monitored, that is, "Yes", it means that the file has been configured with a tag that can be monitored, and then go to step 3.
  • Step 3 Add the path of the file in the monitoring queue
  • the kernel can read the path of the file in the monitoring queue, so that the file can be determined as the file that needs to be monitored, or the file can be added to the file that needs to be monitored files, so as to realize the monitoring of these files that need to be monitored.
  • Step 4 Cancel the Execution Request
  • Step 1 Request to unmonitor the file
  • an operation instruction is obtained, and the operation instruction can be used to request that the monitoring setting of the file needs to be canceled, that is, request to cancel the monitoring of the file.
  • the operation instruction may contain (carry) the path of the file.
  • Step 2 Delete the path of the file in the monitoring queue
  • the kernel By deleting the path of the file from the monitoring queue, the kernel no longer needs to monitor the file, thereby realizing unmonitoring of the file.
  • Monitor perceive/capture file changes in the local device or remote device
  • the user after setting monitoring for a file or directory, the user can locally trigger file changes in the local device through operations, or remotely trigger file changes in the remote device by operating the local device.
  • the embodiment of the present application can not only monitor file changes in the local device, but also monitor file changes in the remote device.
  • the changed files need to be shared between the local device and the remote device (synchronization/sharing/collaboration, etc.), so that the consistency, security, privacy and real-time performance of file sharing can be guaranteed in the distributed file system .
  • the following takes the connection between the local device and the remote device as an example for illustration.
  • the local device 1110 and the remote device 1120 are connected through an inter-end channel 1130 , and file changes are shared (synchronized/shared/coordinated, etc.) through the inter-end channel 1130 .
  • the cross-end channel 1130 may be grpc, TCP, any channel for realizing cross-end communication, any channel with remote file monitoring capability, and the like.
  • An application 1111 and an application 1112 run on the application layer of the local device 1110 .
  • the application 1111 has its own private folder 1113, which is used to save the files (private data) of the application 1111, such as pictures, videos, music and documents.
  • the application 1111 has the authority to access files (public data) in the public folder 1114 .
  • the application 1112 has its own private folder 1115 for saving files (private data) of the application 1112, such as pictures, videos, music and documents. At the same time, the application 1112 also has the right to access files (public data) in the public folder 1114 .
  • an application 1121 and an application 1122 run on the application layer of the remote device 1120 .
  • the application 1121 has its own private folder 1123 for saving files (private data) of the application 1121, such as pictures, videos, music and documents.
  • the application 1121 has the authority to access files (public data) in the public folder 1124 .
  • the application 1122 has its own private folder 1125 for saving files (private data) of the application 1122, such as pictures, videos, music and documents. At the same time, the application 1122 also has the right to access files (public data) in the public folder 1124 .
  • Step 1 User Action
  • the kernel of the local device determines which files in the files that are allowed to be monitored need to be monitored by reading the path stored in the monitoring queue, that is, the files that need to be monitored, so that these files that need to be monitored to monitor.
  • the user operation may cause changes in files that need to be monitored, and the kernel can monitor (perceive/capture, etc.) the changes in the files.
  • Step 2 The kernel monitors that the file of the local device changes, and adds the event to the event queue of the monitoring thread
  • the kernel monitors that there is a file change in the file to be monitored, the event (change event) corresponding to the file change is added to the event queue by the control kernel, so that the event queue stores the event (change event).
  • Step 3 The process fetches the event, parses the event, and triggers the notification mechanism
  • the event is taken out from the event queue by the control process, the event is analyzed, and a notification message is generated (triggered). Wherein, the notification message is used to notify the upper application layer to perform the corresponding file change operation.
  • Step 4 The application layer executes the corresponding file change operation
  • the application layer After receiving the notification message from the lower layer, the application layer performs the corresponding file change operation, such as presenting the file change result on the display screen of the local device, so as to complete the monitoring of the file change.
  • Step 5 Synchronize the changed files to the remote device
  • the local device can synchronize the changed files to the remote device through the cross-end channel, so that the files on the remote device will also be changed accordingly, thereby ensuring the consistency, security and real-time performance of the files.
  • the following takes monitoring file changes in a remote device as an example for an exemplary description.
  • Step 1 User Action
  • the kernel of the remote device determines which files in the files that are allowed to be monitored need to be monitored by reading the path stored in the monitoring queue, that is, the files that need to be monitored, so that these files that need to be monitored to monitor.
  • the user operation may cause changes in the files that need to be monitored on the remote device, such as remotely modifying the files in the remote device.
  • the kernel of the remote device can monitor (perceive/capture, etc.) the change of the file.
  • Step 2 The kernel of the remote device monitors that its own files have changed, and adds the event to the event queue of the monitoring thread
  • the event (change event) corresponding to the file change is added to the event queue by the control kernel, so that the event queue stores the event (change event) ).
  • Step 3 The process of the remote device fetches the event, parses the event, and triggers the notification mechanism
  • the process of controlling the remote device takes the event from the event queue, analyzes the event, and generates (triggers) a notification message.
  • the notification message is used to notify the upper application layer of the remote device to perform a corresponding file change operation.
  • Step 4 The application layer of the remote device executes the corresponding file change operation
  • the application layer of the remote device executes the corresponding file change operation, such as presenting the file change result on the display screen of the remote device, thereby completing the monitoring of the file change.
  • Step 5 The remote device synchronizes the changed files to the local device
  • the remote device can synchronize the changed files to the local device through the cross-end channel, so that the files on the local device are also changed accordingly, thereby ensuring the consistency, security and real-time performance of the files.
  • Figure 14 is a schematic flowchart of a monitoring method in the embodiment of the present application, which can be applied to any electronic device, operating system, kernel, or processor in a local device, a remote device, or a distributed file system Or chips, etc., specifically include the following steps:
  • the monitoring thread is used to monitor file changes, the monitoring thread maintains a monitoring queue and an event queue, the monitoring queue is used to store the path of the file to be monitored, and the event queue is used to store An event corresponding to a file change.
  • the target file can be understood as a file that is changed due to user operations, which can be explained in conjunction with the content in the above "file change", and will not be repeated here.
  • the first event can be understood as an event specially generated by the operating system to process the change of the target file.
  • the first event and the target file have a correspondence/association/mapping relationship.
  • control process in S1430 takes out the first event from the event queue to complete the monitoring of changes to the target file, which may include: the control process takes out the first event from the event queue to generate the first event A message, the first message is used to notify the application layer to execute the change of the target file to complete the monitoring of the change of the target file.
  • the upper application layer can perform the change operation on the target file, such as presenting the file change result on the display screen of the local device or the remote device, which is beneficial to ensure that the user Visual inspection and complete monitoring of changes in target files.
  • the file to be monitored is in the local device; or, the file to be monitored is in the remote device; or, the file to be monitored is a file in the private directory corresponding to the application; or , the files that need to be monitored are the files in the public directory that the application can access.
  • the file to be monitored may be in the local device or in the remote device, which is not specifically limited.
  • the application in the embodiment of the present application can have its own private folder (private directory), and can access public folders (public directory) file (public data) permissions.
  • the files to be monitored may be files in a private directory corresponding to the application, or files in a public directory accessible to the application, and there is no specific limitation on this.
  • the files that need to be monitored are determined from the files that are allowed to be monitored; the files that are allowed to be monitored are determined by the monitoring status identifier, and the monitoring status identifier is used to indicate the monitoring status of the file or directory.
  • the status is one of monitorable, unmonitorable, and monitored.
  • the files that need to be monitored are determined from the files that are allowed to be monitored, and may include the following steps: the files that need to be monitored are determined from the files that are allowed to be monitored according to an operation instruction, and the operation instruction is used to request execution of a single One of directory monitoring settings, directory comprehensive monitoring settings, single directory cancel monitoring settings, directory full cancel monitoring settings, file monitoring settings, and cancel file monitoring settings.
  • the following step may also be included: adding or deleting a path to the path of the file to be monitored stored in the monitoring queue.
  • adding a path to the path of the file to be monitored stored in the monitoring queue may include the following steps: obtaining a first operation instruction, the first operation instruction is used to request that the first directory needs to be monitored; determining the first Whether all parent directories of the directory are allowed to be monitored; if there are parent directories that are not allowed to be monitored in all parent directories of the first directory, cancel the request for executing the first request message; if all parent directories of the first directory If all level directories are allowed to be monitored, execute the request of the first request message, and add the path of the first directory to the monitoring queue, so as to complete adding the files under the first directory to the files to be monitored.
  • the following steps may also be included: determining whether there is a subdirectory under the first directory; if there is a first subdirectory under the first directory, adding the first subdirectory The path is added to the monitoring queue to complete adding the files under the first subdirectory to the files that need to be monitored.
  • the embodiment of the present application can also determine whether to add the path of the first subdirectory to the monitoring queue by judging whether there is a subdirectory under the first directory, and determine whether to add the path of the first subdirectory to the monitoring queue.
  • the files in the first directory are added to the files to be monitored, so as to determine or update the files to be monitored, which is beneficial to provide monitoring diversity and meet user needs.
  • deleting the path from the path of the file that needs to be monitored stored in the monitoring queue may include the following steps: obtaining a second operation instruction, the second operation instruction is used to request to cancel the monitoring of the second directory; according to the second operation The instruction deletes the path of the second directory from the monitoring queue, so as to delete the files in the second directory from the files to be monitored.
  • the embodiment of the present application can delete the path of the second directory from the monitoring queue according to the operation instruction, and delete the files under the second directory from the files that need to be monitored, so as to realize the determination or Updating the files that need to be monitored will help ensure the diversity and reliability of monitoring and meet user needs.
  • the following steps may also be included: determining whether there is a subdirectory under the second directory; if there is a second subdirectory under the second directory, then from In the monitoring queue, delete the path of the second subdirectory, so as to delete the files under the second subdirectory from the files to be monitored.
  • the embodiment of the present application can delete the path of the second directory from the monitoring queue according to the operation instruction, and delete the files under the second subdirectory of the second directory from the files that need to be monitored , so as to determine or update files that need to be monitored, which is conducive to ensuring the diversity and reliability of monitoring and meeting user needs.
  • the following step may also be included: synchronizing the changed target file across devices.
  • the end device, or the remote device can synchronize the changed files to the local device, so as to achieve cross-device synchronization, which is conducive to ensuring the consistency, security and real-time performance of files.
  • the electronic device may include hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain method, function, module, unit or step is executed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods for each specific application to implement the described methods, functions, modules, units or steps, but such implementation should not be regarded as exceeding the scope of the present application.
  • each functional unit/module may be divided corresponding to each function, or two or more functions may be integrated into one functional unit/module.
  • the above-mentioned integrated functional units/modules can be implemented not only in the form of hardware, but also in the form of software programs. It should be noted that the division of functional units/modules in the embodiment of the present application is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 15 is a block diagram of functional units of a monitoring device according to an embodiment of the present application.
  • the monitoring device 1500 includes: an opening unit 1510 , an adding unit 1520 and a control unit 1530 .
  • the opening unit 1510, the adding unit 1520 and the control unit 1530 may be separated from each other, or may be integrated into the same unit.
  • the opening unit 1510, the adding unit 1520, and the control unit 1530 may be integrated in a processing unit.
  • the processing unit may be a processor or a controller, such as a central processing unit (central processing unit, CPU), a general purpose processor, a digital signal processor (digital signal processor, DSP), an application-specific integrated circuit (application-specific integrated circuit) circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various illustrative logical blocks, modules and circuits described in connection with the present disclosure.
  • the processing unit may also be a combination that realizes computing functions, for example, a combination of one or more microprocessors, a combination of DSP and a microprocessor, and the like.
  • the monitoring device 1500 may also include a storage unit for storing computer programs or instructions executed by the data monitoring device 1500 .
  • the storage unit may be a memory.
  • the monitoring device 1500 may be a chip/chip module/processor/electronic device/operating system.
  • the enabling unit 1510, the adding unit 1520, and the controlling unit 1530 are configured to execute the steps described in the foregoing method embodiments. Detailed description will be given below.
  • the opening unit 1510 is used to open the monitoring thread in the process.
  • the monitoring thread is used to monitor file changes.
  • the monitoring thread maintains a monitoring queue and an event queue.
  • the monitoring queue is used to store the path of the file to be monitored, and the event queue is used to store Events corresponding to file changes;
  • Adding unit 1520 configured to add the first event corresponding to the change of the target file to the event queue when there is a change in the target file among the files to be monitored;
  • the control unit 1530 is configured to control the process to take out the first event from the event queue to complete the monitoring of the change of the target file.
  • control unit 1530 in terms of the control process taking out the first event from the event queue to complete the monitoring of changes to the target file, the control unit 1530 is used to:
  • the control process fetches the first event from the event queue to generate a first message, and the first message is used to notify the application layer to execute the change of the target file to complete the monitoring of the change of the target file.
  • the files to be monitored are in the local device; or, the files to be monitored are in the remote device; or, the files to be monitored are files in the private directory corresponding to the application; or , the files that need to be monitored are the files in the public directory that the application can access.
  • the files that need to be monitored are determined from the files that are allowed to be monitored; the files that are allowed to be monitored are determined by the monitoring status identifier, and the monitoring status identifier is used to indicate the monitoring status of the file or directory.
  • the status is one of monitorable, unmonitorable, and monitored.
  • the files that need to be monitored are determined from the files that are allowed to be monitored, including: the files that need to be monitored are determined from the files that are allowed to be monitored according to the operation instruction, and the operation instruction is used to request execution Single directory monitoring setting, directory comprehensive monitoring setting, single directory cancel monitoring setting, directory comprehensive cancel monitoring setting, file monitoring setting, cancel file monitoring setting.
  • the monitoring device 1500 after starting the monitoring thread, the monitoring device 1500 also includes:
  • the setting unit is used to add or delete a path to the path of the file to be monitored stored in the monitoring queue.
  • the setting unit is used for:
  • the request of the first request message is executed, and the path of the first directory is added to the monitoring queue, so as to complete adding the files under the first directory to the files that need to be monitored document.
  • the monitoring device 1500 further includes:
  • the determining unit is used to determine whether there is a subdirectory under the first directory; and if there is a first subdirectory under the first directory, the path of the first subdirectory is added to the monitoring queue to complete the file under the first subdirectory Add to the files that need to be monitored.
  • the setting unit in terms of deleting the path from the path of the file that needs to be monitored stored in the monitoring queue, the setting unit is used to:
  • the path of the second directory is deleted from the monitoring queue according to the second operation instruction, so as to delete the files under the second directory from the files to be monitored.
  • the monitoring device 1500 further includes:
  • a determining unit is used to determine whether there is a subdirectory under the second directory; and if there is a second subdirectory under the second directory, then delete the path of the second subdirectory from the monitoring queue, so as to complete the files under the second subdirectory Remove from files that need to be monitored.
  • the monitoring device 1500 further includes:
  • the synchronization unit is used to synchronize the changed target file across devices.
  • the electronic device 1600 includes a processor 1610 , a memory 1620 and a communication bus for connecting the processor 1610 and the memory 1620 .
  • Processor 1610 may be one or more central processing units (CPUs).
  • the processor 1610 may be a single-core CPU or a multi-core CPU.
  • Memory 1620 includes, but is not limited to, random access memory (random access memory, RAM), read-only memory (read-only memory, ROM), erasable programmable read-only memory (erasable programmable read only memory, EPROM) or portable Read-only memory (compact disc read-only memory, CD-ROM), and the memory 1620 is used to store computer programs or instructions.
  • the electronic device 1600 also includes a communication interface for receiving and sending data.
  • the processor 1610 in the electronic device 1600 is used to execute the computer program or instruction 1621 stored in the memory 1620 to realize the steps in the method designed as follows:
  • the monitoring thread is used to monitor file changes.
  • the monitoring thread maintains a monitoring queue and an event queue.
  • the monitoring queue is used to store the path of the file that needs to be monitored, and the event queue is used to store the file corresponding to the change. event;
  • the first event corresponding to the change in the target file is added to the event queue
  • the control process takes out the first event from the event queue to complete the monitoring of changes in the target file.
  • the processor 1610 is used to execute the computer program or instruction 1621 stored in the memory 1620 to realize the following design in terms of the control process taking out the first event from the event queue to complete the monitoring of the change of the target file.
  • the control process fetches the first event from the event queue to generate a first message, and the first message is used to notify the application layer to execute the change of the target file to complete the monitoring of the change of the target file.
  • the files to be monitored are in the local device; or, the files to be monitored are in the remote device; or, the files to be monitored are files in the private directory corresponding to the application; or , the files that need to be monitored are the files in the public directory that the application can access.
  • the files that need to be monitored are determined from the files that are allowed to be monitored; the files that are allowed to be monitored are determined by the monitoring status identifier, and the monitoring status identifier is used to indicate the monitoring status of the file or directory.
  • the status is one of monitorable, unmonitorable, and monitored.
  • the files that need to be monitored are determined from the files that are allowed to be monitored, including: the files that need to be monitored are determined from the files that are allowed to be monitored according to the operation instruction, and the operation instruction is used to request execution Single directory monitoring setting, directory comprehensive monitoring setting, single directory cancel monitoring setting, directory comprehensive cancel monitoring setting, file monitoring setting, cancel file monitoring setting.
  • the processor 1610 is also used to execute the computer program or instruction 1621 stored in the memory 1620 to realize the steps in the method designed as follows:
  • the processor 1610 is used to execute the computer program or instruction 1621 stored in the memory 1620 to implement the following designed method in terms of adding a path to the path of the files stored in the monitoring queue that need to be monitored Steps in:
  • the request of the first request message is executed, and the path of the first directory is added to the monitoring queue, so as to complete adding the files under the first directory to the files that need to be monitored document.
  • the processor 1610 is also used to execute the computer program or instruction 1621 stored in the memory 1620 to realize the steps in the method designed as follows:
  • the path of the first subdirectory is added to the monitoring queue, so as to complete adding the files in the first subdirectory to the files to be monitored.
  • the processor 1610 is used to execute the computer program or the instruction 1621 stored in the memory 1620 to implement the method designed as follows A step of:
  • the path of the second directory is deleted from the monitoring queue according to the second operation instruction, so as to delete the files under the second directory from the files to be monitored.
  • the processor 1610 is also used to execute the computer program or instruction 1621 stored in the memory 1620 to implement the following designed method A step of:
  • the path of the second subdirectory is deleted from the monitoring queue, so as to delete the files under the second subdirectory from the files to be monitored.
  • the processor 1610 is further configured to execute the computer program or instruction 1621 stored in the memory 1620 to realize the following Steps in the designed method: synchronizing the changed target file across devices.
  • the embodiments of the present application also provide a computer-readable storage medium, which stores computer programs or instructions, and when the computer programs or instructions are executed, the steps in the methods designed in the above-mentioned embodiments are realized.
  • An embodiment of the present application further provides a computer program product, including a computer program or an instruction, wherein, when the computer program or instruction is executed, the steps in the method designed in the foregoing embodiments are implemented.
  • the computer program product may be a software installation package.
  • the product includes a module/unit, which may be a software module/unit, or a hardware module/unit, or partly a software module/unit, partly a hardware module/unit.
  • a module/unit which may be a software module/unit, or a hardware module/unit, or partly a software module/unit, partly a hardware module/unit.
  • each device of the application or integrated chip, and each module/unit contained in the product can be realized by hardware such as circuits, or at least some modules/units can be realized by software programs, which run on the integrated processing inside the chip.
  • the rest of the modules/units can be realized by means of hardware such as circuits; for each device or product corresponding to or integrated with a chip module, each module/unit contained in it can be realized by means of hardware such as circuits, different modules/units
  • the units can be located in the same part of the chip module (such as a chip, a circuit module, etc.) or in different components, and at least part/unit can be implemented in the form of a software program, which runs on the remaining part of the integrated processor inside the chip module/
  • the unit can be implemented by means of hardware such as circuits; for each device or product corresponding to or integrated with the terminal, the modules/units it contains can all be implemented by means of hardware such as circuits, and different modules/units can be located in the same component in the terminal (for example, Chips, circuit modules, etc.) or different components, or at least part of the modules/units can be implemented in the form of software programs, which run on the processor integrated in the terminal, and the remaining sub-modules/units can be
  • the methods, steps or functions of related modules/units described in the embodiments of the present application may be realized in whole or in part by software, hardware, firmware or any combination thereof.
  • software When implemented by software, it may be implemented in whole or in part in the form of a computer program product, or may be implemented in a manner in which a processor executes computer program instructions.
  • the computer program product includes at least one computer program instruction, and the computer program instruction can be composed of corresponding software modules, and the software modules can be stored in RAM, flash memory, ROM, EPROM, EEPROM, registers, hard disk, mobile hard disk, CD-ROM (CD-ROM) or any other form of storage medium known in the art.
  • the computer program instructions may be stored in, or transmitted from, one computer-readable storage medium to another computer-readable storage medium.
  • the computer program instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media.
  • the available medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium, or a semiconductor medium (such as an SSD).
  • Each module/unit contained in each device or product described in the above embodiments may be a software module/unit, may be a hardware module/unit, or may be a part of a software module/unit while the other part is a hardware module/unit.
  • each module/unit included in it may be implemented by hardware such as a circuit; or, a part of the modules/units included in it may be implemented by a software program.
  • the software program runs on the processor integrated in the chip, and some modules/units of the other part (if any) can be realized by hardware such as circuits. The same can be understood for each device or product applied to or integrated in a chip module, or each device or product applied to or integrated in a terminal.

Landscapes

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

Abstract

本申请公开了一种监控方法与装置、电子设备,该方法包括:开启进程中的监控线程,监控线程用于监控文件变更,监控线程维护一个监控队列和一个事件队列,监控队列用于存放需要被监控的文件的路径,事件队列用于存放文件发生变更所对应的事件;当需要被监控的文件中存在目标文件发生变更时,将目标文件发生变更所对应的第一事件添加到事件队列中;控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控,从而实现对文件变更进行监控,实现提供易于操作的文件变更的监控操作和接口,进而使得用户和开发人员可以只需调用少量的接口来实现对文件变更进行灵活性、多样性及准确性的监控。

Description

监控方法与装置、电子设备
本发明要求2021年12月15日递交的发明名称为“监控方法与装置、电子设备”的申请号202111537172.9的在先申请优先权,上述在先申请的内容以引入的方式并入本文本中。
技术领域
本申请涉及计算机技术领域,具体涉及一种监控方法与装置、电子设备。
背景技术
分布式文件系统是由多个(不同)电子设备所组成的。其中,分布式文件系统可以打破电子设备间的存储边界,使得文件可以在多个(不同)电子设备之间自由、安全的共享(同步/分享/协同等),无需借用第三方应用。
然而,用户可能会对分布式文件系统中的电子设备进行相应的操作,从而导致该电子设备中的文件发生变更(变化/更改等)。因此,如何监控(感知/捕获等)文件的变更,还需要进一步研究。
发明内容
本申请提供了一种监控方法与装置、电子设备,以期望实现对文件变更进行监控,实现提供易于操作的文件变更的监控操作和接口,进而使得用户和开发人员可以只需调用少量的接口来实现对文件变更进行灵活性、多样性及准确性的监控。
第一方面,为本申请的一种监控方法,包括:
开启进程中的监控线程,所述监控线程用于监控文件变更,所述监控线程维护一个监控队列和一个事件队列,所述监控队列用于存放需要被监控的文件的路径,所述事件队列用于存放文件发生变更所对应的事件;
当所述需要被监控的文件中存在目标文件发生变更时,将所述目标文件发生变更所对应的第一事件添加到所述事件队列中;
控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控。
第二方面,为本申请的一种监控装置,包括:
开启单元,用于开启进程中的监控线程,所述监控线程用于监控文件变更,所述监控线程维护一个监控队列和一个事件队列,所述监控队列用于存放需要被监控的文件的路径,所述事件队列用于存放文件发生变更所对应的事件;
添加单元,用于当所述需要被监控的文件中存在目标文件发生变更时,将所述目标文件发生变更所对应的第一事件添加到所述事件队列中;
控制单元,用于控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控。
第三方面,为本申请的一种电子设备,包括处理器、存储器及存储在所述存储器上的计算机程序或指令,所述处理器执行所述计算机程序或指令以实现上述第一方面中所设计的方法中的步骤。
第四方面,为本申请的一种计算机可读存储介质,其中,其存储有计算机程序或指令,所述计算机程序或指令被执行时以实现上述第一方面中所设计的方法中的步骤。
第五方面,为本申请的一种计算机程序产品,包括计算机程序或指令,其中,所述计算机程序或指令被执行时以实现上述第一方面中所设计的方法中的步骤。
可以看出,本申请实施例中,通过配置需要被监控的文件,开启进程和监控线程,维护监控队列和事件队列,存储需要被监控的文件的路径,存储文件发生变更所对应的事件,从事件队列中取出事件,从而实现对文件变更进行监控,实现提供易于操作的文件变更的监控操作和接口,进而使得用户和开发人员可以只需调用少量的接口来实现对文件变更进行灵活性、多样性及准确性的监控。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。
图1是本申请实施例的一种分布式文件系统的架构示意图;
图2是本申请实施例的一种电子设备的软硬件系统的架构示意图;
图3是本申请实施例的一种电子设备的内部文件结构的架构示意图;
图4是本申请实施例的一种监控方法的流程示意图;
图5是本申请实施例的一种设置目录全面监控的流程示意图;
图6是本申请实施例的一种设置单个目录监控的流程示意图;
图7是本申请实施例的一种设置目录全面取消监控的流程示意图;
图8是本申请实施例的一种设置单个目录取消监控的流程示意图;
图9是本申请实施例的一种设置文件监控的流程示意图;
图10是本申请实施例的一种设置文件取消监控的流程示意图;
图11是本申请实施例的一种本端设备和远端设备通过跨端通道连接的架构示意图;
图12是本申请实施例的一种监控本端设备中的文件变更的流程示意图;
图13是本申请实施例的一种监控远端设备中的文件变更的流程示意图;
图14是本申请实施例的又一种监控方法的流程示意图;
图15是本申请实施例的一种监听装置的功能单元组成框图;
图16是本申请实施例的一种电子设备的结构示意图。
具体实施方式
为了本技术领域人员更好理解本申请的技术方案,下面结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。显然所描述的实施例是本申请一部分实施例,而不是全部的实施例。针对本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应理解,本申请实施例中涉及的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如,包含了一系列步骤或单元的过程、方法、软件、产品或设备没有限定于已列出的步骤或单元,而是还包括没有列出的步骤或单元,或还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。
本申请实施例中涉及的“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申 请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
本申请实施例中的“至少一个”,指的是一个或多个,多个指的是两个或两个以上。
本申请实施例中的“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示如下三种情况:单独存在A,同时存在A和B,单独存在B。其中,A、B可以是单数或者复数。字符“/”可以表示前后关联对象是一种“或”的关系。另外,符号“/”也可以表示除号,即执行除法运算。
本申请实施例中的“以下至少一项(个)”或其类似表达,指的是这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b或c中的至少一项(个),可以表示如下七种情况:a,b,c,a和b,a和c,b和c,a、b和c。其中,a、b、c中的每一个可以是元素,也可以是包含一个或多个元素的集合。
需要说明的是,本申请实施例中出现的“变更”可以与“更新”、“修改”、“改变”、“变化”等表达为同一个概念。
本申请实施例中出现的“共享”可以与“同步”、“分享”、“协同”等表达为同一个概念。因此,共享文件可以表达为同步文件、分享文件、协同文件等。
本申请实施例中出现的“监控”可以与“感知”、“监测”、“检测”、“监听”、“捕捉”等表达为同一个概念。因此,监控文件变更可以表达为感知文件变更、捕捉文件变更等。允许被监控的文件可以表达为允许被感知的文件、允许被捕捉的文件等。需要被监控的文件可以表达为需要被感知的文件、需要被捕捉的文件等。
随着技术和社会的发展,世界趋于万物互通互融,这将给我们的生活带来极大的便利。例如,由多个(不同)电子设备所组成的分布式文件系统可以打破电子设备间的存储边界,使得文件可以在多个(不同)电子设备之间进行自由、安全的共享或同步,而无需借用第三方应用。由此可以提取出以下需求:
1)用户希望能够随时访问多个(不同)电子设备中的文件(非本地)。
2)用户希望能够进行文件的共享或同步控制(按照需求)。
但是,随着文件的共享或同步,如何保证文件在多个(不同)电子设备中的一致性(即文件相同)而不发生错误,成为了一个非常关键的问题。
如果无法保证文件一致性,使得用户在电子设备A(如本端设备)上对文件的修改/更改/改变而无法在电子设备B(如远端设备)上捕获,即用户在电子设备B上无法看到该文件的修改/更改/改变。甚至可能引入一系列的安全问题,例如,当用户在电子设备A上取消文件共享或者修改文件属性为私有等操作时,由于电子设备B无法捕获该操作,从而导致电子设备B依然能够看到该文件,从而带来安全隐患。
另外,在分布式文件系统中,当用户将电子设备A中的文件共享至电子设备B时,用户在电子设备B上对该文件的修改也需要同步到电子设备B,以便避免丢失修改的文件。
综上所述,本申请实施例需要在分布式文件系统中保证文件共享(同步/分享/协同等)时的一致性、安全性、隐私性和实时性。其中,可以采用如下方式:
1)采用备份的方式
通过定期对文件进行备份和上传,完成了对文件的变更/更新/修改/变化,易于管理,但也存在实时性差、效率低下、重复上传多个未变更文件等。
2)采用文件监控的方式
相比于上述方式,采用文件监控的方式可以将变化范围限定在特定文件中,且能够实现实时感知文件的变化,及时响应。具体可以存在如下方式:
一种是,在Windows操作系统环境下,基于该Windows操作系统所提供的ReadDirectorieschanges接口来实现对文件变更的监控。
然而,基于Windows操作系统的文件监控方式,Windows操作系统所提供的接口受限于Windows平台,即只能在Windows平台使用,而不能随意迁移至Android系统。
一种是,在Linux操作系统环境下,基于该Linux操作系统所提供的Inotify内核特性来实现对文件变更的监控,即通过Inotify内核特性对监听到的文件变更的事件进行解析处理,提取关键信息。
然而,基于Linux的Inotify内核特性的文件监控方式,一方面主要用于本地修改的监控,另一方面直接使用Inotify进行文件监控,涉及到创建Inotify实例,添加监视器,创建Epoll实例,为Inotify实例的文件描述符注册Epoll事件等操作,从而通过Inotify进行文件监控的方式存在使用较为复杂,不利于用户和开发人员使用。
综上所述,本申请实施例将提供一种监控方法,通过配置(设置/确定)需要被监控的文件,构建(创建)监控队列和事件队列,读取该监控队列中发生变更(更新/修改/变化等)的文件的路径,捕获该事件队列中文件发生变更的事件,取出该事件并解析处理该事件,从而实现对文件变更的感知,即对文件进行监控,提供简单易于操作的文件监控操作和接口,使得用户和开发人员可以仅通过调用几个接口来实现对文件进行灵活监控,进而有利于在分布式文件系统中保证文件共享(同步/分享/协同等)时的一致性、安全性、隐私性和实时性。
同时,相较于基于Windows操作系统的文件监控方式,本申请实施例有利于避免Windows平台的局限性,实现了对Android系统上的文件变更感知的功能。
相较于基于Linux的Inotify内核特性的文件监控方式,本申请实施例配置(设置/确定)允许被监控的文件的操作相对简单,能够感知到的文件变更的场景更丰富。比如,只需设置顶层目录,即可自动实现对该目录的全监控。另外,对于本申请实施例的文件监控,既可以是对本端设备中的文件进行监控,也可以是对远端设备中的文件进行监控,即实现跨端(多个/不同电子设备之间)捕获(监控)文件的变更。
下面对本申请实施例所涉及的技术方案、所能达到的有益效果以及相关概念等进行具体说明。
1、电子设备
在本申请实施例中,电子设备可以是手持设备、车载设备、可穿戴设备、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、投影设备、投影仪或者连接到无线调制解调器的其他设备,也可以是各种具体形式的用户设备(user equipment,UE)、终端设备(terminal device)、终端、手机(smart phone)、智慧屏、智慧电视、智能手表、笔记本电脑、智能音响、摄像头、游戏手柄、麦克风、站点(station,STA)、接入点(access point,AP)、移动台(mobile Station,MS)、个人数 字助理(personal digital assistant,PDA)、个人计算机(personal computer,PC)或者中继设备等。
例如,电子设备可以是可穿戴设备。其中,该可穿戴设备也可以称为智能穿戴式设备,是应用穿戴式技术对日常穿戴进行智能化设计、开发的智能设备的总称,例如智能眼镜、智能手套、智能手表、各类具体征监测的智能手环、智能首饰等。该可穿戴设备即可以直接穿在身上,也可以整合到用户的服饰或配件上的一种便携式设备。该可穿戴设备不仅可以搭载专用的硬件架构,还可以搭载专用的软件架构进行数据交互、云端交互等。该穿戴式智能设备可以不依赖其他智能设备以实现完整或者部分的功能。
2、分布式文件系统、本端设备和远端设备
本申请实施例的技术方案可以应用于分布式文件系统,确保文件共享(同步)时的安全性、一致性和实时性。其中,分布式文件系统可以由多个(不同)电子设备组成。分布式文件系统可以打破电子设备间的存储边界,使得文件可以在多个(不同)电子设备之间自由、安全的共享(同步/分享/协同等),无需借用第三方应用。
另外,在分布式文件系统中,本端设备可以称为用户当前正在操作的电子设备,而远端设备可以称为除本端设备外的其他设备。用户可以通过操作来本地触发本端设备中的文件变更,也可以通过操作本端设备来远程触发远端设备中的文件变更。其中,本端设备和远端设备可以通过无线或有线实现互联互通,可以通过专门的跨端通道(如谷歌远过程调用(Google remote procedure call,grpc)、传输控制协议(transmission control protocol,TCP)等)实现文件变更的共享(同步/分享/协同等)。
示例性的,如图1所示,分布式文件系统10可以包括至少两个电子设备110。其中,至少两个电子设备110可以包括电子设备110A、电子设备110B、电子设备110C、电子设备110D、电子设备110E和电子设备110F。同时,至少两个电子设备110中的每个电子设备之间可以通过无线网络或有线数据相互通信连接。
需要说明的是,该无线网络可以包括移动蜂窝网络(如第五代5G移动通信网络)、无线局域网(wireless local area network,WLAN)、广域网(wide area network,WAN)、蓝牙(Bluetooth)、无线保真(wireless fidelity,Wi-Fi)、紫蜂(Zigbee)、近场通信(near field communication,NFC)或者超宽带(ultra wide band,UWB)等。
该有线数据可以包括HDMI数据线、USB数据线等。
该至少两个电子设备110中的每个电子设备可以为同一个用户账号下的设备。例如,当用户使用同一个用户账号登录手机、台式电脑、智慧屏、笔记本电脑、中继设备和智能手表时,该至少两个电子设备110包括该手机、台式电脑、智慧屏、笔记本电脑、中继设备和智能手表,并且该手机、台式电脑、智慧屏、笔记本电脑、中继设备和智能手表之间可以通过无线网络互相通信。
该至少两个电子设备110中的每个电子设备可以通过中继设备(如路由器)连接到同一个WLAN网络中。比如,当用户将手机、台式电脑、智慧屏、笔记本电脑和智能手表接入由中继设备提供的Wi-Fi网络时,该至少两个电子设备110包括该手机、台式电脑、智慧屏、笔记本电脑、中继设备和智能手表,并且该手机、台式电脑、智慧屏、笔记本电脑、中继设备和智能手表形成一个WLAN网络,从而WLAN网络内的各个设备之间可以通过中继设备实现相互通信。
该至少两个电子设备110中的每个电子设备可以通过无线通信方式(如蓝牙、Zigbee、NFC、UWB等)组成一个对等(Peer to Peer,P2P)网络。比如,用户通过扫描NFC标签的方式将手机、笔记本电 脑和智能手表等形成了一个P2P网络,该P2P网络内的所有设备之前可以是实现相互通信。
当用户对该至少两个电子设备110中的某个电子设备进行操作时,该电子设备可以称为本端设备,而除该电子设备外的其他电子设备可以称为远端设备。
另外,分布式文件系统10还可以包括其他数量的电子设备,在此不作具体限定。
3、电子设备的软硬件系统
本申请实施例中,电子设备的软件系统可以采用分层架构、事件驱动架构、微核架构、微服务架构或云架构。
电子设备的软硬件系统可以包括硬件层、运行在硬件层之上的操作系统层、运行在操作系统层上的应用层等。
该硬件层,可以包括CPU、内存管理单元(memory management unit,MMU)和内存(也称为存储器)等硬件。
该内存,可以用于存储软体程序和/或模块,可以包括存储程序区和存储数据区。
该存储程序区,可以用于存储操作系统或者至少一个功能所需的软体程序等。该操作系统可以是任意一种或多种通过进程(process)实现业务处理的计算机操作系统。例如,Android操作系统、RTOS(real-time operating system,实时操作系统)操作系统、UNIX操作系统、Linux操作系统、DOS操作系统、Windows操作系统、Mac操作系统等。
该存储数据区,可以用于存储操作系统或者至少一个功能所需或所产生的数据等。
下面以分层架构的操作系统为例,对电子设备的软硬件系统进行示例性说明。
示例性的,图2是本申请实施例的电子设备的软硬件系统的架构示意图。其中,存储器220中存储有操作系统层230。操作系统层包括内核层2301、系统运行库层2302、应用框架层2303和应用层2304。其中,层与层之间通过软件接口通信,并且内核层2301、系统运行库层2302和应用框架层2303属于操作系统空间。处理器210可以执行存储在存储器220上的计算机程序或指令以实现相关操作。
处理器210,可以看作一个完整的系统级芯片(system on chip,SOC),可以用于运行或加载一种操作系统,可以包括一个或多个处理单元。例如,处理器210可以包括中央处理器(central processing unit,CPU)、应用处理器(application processor,AP)、微控制单元(microcontroller Unit,MCU)、单片微型计算机(single chip microcomputer,SCM)、单片机、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、数字信号处理器(digital signal processor,DSP)、现场可编程逻辑门阵列(field programmable gate array,FPGA)、专用集成电路(application-specific integrated circuit,ASIC)、基带处理器、神经网络处理器(neural-network processing unit,NPU)等中的至少之一。不同的处理单元可以是各自分离,也可以集成在一起。另外,处理器210中还可以设置该存储器220。
处理器210还可以包括一个或多个通信接口。其中,该通信接口可以包括串行外设接口(serial peripheral interface,SPI)、集成电路(inter-integrated circuit,I2C)接口、集成电路内置音频(inter-integrated circuit sound,I2S)接口、脉冲编码调制(pulse code modulation,PCM)接口、通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口、移动产业处理器接口(mobile industry processor interface,MIPI)、通用输入输出(general-purpose input/output,GPIO)接口、用户标识模块(subscriber identity module, SIM)接口、通用串行总线(universal serial bus,USB)接口等中的至少之一。
存储器220,可以用于存储计算机程序或指令,可以用于存储数据,可以用于存储操作系统层230。其中,处理器210可以调用存储器220中存储的程序以运行操作系统。存储器220可以保存或缓存处理器210刚用过或循环使用的指令,还可以保存或缓存数据,并该数据同步或传输给其他处理器执行。
存储器220可以包括随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)或便携式只读存储器(compact disc read-only memory,CD-ROM)等中的至少之一项。
内核层2301,可以为电子设备的各种硬件提供了底层的驱动,如显示驱动、音频驱动、摄像头驱动、蓝牙驱动、Wi-Fi驱动、电源管理、NFC驱动、UWB驱动等。
系统运行库层2302,可以用于通过一些C/C++库来为操作系统提供主要的特性支持。如SQLite库提供了数据库的支持,OpenGL/ES库提供了3D绘图的支持,Webkit库提供了浏览器内核的支持等。
系统运行库层2302,还可以用于提供有安卓运行时库(Android Runtime),其主要提供了一些核心库,能够允许开发者使用脚本语言来编写应用。
应用框架层2303,可以用于提供构建应用层2304中的应用可能用到的各种应用编程接口(application programming interface,API)和编程框架,从而开发者可以通过使用这些API来创建应用。
应用框架层2303可以包括窗口管理器(window manager)、内容提供器(content providers)、视图系统(view system)、电话管理器(telephony manager)、资源管理器、通知管理器(notification manager)、消息管理器、活动管理器(activity manager)、包管理器(package manager)和位置管理(location manager)等。
应用层2304属于用户空间,应用层2304中运行有至少一个应用程序(application,也可以简称为“应用”)。其中,这些应用程序可以是操作系统自带的原生应用,也可以是第三方开发者所开发的第三方应用。例如,应用层可以包括相机、图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频和短信息等应用。
4、应用、应用的文件夹、进程、线程、目录和文件
1)应用
应用,可以称为应用程序(application)。应用程序,是指为完成某项/多项特定工作或具有某种功能的程序,而程序是运行于操作系统上的,可以运行在应用层上与用户进行交互,具有可视的用户界面。
例如,应用可以运行在图2所示的应用层2304上。
2)应用的文件夹
应用可以生成(具有)一个文件夹,可以用于存储该应用的文件(数据)。对于任一电子设备,其内部文件结构可以如图3所示。
在图3中,电子设备300的应用层上运行有应用310和应用320。其中,应用310具有自己的私有文件夹3101,用于保存应用310的文件(私有数据),如图片、视频、音乐和文档等。同时,应用310具有访问公有文件夹330中的文件(公有数据)的权限。
同理,应用320具有自己的私有文件夹3201,用于保存应用320的文件(私有数据),如图片、视频、音乐和文档等。同时,应用320也具有访问公有文件夹330中的文件(公有数据)的权限。
3)进程和线程
进程,可以是一个具有一定独立功能的程序,可以是CPU执行的单个任务的过程,可以是程序在执行过程中CPU资源分配的最小单位,具有自己的地址空间(内存空间)。
线程,可以是CPU调度的最小单位,可以是程序执行的最小单位,可以是进程内的一个独立执行单元,可以是程序执行的一个完整流程。
一个进程可以由至少一个线程组成,而线程可以是该进程中代码的不同执行路线。进程之间相互独立,但同一个进程下的各个线程之间共享该进程的内存空间(包括代码段、数据集、堆等)及一些进程级的资源。
4)目录、当前目录、父级目录和子目录
在本申请实施例中,目录可以是文件夹。因此,目录可以是应用所对应的私有文件夹,可以是应用所能访问的公有文件夹,可以是电子设备的内部文件结构中的文件,对此不作具体限制。
另外,在目录结构中,存在当前目录、父级目录和子目录。其中,当前目录的父级目录就是该当前目录的上级目录,当前目录的子目录就是该当前目录的下一级目录。
例如,对于目录结构c:\windows\system32\a\b,如果当前目录为目录a,则目录b为目录a的子目录,目录system32为目录a的父级目录,目录\windows也为目录a的父级目录。
5)文件
在本申请实施例中,文件可以是以实现某种功能或某个软件的部分功能为目的而定义的一个单位,可以是指存储在外部存储介质上的数据的集合,可以是以计算机硬盘或存储器为载体存储在计算机或电子设备上的信息集合,可以是视频、音频、文本、文档、图片、程序、音乐、数据等,可以是电子设备或操作系统在运行过程中所产生的任意数据。
另外,文件可以处于目录(文件夹)中,可以不处于目录(文件夹)中,可以存储于硬盘或存储器中,可以存储于计算机可读存储介质中。
5、文件变更
需要说明的是,文件变更,可以理解为,文件属性变化或文件属性改变等。例如,文件内容发生变化、文件权限发生变化等。
文件内容发生变化,可以包括文件内容删除、文件内容修改、文件内容更新、文件内容添加、文件内容创建等。例如,删除文档、修改文档、创建文档、播放音乐、播放视频、查看图片、删除图片等。
文件权限发生变化,可以包括文件的访问权限发生变化(如将文件由公共文件修改为私有文件、将文件由私有文件修改为公共文件、将文件修改为只有管理者或开发者才能访问等)、文件的监控权限发生变化(如将文件由不可监控状态修改为可监控状态、将文件由可监控状态修改为不可监控状态、将文件由已监控状态修改为未监控状态等)。
另外,文件变更可以是由用户操作电子设备所触发的。例如,用户点击电子设备中的应用、用户删除电子设备中的某个文件等。
下面以电子设备为手机,且用户操作该手机中的应用为例,对文件变更做一个示例性的解释说明。
例如,用户打开手机(本端设备)中的音乐软件以播发歌曲。此时,音乐软件在播发歌曲时,手机的操作系统会对音乐软件这个应用的文件夹中的文件进行相应的变更操作。
又例如,手机(本端设备)通过蓝牙连接一个蓝牙音箱(远端设备),用户通过控制手机以使得蓝牙音箱播放手机的音乐软件中的歌曲。此时,音乐软件在播发歌曲时,用户对手机的操作会通过跨端通道被蓝牙音箱的操作系统捕捉,使得蓝牙音箱的操作系统会对蓝牙音箱的音乐播发应用的文件夹中的文件进行相应的变更操作。
6、监控状态标识
在本申请实施例中,监控状态标识包括文件的监控状态标识和目录的监控状态标识。
1)文件的监控状态标识
在本申请实施例中,每个文件可以各自具有一个监控状态标识,该监控状态标识可以用于指示文件的监控状态(文件的监控权限),或者该监控状态标识可以用于指示文件是否允许被监控。
文件的监控状态可以为可监控、不可监控、已监控中的一种。也就是说,文件的监控状况标识可以用于指示可监控、不可监控、已监控中的一种。
文件的可监控,可以用于表示文件允许被监控,但还未被监控。因此,电子设备(操作系统)可以对可监控的文件进行监控处理。
文件的不可监控,可以用于表示文件不允许被监控。因此,电子设备(操作系统)不可以对不可监控的文件进行监控处理。
文件的已监控,可以用于表示文件允许被监控,且已经被监控。因此,电子设备(操作系统)可以不再对已监控的文件进行监控处理,或者可以撤销对已监控的文件的监控,使其更改为可监控或不可监控的状态。
在一些可能的设计中,文件的监控状态可以根据用户的指令进行配置(设置)或修改,也可以出厂默认配置(默认设置)的。
例如,在出厂默认的情况下,文件的监控状态默认配置为可监控,即允许被监控但还未被监控。
又例如,在根据用户的指令进行配置的情况下,用户可以按照自己的需求将文件的监控状态配置为可监控、不可监控或已监控。此时,电子设备(操作系统)可以生成用户的配置指令,并执行该配置指令以实现相应的配置操作。
又例如,在根据用户的指令进行修改的情况下,用户可以按照自己的需要将文件的监控状态由可监控修改为不可监控。此时,电子设备(操作系统)可以生成用户的修改指令,并执行该修改指令以实现相应的修改操作。
在一些可能的设计中,文件的监控状态可以默认设置为可监控,而不可监控只能根据用户来配置。也就是说,除非用户配置文件的监控状态为不可监控,否则该文件的监控状态不会为不可监控。
当用户配置文件的监控状态可监控时,文件将会被附加上一个可监控的标识。
当用户配置文件的监控状态不可监控时,文件将会被附加上一个不可监控的标识。
当用户配置文件的监控状态已可监控时,文件将会被附加上一个已可监控的标识。
2)目录的监控状态标识
与上述类型,每个目录可以各自具有一个监控状态标识,该监控状态标识可以用于指示目录的监控状态(目录的监控权限),或者该监控状态标识可以用于指示目录(目录下的所有文件)是否允许被监控。
目录的监控状态可以为可监控、不可监控、已监控中的一种。也就是说,目录的监控状况标识可以用于指示可监控、不可监控、已监控中的一种。
目录的可监控,可以用于表示该目录下的所有文件允许被监控,但还未被监控。因此,电子设备(操作系统)可以对可监控的目录进行监控处理。
目录的不可监控,可以用于表示目录下的所有文件不允许被监控。因此,电子设备(操作系统)不可以对不可监控的目录进行监控处理。
目录的已监控,可以用于表示该目录下的所有文件允许被监控,且已经被监控。因此,电子设备(操作系统)可以不再对已监控的目录进行监控处理,或者可以撤销对已监控的目录的监控,使其更改为可监控或不可监控的状态。
需要说明的是,当对目录配置为某一监控状态(如可监控)时,将会自动对该目录下的所有文件配置为相同的监控状态,而无需对该目录下的每个文件依次配置监控状态,从而自动配置以提高配置效率。
另外,目录的监控状态不会随着目录进行递归配置(设置)或修改。
例如,若当前目录的监控状态为可监控,该当前目录的子目录的监控状态为可监控,以及该当前目录的父级目录的监控状态为可监控,当将该当前目录的监控状态修改为不可监控时,子目录的监控状态和父级目录的监控状态不会发生修改,且保持不变。
在一些可能的设计中,目录的监控状态可以根据用户的指令进行配置(设置)或修改,也可以出厂默认配置(默认设置)的。
例如,在出厂默认的情况下,目录的监控状态默认配置为可监控,即允许被监控但还未被监控。
又例如,在根据用户的指令进行配置的情况下,用户可以按照自己的需求将目录的监控状态配置为可监控、不可监控或已监控。此时,电子设备(操作系统)可以生成用户的配置指令,并执行该配置指令以实现相应的配置操作。
又例如,在根据用户的指令进行修改的情况下,用户可以按照自己的需要将目录的监控状态由可监控修改为不可监控。此时,电子设备(操作系统)可以生成用户的修改指令,并执行该修改指令以实现相应的修改操作。
在一些可能的设计中,目录的监控状态可以默认设置为可监控,而不可监控只能根据用户来配置。也就是说,除非用户配置目录的监控状态为不可监控,否则该目录的监控状态不会为不可监控。
当用户配置目录的监控状态可监控时,目录将会被附加上一个可监控的标识。
当用户配置目录的监控状态不可监控时,目录将会被附加上一个不可监控的标识。
当用户配置目录的监控状态已可监控时,目录将会被附加上一个已可监控的标识。
7、监控线程
在本申请实施例中,为了实现对文件变更进行监控,本申请实施例可以专门开启一个线程作为监控线程,该监控线程可以用于监控文件变更。
在一些可能的设计中,该监控线程可以维护一个监控队列和一个事件队列。
监控队列,可以用于存放(存储/放置等)需要被监控的文件的路径。其中,监控队列是按照路径存入的先后顺序依次进行存放的。需要被监控的文件将在下文进行具体说明。
事件队列,可以用于存放(存储/放置等)文件发生变更所对应的事件。其中,事件队列是按照事 件存入的先后顺序依次进行存放的。
需要说明的是,在本申请实施例中,事件,可以被控件识别操作,可以被进程解析处理,可以称为文件变更事件,可以是由用户触发的。每个控件(进程)有自己可以识别的事件。
例如,当用户通过电子设备的显示屏点击某个应用时,电子设备的操作系统对应产生一个事件。
下面结合监控线程对本申请实施例的监控方法所执行的流程做一个示例性说明。
示例性的,如图4所示,具体流程如下:
步骤1:开启用户进程410中的一个监控线程420
通过控制内核450以开启用户进程410中的一个监控线程420。
用户进程410是一个进程,是CPU执行用户的单个任务的过程。其中,用户进程410由至少一个线程,该至少一个线程中存在一个用于监控文件变更的线程,即监控线程420。
监控线程420维护一个监控队列430和一个事件队列440。
步骤2:监控线程420向监控队列430添加监控对象
通过控制监控线程420向监控队列430添加监控对象,使得监控队列430存储该监控对象的路径,如路径4301、路径4302和路径4303等。其中,该监控对象的路径可以包括目录的路径和文件的路径。
目录的路径,是该目录下的所有文件的路径,即该目录下的所有文件共享该目录的路径。
另外,监控队列430按照路径存入的先后顺序来依次进行存放,如路径4301是最先存入监控队列430的,而路径4303是最后存入监控队列430的。
步骤3:内核450从监控队列430中获取监控对象
内核450是操作系统中的内核。
通过控制内核450从监控队列430中获取监控对象,即内核450依次读取监控队列430中的路径,使得内核450通过路径读取可以确定允许被监控的文件中哪些文件是需要被监控,即需要被监控的文件,从而对这些需要被监控的文件进行监控。
步骤4:内核450监控到文件发生变更,并将事件添加到事件队列440中
当内核450监控(感知/捕获等)到需要被监控的文件中存在文件发生变更时,通过控制内核450将文件发生变更所对应的事件(变化事件)添加到事件队列440中,使得事件队列440存储该事件(变化事件)。
另外,事件队列440按照事件存入的先后顺序来依次进行存放,如事件4401是最先存入事件队列440的,而事件4403是最后存入事件队列440的。
步骤5:用户进程410取出事件,解析事件,并生成通知消息
通过控制用户进程410从事件队列440中取出事件,对该事件进行解析,并生成(触发)通知消息。其中,该通知消息用于通知上层的应用层来执行相应的文件变更操作以完成对文件发生变更的监控(感知/捕捉等)。
8、允许被监控的文件、需要被监控的文件、文件或目录的监控设置
1)允许被监控的文件、可监控的文件
结合上述“6、监控状态标识”可知,文件或目录具有监控状态标识。因此,本申请实施例可以将监控状态为可监控的文件称为允许被监控的文件。
也就是说,允许被监控的文件,可以是由监控状态为可监控的文件(监控状态标识指示为可监控的文件)组成的。
或者说,允许被监控的文件,可以是由监控状态标识确定的。
需要说明的是,可监控的文件,可以是在目录下,可以是不在目录下,可以是只在当前目录下,可以是只在当前目录的子目录下,可以是只在当前目录的父级目录下,可以同时在当前目录和当前目录的子目录下,可以同时在当前目录和当前目录的父级目录下,可以同时在当前目录、当前目录的父级目录和当前目录的子目录下,对此不作具体限制。
2)需要被监控的文件
在本申请实施例中,允许被监控的文件可以包括需要被监控的文件和不需要被监控的文件。
3)文件或目录的监控设置
需要说明的是,本申请实施例可以提供如下接口对允许被监控的文件进行文件或目录的监控设置,即设置监控和取消监控,以便确定需要被监控的文件,有利于精细划分监控粒度。
①单个目录监控设置
单个目录监控设置,可以用于设置(配置)在允许被监控的文件中,只需要监控当前目录下的文件,而不需要递归到监控该当前目录的子目录。
可见,通过“单个目录监控设置”的方式所确定的需要被监控的文件可以只在当前目录下。
或者说,通过“单个目录监控设置”的方式可以将只在当前目录下的文件新添加到需要被监控的文件中。
②目录全面监控设置
目录全面监控设置,可以用于设置(配置)在允许被监控的文件中,不仅需要监控当前目录下的文件,还需要监控该当前目录的所有子目录下的文件。
可见,通过“目录全面监控设置”的方式所确定的需要被监控的文件可以同时在当前目录和当前目录的所有子目录下。
或者说,通过“目录全面监控设置”的方式可以将同时在当前目录和当前目录的所有子目录下的文件新添加到需要被监控的文件中。
③单个目录取消监控设置
单个目录取消监控设置,可以用于设置(配置)在允许被监控的文件中,只需要取消对当前目录下的文件进行监控,而不需要递归到监控该当前目录的子目录。
可见,通过“单个目录取消监控设置”的方式从需要被监控的文件中所删除的文件可以只在当前目录下。
或者说,通过“单个目录取消监控设置”的方式可以将只在当前目录下的文件从需要被监控的文件中删除。
④目录全面取消监控设置
目录全面取消监控设置,可以用于设置(配置)在允许被监控的文件中,不仅需要取消对当前目录下的文件进行监控,还需要递归取消当前目录的所有子目录的监控。
可见,通过“目录全面取消监控设置”的方式从需要被监控的文件中所删除的文件可以同时在当前目 录和当前目录的所有子目录下。
或者说,通过“目录全面取消监控设置”的方式可以将同时在当前目录和当前目录的所有子目录下的文件从需要被监控的文件中删除。
⑤文件监控设置
文件监控设置,可以用于设置(配置)在允许被监控的文件中需要对单个或多个文件进行监控。
可见,通过“文件监控设置”的方式所确定的需要被监控的文件可以是单个或多个。
或者说,通过“文件监控设置”的方式可以将单个或多个文件新添加到需要被监控的文件中。
⑥取消文件监控设置
取消文件监控设置,可以用于设置(配置)在允许被监控的文件中需要对单个或多个文件取消监控。
可见,通过“取消文件监控设置”的方式从确定的需要被监控的文件中所删除的文件可以是单个或多个。
或者说,通过“取消文件监控设置”的方式可以将单个或多个文件从需要被监控的文件中删除。
4)如何确定需要被监控的文件
需要说明的是,需要被监控的文件可以是从允许被监控的文件中确定的。
在一些可能的设计中,需要被监控的文件可以是根据操作指令从允许被监控的文件中确定的。
也就是说,按照用户自身的需求来生成该操作指令,并根据该操作指令从允许被监控的文件中确定需要被监控的文件。
其中,该操作指令可以用于请求执行上述的单个目录监控设置、目录全面监控设置、单个目录取消监控设置、目录全面取消监控设置、文件监控设置、取消文件监控设置中的之一项。
具体实现时,内核可以根据该操作指令将需要被监控的文件的路径添加到监控队列中,从而通过添加路径确定需要被监控的文件;或者,
内核可以根据该操作指令向监控队列所存放的需要被监控的文件的路径中新增或删除路径,从而通过新增或删除路径确定需要被监控的文件,或者通过新增或删除路径来更新需要被监控的文件。
下面以该操作指令用于请求执行目录全面监控设置为例,进行示例性说明。
示例性的,如图5所示,具体执行以下流程:
步骤1:请求需要对目录进行监控
当用户需要对目录执行目录全面监控设置时,获取操作指令,该操作指令可以用于请求需要对目录执行目录全面监控设置,即请求对该目录进行监控。
该操作指令可以包含(携带)该目录的路径。其中,该目录下的所有文件可以共享该目录的路径,即该目录下的所有文件的路径可以为该目录的路径。
步骤2:判断该目录的所有父级目录是否均允许被监控
由于用户需要对该目录执行目录全面监控设置,因此需要先递归判断(查看/确定)该目录的所有目录是否均允许被监控。其中,本申请实施例可以根据上述的监控状态标识来进行判断。
若该目录的所有父级目录中存在有不允许被监控的父级目录,即“否”,则表明该父级目录已经配置了不可监控的标签,此时执行步骤6。
若该目录的所有父级目录均允许被监控的父级目录,即“是”,则表明该所有父级目录均已经配置了 可监控的标签,此时执行步骤3。
步骤3:在监控队列中添加该目录的路径
通过将该目录的路径添加到监控队列,使得内核可以在监控队列中读取到该目录的路径,从而可以将该目录下的文件(自动将该目录下的所有文件)确定为需要被监控的文件,或者可以将该目录下的文件(自动将该目录下的所有文件)添加到需要被监控的文件中,从而实现对这些需要被监控的文件进行监控。
步骤4:判断该目录下是否存在子目录
由于用户需要对该目录执行目录全面监控设置,因此还需要再递归判断(查看/确定)该目录下是否存在子目录。
另外,由于操作系统可以自动为目录设置一个标识,该标识用于指示其为目录,因此本申请实施例根据该标识来判断该目录下是否还存在有子目录。
若该目录下不存在子目录,即“否”,则结束该流程。
若该目录下存在子目录,即“是”,则执行步骤5。
步骤5:在监控队列中添加该子目录的路径
通过重复步骤4和步骤5,直到该目录下再无未被监控的子目录,从而实现对该目录执行目录全面监控设置。
另外,通过将该目录的子目录的路径添加到监控队列,使得内核可以在监控队列中读取到该子目录的路径,从而可以将该子目录下的文件(自动将该子目录下的所有文件)确定为需要被监控的文件,或者可以将该子目录下的文件(自动将该子目录下的所有文件)添加到需要被监控的文件中,从而实现对这些需要被监控的文件进行监控。
步骤6:取消执行请求
也就是说,取消执行该操作指令的请求。
下面以该操作指令用于请求执行单个目录监控设置为例,进行示例性说明。
示例性的,如图6所示,具体执行以下流程:
步骤1:请求需要对目录进行监控
当用户需要对目录执行单个目录监控设置时,获取操作指令,该操作指令可以用于请求需要对目录执行单个目录监控设置,即请求对该目录进行监控。
该操作指令可以包含(携带)该目录的路径。其中,该目录下的所有文件可以共享该目录的路径,即该目录下的所有文件的路径可以为该目录的路径。
步骤2:判断该目录是否允许被监控
若该目录不允许被监控,即“否”,则表明该目录已经配置了不可监控的标签,此时执行步骤4。其中,本申请实施例可以根据上述的监控状态标识来进行判断。
若该目录允许被监控,即“是”,则表明该目录已经配置了可监控的标签,此时执行步骤3。
步骤3:在监控队列中添加该目录的路径
通过将该目录的路径添加到监控队列,使得内核可以在监控队列中读取到该目录的路径,从而可以将该目录下的文件(自动将该目录下的所有文件)确定为需要被监控的文件,或者可以将该目录下的文 件(自动将该目录下的所有文件)添加到需要被监控的文件中,从而实现对这些需要被监控的文件进行监控。
步骤4:取消执行请求
也就是说,取消执行该操作指令的请求。
下面以该操作指令用于请求执行目录全面取消监控设置为例,进行示例性说明。
示例性的,如图7所示,具体执行以下流程:
步骤1:请求取消对目录进行监控
当用户需要对目录执行目录全面取消监控设置时,获取操作指令,该操作指令可以用于请求需要对目录执行目录全面取消监控设置,即请求取消对该目录进行监控。
该操作指令可以包含(携带)该目录的路径。其中,该目录下的所有文件可以共享该目录的路径,即该目录下的所有文件的路径可以为该目录的路径。
步骤2:在监控队列中删除该目录的路径
通过将该目录的路径从监控队列中删除,使得内核无需再对该目录下的文件(将该目录下的所有文件)进行监控,从而实现取消监听该目录。
步骤3:判断该目录下是否存在子目录
由于用户需要对该目录执行目录全面取消监控设置,因此需要递归判断(查看/确定)该目录下是否存在子目录。
另外,由于操作系统可以自动为目录设置一个标识,该标识用于指示其为目录,因此本申请实施例根据该标识来判断该目录下是否还存在有子目录。
若该目录下不存在子目录,即“否”,则结束该流程。
若该目录下存在子目录,即“是”,则执行步骤4。
步骤4:在监控队列中删除该子目录的路径
通过重复步骤3和步骤4,直到该目录下再无监控的子目录,从而实现对该目录执行目录全面取消监控设置。
另外,通过将该子目录的路径从监控队列中删除,使得内核无需再对该子目录下的文件(将该目录下的所有文件)进行监控,从而实现取消监控该子目录。
下面以该操作指令用于请求执行单个目录取消监控设置为例,进行示例性说明。
示例性的,如图8所示,具体执行以下流程:
步骤1:请求取消对目录进行监控
当用户需要对目录执行单个目录取消监控设置时,获取操作指令,该操作指令可以用于请求需要对目录执行单个目录取消监控设置,即请求取消对该目录进行监控。
该操作指令可以包含(携带)该目录的路径。其中,该目录下的所有文件可以共享该目录的路径,即该目录下的所有文件的路径可以为该目录的路径。
步骤2:在监控队列中删除该目录的路径
通过将该目录的路径从监控队列中删除,使得内核无需再对该目录下的文件(将该目录下的所有文件)进行监控,从而实现取消监听该目录。
下面以该操作指令用于请求执行文件监控设置为例,进行示例性说明。
示例性的,如图9所示,具体执行以下流程:
步骤1:请求需要对文件进行监控
当用户需要对文件执行文件监控设置时,获取操作指令,该操作指令可以用于请求需要对文件执行文件监控设置,即请求对该文件进行监控。
该操作指令可以包含(携带)该文件的路径。
步骤2:判断该文件是否允许被监控
若该文件不允许被监控,即“否”,则表明该文件已经配置了不可监控的标签,此时执行步骤4。其中,本申请实施例可以根据上述的监控状态标识来进行判断。
若该文件允许被监控,即“是”,则表明该文件已经配置了可监控的标签,此时执行步骤3。
步骤3:在监控队列中添加该文件的路径
通过将该文件的路径添加到监控队列,使得内核可以在监控队列中读取到该文件的路径,从而可以将该文件确定为需要被监控的文件,或者可以将该文件添加到需要被监控的文件中,从而实现对这些需要被监控的文件进行监控。
步骤4:取消执行请求
也就是说,取消执行该操作指令的请求。
下面以该操作指令用于请求执行文件取消监控设置为例,进行示例性说明。
示例性的,如图10所示,具体执行以下流程:
步骤1:请求取消对文件进行监控
当用户需要对文件执行文件取消监控设置时,获取操作指令,该操作指令可以用于请求需要对文件执行文件取消监控设置,即请求取消对该文件进行监控。
该操作指令可以包含(携带)该文件的路径。
步骤2:在监控队列中删除该文件的路径
通过将该文件的路径从监控队列中删除,使得内核无需再对该文件进行监控,从而实现取消监听该文件。
9、监控(感知/捕获)本端设备或远端设备中的文件变更
结合上述,在对文件或目录设置了监控之后,用户可以通过操作来本地触发本端设备中的文件变更,也可以通过操作本端设备来远程触发远端设备中的文件变更。
因此,本申请实施例不仅可以对本端设备中的文件变更进行监控,也可以对远端设备中的文件变更进行监控。同时,变更的文件需要在本端设备和远端设备之间进行共享(同步/分享/协同等),使得在分布式文件系统中保证文件共享时的一致性、安全性、隐私性和实时性。
下面以跨端通道连接本端设备和远端设备为例,进行示例性说明。
示例性的,如图11所示,本端设备1110和远端设备1120通过跨端通道1130连接,并通过跨端通道1130来实现文件变更的共享(同步/分享/协同等)。其中,跨端通道1130可以是grpc、TCP、任一实现跨端通信的通道、任一具有远端文件监控能力的通道等。
本端设备1110的应用层上运行有应用1111和应用1112。其中,应用1111具有自己的私有文件夹 1113,用于保存应用1111的文件(私有数据),如图片、视频、音乐和文档等。同时,应用1111具有访问公有文件夹1114中的文件(公有数据)的权限。
应用1112具有自己的私有文件夹1115,用于保存应用1112的文件(私有数据),如图片、视频、音乐和文档等。同时,应用1112也具有访问公有文件夹1114中的文件(公有数据)的权限。
同理,远端设备1120的应用层上运行有应用1121和应用1122。其中,应用1121具有自己的私有文件夹1123,用于保存应用1121的文件(私有数据),如图片、视频、音乐和文档等。同时,应用1121具有访问公有文件夹1124中的文件(公有数据)的权限。
同理,应用1122具有自己的私有文件夹1125,用于保存应用1122的文件(私有数据),如图片、视频、音乐和文档等。同时,应用1122也具有访问公有文件夹1124中的文件(公有数据)的权限。
下面以监控本端设备中的文件变更为例,进行示例性说明。
示例性的,如图12所示,具体流程如下:
步骤1:用户操作
结合上述图4可知,本端设备的内核通过读取监控队列所存放的路径来确定允许被监控的文件中哪些文件是需要被监控,即需要被监控的文件,从而对这些需要被监控的文件进行监控。
当用户对本端设备进行操作时,用户操作可能会导致需要被监控的文件中存在有文件发生变化,而内核可以监控(感知/捕获等)到该文件发生变化。
步骤2:内核监控到本端设备的文件发生变化,并添加事件到监控线程的事件队列中
当内核监控到需要被监控的文件中存在文件发生变更时,通过控制内核将文件发生变更所对应的事件(变化事件)添加到事件队列中,使得事件队列存储该事件(变化事件)。
步骤3:进程取出该事件,解析该事件,并触发通知机制
通过控制进程从事件队列中取出该事件,对该事件进行解析,并生成(触发)通知消息。其中,该通知消息用于通知上层的应用层来执行相应的文件变更操作。
步骤4:应用层执行相应的文件变更操作
在接收到来自下层的通知消息之后,应用层执行相应的文件变更操作,如在本端设备的显示屏上呈现文件变更结果,从而完成对文件发生变更的监控。
步骤5:将变更的文件同步到远端设备
本端设备可以通过跨端通道将变更的文件同步到远端设备,从而使得远端设备上的文件也发生相应的变更,进而保证文件的一致性、安全性和实时性。
下面以监控远端设备中的文件变更为例,进行示例性说明。
示例性的,如图13所示,具体流程如下:
步骤1:用户操作
结合上述图4可知,远端设备的内核通过读取监控队列所存放的路径来确定允许被监控的文件中哪些文件是需要被监控,即需要被监控的文件,从而对这些需要被监控的文件进行监控。
当用户通过操作本端设备来远程对远端设备进行相关操作时,用户操作可能会导致远端设备的需要被监控的文件中存在有文件发生变化,如远程修改远端设备中的文档,而远端设备的内核可以监控(感知/捕获等)到该文件发生变化。
步骤2:远端设备的内核监控到自身的文件发生变化,并添加事件到监控线程的事件队列中
当远端设备的内核监控到需要被监控的文件中存在文件发生变更时,通过控制内核将文件发生变更所对应的事件(变化事件)添加到事件队列中,使得事件队列存储该事件(变化事件)。
步骤3:远端设备的进程取出该事件,解析该事件,并触发通知机制
通过控制远端设备的进程从事件队列中取出该事件,对该事件进行解析,并生成(触发)通知消息。其中,该通知消息用于通知远端设备的上层的应用层来执行相应的文件变更操作。
步骤4:远端设备的应用层执行相应的文件变更操作
在接收到来自下层的通知消息之后,远端设备的应用层执行相应的文件变更操作,如在远端设备的显示屏上呈现文件变更结果,从而完成对文件发生变更的监控。
步骤5:远端设备将变更的文件同步到本端设备
远端设备可以通过跨端通道将变更的文件同步到本端设备,从而使得本端设备上的文件也发生相应的变更,进而保证文件的一致性、安全性和实时性。
10、一种监控方法的示例说明
综上所述,为了实现对文件变更的感知,下面对本申请实施例的一种监控方法进行示例说明。
如图14所示,图14本申请实施例的一种监控方法的流程示意图,可以应用于本端设备、远端设备、分布时文件系统中的任一电子设备、操作系统、内核、处理器或芯片等,具体包括如下步骤:
S1410、开启进程中的监控线程,该监控线程用于监控文件变更,该监控线程维护一个监控队列和一个事件队列,该监控队列用于存放需要被监控的文件的路径,该事件队列用于存放文件发生变更所对应的事件。
S1420、当该需要被监控的文件中存在目标文件发生变更时,将该目标文件发生变更所对应的第一事件添加到该事件队列中。
S1430、控制该进程从该事件队列中取出该第一事件以完成对该目标文件发生变更的监控。
需要说明的是,“进程”、“文件”、“事件”、“监控线程”、“监控队列”、“事件队列”、“文件发生变更”和“需要被监控的文件”等可以具体详见上述描述,在此不再赘述。
目标文件,可以理解为,因用户操作所触发变更的文件,可以结合上述“文件变更”中的内容进行解释说明,对此不作赘述。
第一事件,可以理解为,操作系统为处理目标文件的变更而专门生成的事件。其中,第一事件和目标文件具有对应/关联/映射关系。
可见,本申请实施例中,通过配置需要被监控的文件,开启进程和监控线程,维护监控队列和事件队列,存储需要被监控的文件的路径,存储文件发生变更所对应的事件,从事件队列中取出事件,从而实现对文件变更进行监控,实现提供易于操作的文件变更的监控操作和接口,进而使得用户和开发人员可以只需调用少量的接口来实现对文件变更进行灵活性、多样性及准确性的监控。
在一些可能的设计中,S1430中的控制该进程从该事件队列中取出该第一事件以完成对该目标文件发生变更的监控,可以包括:控制进程从事件队列中取出第一事件以生成第一消息,第一消息用于通知应用层执行目标文件的变更以完成对目标文件发生变更的监控。
可见,通过触发通知机制,即生成第一消息,使得上层的应用层能够执行对目标文件的变更操作, 如在本端设备或远端设备的显示屏上呈现文件变更结果,从而有利于保证用户的直观查看,以及完成对目标文件发生变更的监控。
在一些可能的示例中,需要被监控的文件处于本端设备中;或者,需要被监控的文件处于远端设备中;或者,需要被监控的文件为应用所对应的私有目录下的文件;或者,需要被监控的文件为应用所能访问的公共目录下的文件。
需要说明的是,结合上述“9、监控(感知/捕获)本端设备或远端设备中的文件变更”中的内容可知,本申请实施例可以实现本端设备或远端设备的文件变更的监控。
因此,需要被监控的文件可以是处于本端设备中,也可以是处于远端设备中,对此不作具体限制。
另外,结合上述“应用、应用的文件夹、进程、线程、目录和文件”可知,本申请实施例的应用可以具有自己的私有文件夹(私有目录),具有访问公有文件夹(公共目录)中的文件(公有数据)的权限。
因此,需要被监控的文件可以为应用所对应的私有目录下的文件,也可以为应用所能访问的公共目录下的文件,对此不作具体限制。
在一些可能的设计中,需要被监控的文件是从允许被监控的文件中确定的;允许被监控的文件是由监控状态标识确定的,监控状态标识用于指示文件或目录的监控状态,监控状态为可监控、不可监控、已监控中的一种。
需要说明的是,结合上述“6、监控状态标识”和“8、允许被监控的文件、需要被监控的文件、文件或目录的监控设置”中的内容可知,本申请实施例可以通过引入监控状态标识来确定允许被监控的文件,进而在允许被监控的文件中确定出需要被监控的文件。
进一步的,需要被监控的文件是从允许被监控的文件中确定的,可以包括如下步骤:需要被监控的文件是根据操作指令从允许被监控的文件中确定的,操作指令用于请求执行单个目录监控设置、目录全面监控设置、单个目录取消监控设置、目录全面取消监控设置、文件监控设置、取消文件监控设置中的之一项。
需要说明的是,结合上述“8、允许被监控的文件、需要被监控的文件、文件或目录的监控设置”中的内容可知,本申请实施例可以通过操作指令所请求的不同来确定出不同的需要被监控的文件,从而有利于提供监控的多样性,满足用户的不同需求。
在一些可能的设计中,在S1410之后,还可以包括如下步骤:向监控队列所存放的需要被监控的文件的路径中新增或删除路径。
需要说明的是,结合上述“8、允许被监控的文件、需要被监控的文件、文件或目录的监控设置”以及图5至图10中的内容可知,本申请实施例可以通过向监控队列新增或删除路径的方式来确定或更新需要被监控的文件,从而有利于提供监控的多样性,满足用户需求。
进一步的,向监控队列所存放的需要被监控的文件的路径中新增路径,可以包括如下步骤:获取第一操作指令,第一操作指令用于请求需要对第一目录进行监控;确定第一目录的所有父级目录是否均允许被监控;若第一目录的所有父级目录中存在有不允许被监控的父级目录,则取消执行第一请求消息的请求;若第一目录的所有父级目录均允许被监控,则执行第一请求消息的请求,并将第一目录的路径添加到监控队列,以完成将第一目录下的文件添加到需要被监控的文件。
需要说明的是,结合上述图5可知,本申请实施例可以通过判断第一目录的所有父级目录是否均允 许被监控的方式来确定是否将第一目录的路径添加到监控队列中,以及确定是否将第一目录下的文件添加到需要被监控的文件中,从而实现确定或更新需要被监控的文件,进而有利于提供监控的多样性,满足用户需求。
进一步的,在将第一目录的路径添加到监控队列之后,还可以包括如下步骤:确定第一目录下是否存在子目录;若第一目录下存在第一子目录,则将第一子目录的路径添加到监控队列,以完成将第一子目录下的文件添加到需要被监控的文件中。
需要说明的是,结合上述图5可知,本申请实施例还可以通过判断第一目录下是否有子目录的方式来确定是否将第一子目录的路径也添加到监控队列中,以及确定是否将第一目录下的文件添加到需要被监控的文件中,从而实现确定或更新需要被监控的文件,进而有利于提供监控的多样性,满足用户需求。
进一步的,向监控队列所存放的需要被监控的文件的路径中删除路径,可以包括如下步骤:获取第二操作指令,第二操作指令用于请求取消对第二目录进行监控;按照第二操作指令从监控队列中删除第二目录的路径,以完成将第二目录下的文件从需要被监控的文件中删除。
需要说明的是,结合上述图7可知,本申请实施例可以按照操作指令从监控队列中删除第二目录的路径,以及从需要被监控的文件中删除第二目录下的文件,从而实现确定或更新需要被监控的文件,进而有利于保证监控的多样性和可靠性,满足用户需求。
进一步的,在按照第二操作指令从监控队列中删除第二目录的路径之后,还可以包括如下步骤:确定第二目录下是否存在子目录;若第二目录下存在第二子目录,则从监控队列中删除第二子目录的路径,以完成将第二子目录下的文件从需要被监控的文件中删除。
需要说明的是,结合上述图7可知,本申请实施例可以按照操作指令从监控队列中删除第二目录的路径,以及从需要被监控的文件中删除第二目录的第二子目录下的文件,从而实现确定或更新需要被监控的文件,进而有利于保证监控的多样性和可靠性,满足用户需求。
在一些可能的设计中,在S1430之后,还可以包括如下步骤:将变更的目标文件进行跨设备同步。
需要说明的是,结合上述“9、监控(感知/捕获)本端设备或远端设备中的文件变更”、图12和图13中的内容可知,本端设备可以将变更的文件同步到远端设备,或者远端设备可以将变更的文件同步到本端设备,从而实现跨设备同步,进而有利于保证文件的一致性、安全性和实时性。
11、一种监控装置的示例说明
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,为了实现上述功能,电子设备可以包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该知悉,结合本文中所提供的实施例描述的各示例的方法、功能、模块、单元或者步骤,本申请能够以硬件或者硬件与计算机软件的结合形式来实现。某个方法、功能、模块、单元或者步骤究竟以硬件或计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用使用不同方法来实现所描述的方法、功能、模块、单元或者步骤,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例进行功能单元/模块的划分。例如,可以对应各个功能划分各个功能单元/模块,也可以将两个或两个以上的功能集成在一个功能单元/模块中。上述集成的功能单元/模块既可以采用硬件的方式实现,也可以采用软件程序的方式实现。需要说明的是,本申请实施例中 对功能单元/模块的划分是示意性的,只是一种逻辑功能划分,而实际实现时可以有另外的划分方式。
在采用集成的单元的情况下,图15是本申请实施例的一种监控装置的功能单元组成框图。监控装置1500包括:开启单元1510、添加单元1520和控制单元1530。
在一些可能的设计中,开启单元1510、添加单元1520和控制单元1530可以是相互分离的,可以是集成在同一个单元中。
例如,开启单元1510、添加单元1520和控制单元1530可以集成在处理单元中。其中,处理单元可以是处理器或控制器,例如可以是中央处理器(central processing unit,CPU)、通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框、模块和电路。处理单元也可以是实现计算功能的组合,例如包含一个或多个微处理器组合、DSP和微处理器的组合等。
在一些可能的设计中,监控装置1500还可以包括存储单元,用于存储数据监控装置1500所执行的计算机程序或者指令。该存储单元可以是存储器。
在一些可能的设计中,监控装置1500可以是芯片/芯片模组/处理器/电子设备/操作系统。
具体实现时,开启单元1510、添加单元1520和控制单元1530用于执行如上述方法实施例中所描述的步骤。下面进行详细说明。
开启单元1510,用于开启进程中的监控线程,监控线程用于监控文件变更,监控线程维护一个监控队列和一个事件队列,监控队列用于存放需要被监控的文件的路径,事件队列用于存放文件发生变更所对应的事件;
添加单元1520,用于当需要被监控的文件中存在目标文件发生变更时,将目标文件发生变更所对应的第一事件添加到事件队列中;
控制单元1530,用于控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控。
可见,本申请实施例中,通过配置需要被监控的文件,开启进程和监控线程,维护监控队列和事件队列,存储需要被监控的文件的路径,存储文件发生变更所对应的事件,从事件队列中取出事件,从而实现对文件变更进行监控,实现提供易于操作的文件变更的监控操作和接口,进而使得用户和开发人员可以只需调用少量的接口来实现对文件变更进行灵活性、多样性及准确性的监控。
需要说明的是,监控装置1500执行的各个操作的具体实现可以参见上述的方法实施例的相应描述,在此不再赘述。
在一些可能的设计中,在控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控方面,控制单元1530用于:
控制进程从事件队列中取出第一事件以生成第一消息,第一消息用于通知应用层执行目标文件的变更以完成对目标文件发生变更的监控。
在一些可能的设计中,需要被监控的文件处于本端设备中;或者,需要被监控的文件处于远端设备中;或者,需要被监控的文件为应用所对应的私有目录下的文件;或者,需要被监控的文件为应用所能访问的公共目录下的文件。
在一些可能的设计中,需要被监控的文件是从允许被监控的文件中确定的;允许被监控的文件是由监控状态标识确定的,监控状态标识用于指示文件或目录的监控状态,监控状态为可监控、不可监控、已监控中的一种。
在一些可能的设计中,需要被监控的文件是从允许被监控的文件中确定的,包括:需要被监控的文件是根据操作指令从允许被监控的文件中确定的,操作指令用于请求执行单个目录监控设置、目录全面监控设置、单个目录取消监控设置、目录全面取消监控设置、文件监控设置、取消文件监控设置中的之一项。
在一些可能的设计中,在开启监控线程之后,监控装置1500还包括:
设置单元,用于向监控队列所存放的需要被监控的文件的路径中新增或删除路径。
在一些可能的设计中,在向监控队列所存放的需要被监控的文件的路径中新增路径方面,设置单元用于:
获取第一操作指令,第一操作指令用于请求需要对第一目录进行监控;
确定第一目录的所有父级目录是否均允许被监控;
若第一目录的所有父级目录中存在有不允许被监控的父级目录,则取消执行第一请求消息的请求;
若第一目录的所有父级目录均允许被监控,则执行第一请求消息的请求,并将第一目录的路径添加到监控队列,以完成将第一目录下的文件添加到需要被监控的文件。
在一些可能的设计中,在将第一目录的路径添加到监控队列之后,监控装置1500还包括:
确定单元,用于确定第一目录下是否存在子目录;以及若第一目录下存在第一子目录,则将第一子目录的路径添加到监控队列,以完成将第一子目录下的文件添加到需要被监控的文件中。
在一些可能的设计中,在向监控队列所存放的需要被监控的文件的路径中删除路径方面,设置单元用于:
获取第二操作指令,第二操作指令用于请求取消对第二目录进行监控;
按照第二操作指令从监控队列中删除第二目录的路径,以完成将第二目录下的文件从需要被监控的文件中删除。
在一些可能的设计中,在按照第二操作指令从监控队列中删除第二目录的路径之后,监控装置1500还包括:
确定单元,用于确定第二目录下是否存在子目录;以及若第二目录下存在第二子目录,则从监控队列中删除第二子目录的路径,以完成将第二子目录下的文件从需要被监控的文件中删除。
在一些可能的设计中,在控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控之后,监控装置1500还包括:
同步单元,用于将变更的目标文件进行跨设备同步。
12、一种电子设备的示例说明
下面介绍本申请实施例的一种电子设备的结构示意图,如图16所示。其中,电子设备1600包括处理器1610、存储器1620和用于连接处理器1610、存储器1620的通信总线。
处理器1610可以是一个或多个中央处理器CPU。在处理器1610是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。存储器1620包括但不限于是随机存储记忆体(random access  memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)或便携式只读存储器(compact disc read-only memory,CD-ROM),并且存储器1620用于存储计算机程序或指令。
电子设备1600还包括通信接口,该通信接口用于接收和发送数据。
电子设备1600中的处理器1610用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
开启进程中的监控线程,监控线程用于监控文件变更,监控线程维护一个监控队列和一个事件队列,监控队列用于存放需要被监控的文件的路径,事件队列用于存放文件发生变更所对应的事件;
当需要被监控的文件中存在目标文件发生变更时,将目标文件发生变更所对应的第一事件添加到事件队列中;
控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控。
可见,本申请实施例中,通过配置需要被监控的文件,开启进程和监控线程,维护监控队列和事件队列,存储需要被监控的文件的路径,存储文件发生变更所对应的事件,从事件队列中取出事件,从而实现对文件变更进行监控,实现提供易于操作的文件变更的监控操作和接口,进而使得用户和开发人员可以只需调用少量的接口来实现对文件变更进行灵活性、多样性及准确性的监控。
需要说明的是,电子设备1600执行的各个操作的具体实现可以参见上述所示的方法实施例的相应描述,在此不再赘述。
在一些可能的设计中,在控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控方面,处理器1610用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
控制进程从事件队列中取出第一事件以生成第一消息,第一消息用于通知应用层执行目标文件的变更以完成对目标文件发生变更的监控。
在一些可能的设计中,需要被监控的文件处于本端设备中;或者,需要被监控的文件处于远端设备中;或者,需要被监控的文件为应用所对应的私有目录下的文件;或者,需要被监控的文件为应用所能访问的公共目录下的文件。
在一些可能的设计中,需要被监控的文件是从允许被监控的文件中确定的;允许被监控的文件是由监控状态标识确定的,监控状态标识用于指示文件或目录的监控状态,监控状态为可监控、不可监控、已监控中的一种。
在一些可能的设计中,需要被监控的文件是从允许被监控的文件中确定的,包括:需要被监控的文件是根据操作指令从允许被监控的文件中确定的,操作指令用于请求执行单个目录监控设置、目录全面监控设置、单个目录取消监控设置、目录全面取消监控设置、文件监控设置、取消文件监控设置中的之一项。
在一些可能的设计中,在开启监控线程之后,处理器1610还用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
向监控队列所存放的需要被监控的文件的路径中新增或删除路径。
在一些可能的设计中,在向监控队列所存放的需要被监控的文件的路径中新增路径方面,处理器 1610用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
获取第一操作指令,第一操作指令用于请求需要对第一目录进行监控;
确定第一目录的所有父级目录是否均允许被监控;
若第一目录的所有父级目录中存在有不允许被监控的父级目录,则取消执行第一请求消息的请求;
若第一目录的所有父级目录均允许被监控,则执行第一请求消息的请求,并将第一目录的路径添加到监控队列,以完成将第一目录下的文件添加到需要被监控的文件。
在一些可能的设计中,在将第一目录的路径添加到监控队列之后,处理器1610还用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
确定第一目录下是否存在子目录;
若第一目录下存在第一子目录,则将第一子目录的路径添加到监控队列,以完成将第一子目录下的文件添加到需要被监控的文件中。
在一些可能的设计中,在向监控队列所存放的需要被监控的文件的路径中删除路径方面,处理器1610用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
获取第二操作指令,第二操作指令用于请求取消对第二目录进行监控;
按照第二操作指令从监控队列中删除第二目录的路径,以完成将第二目录下的文件从需要被监控的文件中删除。
在一些可能的设计中,在按照第二操作指令从监控队列中删除第二目录的路径之后,处理器1610还用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:
确定第二目录下是否存在子目录;
若第二目录下存在第二子目录,则从监控队列中删除第二子目录的路径,以完成将第二子目录下的文件从需要被监控的文件中删除。
在一些可能的设计中,在控制进程从事件队列中取出第一事件以完成对目标文件发生变更的监控之后,处理器1610还用于执行存储器1620中存储的计算机程序或指令1621以实现如下所设计的方法中的步骤:将变更的目标文件进行跨设备同步。
本申请实施例还提供一种计算机可读存储介质,其存储有计算机程序或指令,该计算机程序或指令被执行时以实现上述实施例中所设计的方法中的步骤。
本申请实施例还提供一种计算机程序产品,包括计算机程序或指令,其中,该计算机程序或指令被执行时以实现上述实施例中所设计的方法中的步骤。
示例性的,该计算机程序产品可以为一个软件安装包。
需要说明的是,对于上述的各个实施例,为了简单描述,将其都表述为一系列的动作组合。本领域技术人员应该知悉,本申请不受所描述的动作顺序的限制,因为本申请实施例中的某些步骤可以采用其他顺序或者同时进行。另外,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作、步骤、模块或单元等并不一定是本申请实施例所必须的。
在上述实施例中,本申请实施例对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
关于上述实施例中描的各个装置、产品包含模块/单元,其可以是软件模块/单元,也可以是硬件模 块/单元,或者也可以部分是软件模块/单元,部分是硬件模块/单元。例如,对于应用或集成芯片的各个装置、产品其包含的各个模块/单元可以都采用电路等硬件的方式实现,或者至少部分模块/单元可以采用软件程序的方式实现,该运行于芯片内部集成处理器,剩余的部分模块/单元可以采用电路等硬件方式实现;对于应于或集成芯片模组的各个装置、产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现,不同模块/单元可以位于芯片模组的同一件(例如片、电路模块等)或者不同组件中,至少部分/单元可以采用软件程序的方式实现,该软件程运行于芯片模组内部集成处理器剩余部分模块/单元可以采用电路等硬件方式实现;对于应或集成终端的各个装置、产品,其包含的模块/单元可以都采用电路等硬件的方式实现,不同的模块/单元可以位于终端内同一组件(例如,芯片、电路模块等)或者不同组件中,或者至少部分模块/单元可以采用软件程序的方式实现,该序运行于终端内部集成的处理器,剩余分模块/单元可以采用电路等硬件方式实现。
本领域技术人员应该知悉,本申请实施例所描述的方法、步骤或者相关模块/单元的功能可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式来实现,也可以是由处理器执行计算机程序指令的方式来实现。其中,该计算机程序产品包括至少一个计算机程序指令,计算机程序指令可以由相应的软件模块组成,软件模块可以被存放于RAM、闪存、ROM、EPROM、EEPROM、寄存器、硬盘、移动硬盘、只读光盘(CD-ROM)或者本领域熟知的任何其它形式的存储介质中。该计算机程序指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输。例如,该计算机程序指令可以从一个网站站点、计算机、服务器或数据中心通过有线或无线方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质、或者半导体介质(如SSD)等。
上述实施例中描述的各个装置或产品包含的各个模块/单元,其可以是软件模块/单元,可以是硬件模块/单元,也可以一部分是软件模块/单元,而另一部分是硬件模块/单元。例如,对于应用于或集成于芯片的各个装置或产品,其包含的各个模块/单元可以都采用电路等硬件的方式实现;或者,其包含的一部分模块/单元可以采用软件程序的方式实现,该软件程序运行于芯片内部集成的处理器,而另一部分(如果有)的部分模块/单元可以采用电路等硬件方式实现。对于应用于或集成于芯片模组的各个装置或产品,或者应用于或集成于终端的各个装置或产品,同理可知。
以上所述的具体实施方式,对本申请实施例的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本申请实施例的具体实施方式而已,并不用于限定本申请实施例的保护范围。凡在本申请实施例的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本申请实施例的保护范围之内。

Claims (24)

  1. 一种监控方法,其特征在于,包括:
    开启进程中的监控线程,所述监控线程用于监控文件变更,所述监控线程维护一个监控队列和一个事件队列,所述监控队列用于存放需要被监控的文件的路径,所述事件队列用于存放文件发生变更所对应的事件;
    当所述需要被监控的文件中存在目标文件发生变更时,将所述目标文件发生变更所对应的第一事件添加到所述事件队列中;
    控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控。
  2. 根据权利要求1所述的方法,其特征在于,所述控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控,包括:
    控制所述进程从所述事件队列中取出所述第一事件以生成第一消息,所述第一消息用于通知应用层执行所述目标文件的变更以完成对所述目标文件发生变更的监控。
  3. 根据权利要求1所述的方法,其特征在于,所述需要被监控的文件处于本端设备中;或者,
    所述需要被监控的文件处于远端设备中;或者,
    所述需要被监控的文件为应用所对应的私有目录下的文件;或者,
    所述需要被监控的文件为应用所能访问的公共目录下的文件。
  4. 根据权利要求1所述的方法,其特征在于,所述需要被监控的文件是从允许被监控的文件中确定的;
    所述允许被监控的文件是由监控状态标识确定的,所述监控状态标识用于指示文件或目录的监控状态,所述监控状态为可监控、不可监控、已监控中的一种。
  5. 根据权利要求4所述的方法,其特征在于,所述需要被监控的文件是从允许被监控的文件中确定的,包括:
    所述需要被监控的文件是根据操作指令从所述允许被监控的文件中确定的,所述操作指令用于请求执行单个目录监控设置、目录全面监控设置、单个目录取消监控设置、目录全面取消监控设置、文件监控设置、取消文件监控设置中的之一项。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,在所述开启监控线程之后,所述方法还包括:
    向所述监控队列所存放的所述需要被监控的文件的路径中新增或删除路径。
  7. 根据权利要求6所述的方法,其特征在于,所述向所述监控队列所存放的所述需要被监控的文件的路径中新增路径,包括:
    获取第一操作指令,所述第一操作指令用于请求需要对第一目录进行监控;
    确定所述第一目录的所有父级目录是否均允许被监控;
    若所述第一目录的所有父级目录中存在有不允许被监控的父级目录,则取消执行所述第一请求消息的请求;
    若所述第一目录的所有父级目录均允许被监控,则执行所述第一请求消息的请求,并将所述第一目录的路径添加到所述监控队列,以完成将所述第一目录下的文件添加到所述需要被监控的文件。
  8. 根据权利要求7所述的方法,其特征在于,在所述将所述第一目录的路径添加到所述监控队列之后,所述方法还包括:
    确定所述第一目录下是否存在子目录;
    若所述第一目录下存在第一子目录,则将所述第一子目录的路径添加到所述监控队列,以完成将所述第一子目录下的文件添加到所述需要被监控的文件中。
  9. 根据权利要求6所述的方法,其特征在于,所述向所述监控队列所存放的所述需要被监控的文件的路径中删除路径,包括:
    获取第二操作指令,所述第二操作指令用于请求取消对第二目录进行监控;
    按照所述第二操作指令从所述监控队列中删除所述第二目录的路径,以完成将所述第二目录下的文件从所述需要被监控的文件中删除。
  10. 根据权利要求9所述的方法,其特征在于,在所述按照所述第二操作指令从所述监控队列中删除所述第二目录的路径之后,所述方法还包括:
    确定所述第二目录下是否存在子目录;
    若所述第二目录下存在第二子目录,则从所述监控队列中删除所述第二子目录的路径,以完成将所述第二子目录下的文件从所述需要被监控的文件中删除。
  11. 根据权利要求1-10任一项所述的方法,其特征在于,在所述控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控之后,所述方法还包括:
    将变更的所述目标文件进行跨设备同步。
  12. 一种监控装置,其特征在于,包括:
    开启单元,用于开启进程中的监控线程,所述监控线程用于监控文件变更,所述监控线程维护一个监控队列和一个事件队列,所述监控队列用于存放需要被监控的文件的路径,所述事件队列用于存放文件发生变更所对应的事件;
    添加单元,用于当所述需要被监控的文件中存在目标文件发生变更时,将所述目标文件发生变更所对应的第一事件添加到所述事件队列中;
    控制单元,用于控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控。
  13. 根据权利要求12所述的装置,其特征在于,在所述控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控方面,所述控制单元用于:
    控制所述进程从所述事件队列中取出所述第一事件以生成第一消息,所述第一消息用于通知应用层执行所述目标文件的变更以完成对所述目标文件发生变更的监控。
  14. 根据权利要求12所述的装置,其特征在于,所述需要被监控的文件处于本端设备中;或者,
    所述需要被监控的文件处于远端设备中;或者,
    所述需要被监控的文件为应用所对应的私有目录下的文件;或者,
    所述需要被监控的文件为应用所能访问的公共目录下的文件。
  15. 根据权利要求12所述的装置,其特征在于,所述需要被监控的文件是从允许被监控的文件中确定的;
    所述允许被监控的文件是由监控状态标识确定的,所述监控状态标识用于指示文件或目录的监控状态,所述监控状态为可监控、不可监控、已监控中的一种。
  16. 根据权利要求15所述的装置,其特征在于,所述需要被监控的文件是从允许被监控的文件中确定的,包括:
    所述需要被监控的文件是根据操作指令从所述允许被监控的文件中确定的,所述操作指令用于请求执行单个目录监控设置、目录全面监控设置、单个目录取消监控设置、目录全面取消监控设置、文件监控设置、取消文件监控设置中的之一项。
  17. 根据权利要求12-16任一项所述的装置,其特征在于,在所述开启监控线程之后,所述监控装置还包括:
    设置单元,用于向所述监控队列所存放的所述需要被监控的文件的路径中新增或删除路径。
  18. 根据权利要求17所述的装置,其特征在于,在所述向所述监控队列所存放的所述需要被监控的文件的路径中新增路径方面,所述设置单元用于:
    获取第一操作指令,所述第一操作指令用于请求需要对第一目录进行监控;
    确定所述第一目录的所有父级目录是否均允许被监控;
    若所述第一目录的所有父级目录中存在有不允许被监控的父级目录,则取消执行所述第一请求消息的请求;
    若所述第一目录的所有父级目录均允许被监控,则执行所述第一请求消息的请求,并将所述第一目录的路径添加到所述监控队列,以完成将所述第一目录下的文件添加到所述需要被监控的文件。
  19. 根据权利要求18所述的装置,其特征在于,在所述将所述第一目录的路径添加到所述监控队列之后,所述监控装置还包括确定单元,所述确定单元用于:
    确定所述第一目录下是否存在子目录;
    若所述第一目录下存在第一子目录,则将所述第一子目录的路径添加到所述监控队列,以完成将所述第一子目录下的文件添加到所述需要被监控的文件中。
  20. 根据权利要求17所述的装置,其特征在于,在所述向所述监控队列所存放的所述需要被监控的文件的路径中删除路径方面,所述设置单元用于:
    获取第二操作指令,所述第二操作指令用于请求取消对第二目录进行监控;
    按照所述第二操作指令从所述监控队列中删除所述第二目录的路径,以完成将所述第二目录下的文件从所述需要被监控的文件中删除。
  21. 根据权利要求20所述的装置,其特征在于,在所述按照所述第二操作指令从所述监控队列中删除所述第二目录的路径之后,所述监控装置还包括确定单元,所述确定单元用于:
    确定所述第二目录下是否存在子目录;
    若所述第二目录下存在第二子目录,则从所述监控队列中删除所述第二子目录的路径,以完成将所述第二子目录下的文件从所述需要被监控的文件中删除。
  22. 根据权利要求12-21任一项所述的装置,其特征在于,在所述控制所述进程从所述事件队列中取出所述第一事件以完成对所述目标文件发生变更的监控之后,所述监控装置还包括:
    同步单元,用于将变更的所述目标文件进行跨设备同步。
  23. 一种电子设备,包括处理器、存储器及存储在所述存储器上的计算机程序或指令,其特征在于,所述处理器执行所述计算机程序或指令以实现权利要求1-11任一项所述方法的步骤。
  24. 一种计算机可读存储介质,其特征在于,其存储有计算机程序或指令,所述计算机程序或指令被执行时实现权利要求1-11任一项所述方法的步骤。
PCT/CN2022/124408 2021-12-15 2022-10-10 监控方法与装置、电子设备 WO2023109272A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111537172.9 2021-12-15
CN202111537172.9A CN114185749A (zh) 2021-12-15 2021-12-15 监控方法与装置、电子设备

Publications (1)

Publication Number Publication Date
WO2023109272A1 true WO2023109272A1 (zh) 2023-06-22

Family

ID=80544004

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/124408 WO2023109272A1 (zh) 2021-12-15 2022-10-10 监控方法与装置、电子设备

Country Status (2)

Country Link
CN (1) CN114185749A (zh)
WO (1) WO2023109272A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185749A (zh) * 2021-12-15 2022-03-15 南京欧珀软件科技有限公司 监控方法与装置、电子设备
CN115422121B (zh) * 2022-07-25 2023-06-06 安芯网盾(北京)科技有限公司 利用inotify监控文件的方法、装置、电子设备和存储介质
CN116107846B (zh) * 2023-04-12 2023-07-25 北京长亭未来科技有限公司 一种基于EBPF的Linux系统事件监控方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101281543A (zh) * 2008-05-13 2008-10-08 华为技术有限公司 文件同步方法及装置
CN103258018A (zh) * 2013-04-27 2013-08-21 北京金和软件股份有限公司 一种精确监控目录文件夹中文件变化的文件同步方法
US20140165190A1 (en) * 2012-12-10 2014-06-12 Lookout Inc. Method and apparatus for enhanced file system monitoring on mobile communications devices
CN112269762A (zh) * 2020-10-20 2021-01-26 珠海市魅族科技有限公司 一种文件监控方法、装置、电子设备及存储介质
CN114185749A (zh) * 2021-12-15 2022-03-15 南京欧珀软件科技有限公司 监控方法与装置、电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101281543A (zh) * 2008-05-13 2008-10-08 华为技术有限公司 文件同步方法及装置
US20140165190A1 (en) * 2012-12-10 2014-06-12 Lookout Inc. Method and apparatus for enhanced file system monitoring on mobile communications devices
CN103258018A (zh) * 2013-04-27 2013-08-21 北京金和软件股份有限公司 一种精确监控目录文件夹中文件变化的文件同步方法
CN112269762A (zh) * 2020-10-20 2021-01-26 珠海市魅族科技有限公司 一种文件监控方法、装置、电子设备及存储介质
CN114185749A (zh) * 2021-12-15 2022-03-15 南京欧珀软件科技有限公司 监控方法与装置、电子设备

Also Published As

Publication number Publication date
CN114185749A (zh) 2022-03-15

Similar Documents

Publication Publication Date Title
WO2023109272A1 (zh) 监控方法与装置、电子设备
US10958756B2 (en) System, method and computer program product for capturing touch events for a virtual mobile device platform
US20220075696A1 (en) Application Exception Recovery
US10459772B2 (en) System, method and computer program product for capturing touch events for a virtual mobile device platform
EP2992431B1 (en) Activity based sampling of diagnostics data
US9380456B1 (en) System, method and computer program product for dynamically switching operating systems in a virtual mobile device platform
US11853820B2 (en) Cross-process communication method, apparatus, and device
Biswas et al. Efficient mobile cloud computing through computation offloading
US9667703B1 (en) System, method and computer program product for generating remote views in a virtual mobile device platform
WO2014153479A1 (en) Decentralized operating system
JP2012520504A (ja) デバイスおよびウェブ・サービスにわたってブラウザー・キャッシュを同期させるためのプログラミング・モデル
WO2021196970A1 (zh) 一种创建应用快捷方式的方法、电子设备及系统
WO2022247693A1 (zh) 任务迁移的系统及方法
US11132126B1 (en) Backup services for distributed file systems in cloud computing environments
WO2022089294A1 (zh) 一种设备间屏幕协同方法及设备
WO2019015491A1 (zh) 应用程序的分身方法、装置、设备和介质
WO2019128571A1 (zh) 资源管理方法、装置、移动终端及计算机可读存储介质
EP3213198B1 (en) Monitoring a mobile device application
EP4095723B1 (en) Permission reuse method, permission reuse-based resource access method, and related device
CN105808354B (zh) 利用WLAN网络组建临时Hadoop环境的方法
WO2021097683A1 (zh) 安卓系统启动的方法、装置、设备及存储介质
US20230350738A1 (en) Method for Reusing Shared Library and Electronic Device
CN114741121B (zh) 用于模块加载的方法与装置、电子设备
WO2021238376A1 (zh) 功能包的加载方法、装置、服务器和电子设备
US20180152393A1 (en) Application resource usage reduction

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22906024

Country of ref document: EP

Kind code of ref document: A1