File scanning processing method based on jna and related device
Patent Information
- Application Number
- CN202510323337.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2026-09-18
AI Technical Summary
[0003]本申请的实施例提供了一种基于JNA的文件扫描处理方法及相关设备,进而至少在一定程度上可以克服传统文件扫描处理方式所带来的效率问题
[0012] According to one aspect of the embodiments of this application, a computer program product is provided, including one or more computer programs that, when executed by one or more processors, implement the steps of the JNA-based file scanning processing method as described in the above embodiments.
Smart Images

Figure CN122777488A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer and communication technology, and more specifically, to a JNA-based document scanning and processing method and related equipment. Background Technology
[0002] In traditional file scanning, a new process needs to be created and destroyed each time a scan task is started. This leads to frequent consumption of system resources and severely impacts the efficiency of the scan task. Furthermore, if the scan engine and its related resources (such as dynamic link libraries) need to be reloaded for each scan task, a significant amount of time will be wasted, further affecting scanning efficiency. This is especially true for large-scale file scans, where frequent engine loading incurs additional time overhead. Summary of the Invention
[0003] The embodiments of this application provide a JNA-based document scanning and processing method and related equipment, which can at least to some extent overcome the efficiency problems caused by traditional document scanning and processing methods.
[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0005] According to one aspect of the embodiments of this application, a JNA-based file scanning and processing method is provided, applied in a distributed system, the JNA-based file scanning and processing method comprising:
[0006] In response to the submission of a scan task, the scan engine is initialized by loading a dynamic link library using JNA, which contains multiple dynamic link files;
[0007] Retrieve target sample files one by one from the distributed database;
[0008] The target sample files are processed one by one by calling the scanning function through the corresponding dynamic link file to obtain the scanning results.
[0009] According to one aspect of the embodiments of this application, a JNA-based file scanning and processing device is provided, applied in a distributed system. The JNA-based file scanning and processing device includes: a task submission module, used to initialize a scanning engine by loading a dynamic link library using JNA in response to the submission of a scanning task, wherein the dynamic link library contains multiple dynamic link files; a file acquisition module, used to acquire target sample files one by one from a distributed database; and a scan execution module, used to process the target sample files one by one by calling scanning functions through the corresponding dynamic link files to obtain scan results.
[0010] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the JNA-based file scanning processing method as described in the above embodiments.
[0011] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the JNA-based file scanning processing method as described in the above embodiments.
[0012] According to one aspect of the embodiments of this application, a computer program product is provided, including one or more computer programs that, when executed by one or more processors, implement the steps of the JNA-based file scanning processing method as described in the above embodiments.
[0013] In some embodiments of this application, the technical solutions allow Java to directly call native C / C++ code without additional JNI configuration, solving the complexity and overhead of engine loading in traditional methods. By using dynamic link libraries, the scanning engine can be encapsulated into multiple shared library files, eliminating the need to restart the process and load the engine for each scan. After a scan task is submitted, JNA can load the dynamic link library, complete engine initialization, and then process the target files by calling the scanning functions. Target files in a distributed system can be retrieved one by one through database queries or file system indexes, ensuring that the scan task can efficiently retrieve target files from distributed storage. During the scan, it is not necessary to load all files at once; they can be retrieved one by one as needed, reducing memory usage and optimizing data retrieval efficiency. The dynamic link files contain multiple scanning functions, allowing each file to be processed by calling the corresponding scanning function. This approach avoids the overhead of repeatedly loading scanning functions for each scan. Furthermore, JNA's calling method allows the scanning engine to flexibly call different processing logic based on different file types or characteristics.
[0014] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0016] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown.
[0017] Figure 2 The diagram shows a flowchart of a JNA-based file scanning and processing method provided in an embodiment of this application.
[0018] Figure 3 It shows according to Figure 2 A flowchart illustrating a specific implementation of step S100 in the JNA-based file scanning and processing method shown in the corresponding embodiment.
[0019] Figure 4 It shows according to Figure 3 A flowchart illustrating a specific implementation of step S110 in the JNA-based file scanning and processing method shown in the corresponding embodiment.
[0020] Figure 5 It shows according to Figure 2 A flowchart illustrating a specific implementation of step S200 in the JNA-based file scanning and processing method shown in the corresponding embodiment.
[0021] Figure 6 It shows according to Figure 2 A flowchart illustrating a specific implementation of step S210 in the JNA-based file scanning and processing method shown in the corresponding embodiment.
[0022] Figure 7 It shows according to Figure 2 A flowchart illustrating a specific implementation of step S220 in the JNA-based file scanning and processing method shown in the corresponding embodiment.
[0023] Figure 8 It shows according to Figure 2 A flowchart illustrating a specific implementation of step S300 in the JNA-based file scanning and processing method shown in the corresponding embodiment.
[0024] Figure 9 A schematic diagram of a JNA-based document scanning and processing apparatus provided in an embodiment of this application is shown.
[0025] Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0026] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0027] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0028] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0029] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0030] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown.
[0031] like Figure 1 As shown, the system architecture may include terminal devices (such as...) Figure 1 The device shown includes one or more of a smartphone 101, tablet 102, and portable computer 103 (which could also be a desktop computer, etc.), a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal device and the server 105. The network 104 can include various connection types, such as wired communication links, wireless communication links, etc.
[0032] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, there can be any number of terminal devices, networks, and servers. For example, server 105 could be a server cluster composed of multiple servers.
[0033] Users can interact with server 105 via network 104 using terminal devices to receive or send messages, etc. Server 105 can be a server providing various services, on which a distributed system is deployed. For example, a user uploads a scan task to server 105 using terminal device 103 (or terminal device 101 or 102). In response to the submission of the scan task, server 105 can use JNA to load a dynamic link library to initialize the scan engine. The dynamic link library contains multiple dynamic link files; it retrieves target sample files one by one from the distributed database; and it calls the scan function through the corresponding dynamic link file to process the target sample files one by one to obtain the scan results.
[0034] It should be noted that the JNA-based file scanning processing method provided in this application embodiment is generally executed by server 105, and correspondingly, the JNA-based file scanning processing device is generally located in server 105. However, in other embodiments of this application, the terminal device may also have similar functions to the server, thereby executing the JNA-based file scanning processing scheme provided in this application embodiment.
[0035] The implementation details of the technical solutions in the embodiments of this application are described in detail below:
[0036] Figure 2 A flowchart of a JNA-based file scanning processing method according to an embodiment of this application is shown. This JNA-based file scanning processing method can be executed by a server, which may be... Figure 1 The server shown. (Refer to...) Figure 2 As shown, this JNA-based file scanning and processing method includes at least the following:
[0037] S100, in response to the submission of a scan task, uses JNA to load a dynamic link library to initialize the scan engine, the dynamic link library containing multiple dynamic link files.
[0038] S200 retrieves target sample files one by one from the distributed database.
[0039] S300: The scanning function is called through the corresponding dynamic link file to process the target sample files one by one, and the scanning results are obtained.
[0040] In the embodiments of this application, Java is allowed to directly call native C / C++ code without additional JNI configuration, solving the complexity and overhead of engine loading in traditional methods. By using dynamic link libraries, the scanning engine can be encapsulated into multiple shared library files, eliminating the need to restart the process and load the engine for each scan. After a scan task is submitted, JNA can load the dynamic link library, complete engine initialization, and then process the target files by calling the scanning functions. Target files in a distributed system can be retrieved one by one through database queries or file system indexes, ensuring that the scan task can efficiently retrieve target files from distributed storage. During the scan, it is not necessary to load all files at once; they can be retrieved one by one as needed, reducing memory usage and optimizing data retrieval efficiency. The dynamic link files contain multiple scanning functions, allowing each file to be processed by calling the corresponding scanning function. This approach avoids the overhead of repeatedly loading scanning functions for each scan. Furthermore, JNA's calling method allows the scanning engine to flexibly invoke different processing logic based on different file types or characteristics.
[0041] This application directly loads and calls dynamic link libraries via JNA, avoiding the waste of starting a new process or reloading the engine for each scan task. This significantly reduces process management overhead and improves task execution efficiency. In a distributed system, by acquiring target files one by one and processing them individually using the scanning functions in the dynamic link library, bottlenecks caused by centralized storage and large-scale scanning are avoided. Distributed acquisition and sequential file processing enable file scanning to be more efficiently distributed across multiple nodes for parallel processing. The multiple scanning functions in the dynamic link library can be flexibly selected according to different file types or scanning requirements, ensuring flexibility, while also possessing good scalability when facing larger-scale file scanning tasks.
[0042] In S100, when a user submits a scan task, the distributed system receives the scan request and then loads one or more dynamic link libraries via JNA (Java Native Access). These dynamic link libraries can include multiple DLL files and .so files, containing the specific algorithms and methods for performing the scan task. Using JNA, these native C / C++ implemented functions can be called directly from Java code without starting an additional process. JNA's method of calling native code from Java avoids the overhead of process creation, thus improving efficiency.
[0043] The loaded dynamic link libraries contain the implementations of the scanning engine, such as algorithms for file detection, virus scanning, and feature recognition. Once these libraries are loaded and initialized, the scanning engine is ready to begin processing subsequent scanning tasks.
[0044] Specifically, in some embodiments, the specific implementation of step S100 can be found in [reference needed]. Figure 3 . Figure 3 It is based on Figure 2 According to the detailed description of step S100 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S100 in the JNA-based file scanning and processing method may include the following steps:
[0045] S110, in response to the submission of a scan task, loads the dynamic link library into the cache via JNA.
[0046] S120, loads dynamic link files and initializes the scanning engine instance.
[0047] In this embodiment, JNA allows direct calling of functions in native dynamic link libraries within the Java process without creating new processes. This reduces the overhead of process switching and management, thereby improving scanning efficiency. Loading the dynamic link library into a cache and quickly initializing the scanning engine instance after a scan task is submitted enables the system to respond rapidly to scan requests, improving task response speed. Furthermore, caching the dynamic link library avoids reloading the file scanning engine each time, especially in distributed systems, preventing redundant file scanning engine instance creation and enhancing scanning processing capabilities.
[0048] In the S110, JNA is used to load dynamic link libraries. These dynamic link libraries contain the implementation code of the scanning engine, involving algorithms for file scanning, virus detection, and security threat identification.
[0049] To avoid loading the dynamic link library for each scan task, this embodiment loads it via JNA and stores it in a memory cache. When a new task is submitted, the dynamic link library does not need to be reloaded and can be retrieved directly from the cache, thereby reducing the loading time overhead.
[0050] Meanwhile, by caching dynamic link libraries, this embodiment can also significantly improve the response speed of subsequent scanning tasks, avoiding loading delays each time a scanning task is started. Especially in large-scale distributed environments, where multiple nodes may initiate scanning tasks simultaneously, the caching mechanism can reduce redundant loading and improve resource sharing efficiency.
[0051] Specifically, in some embodiments, the specific implementation of step S110 can be found in [reference needed]. Figure 4 . Figure 4 It is based on Figure 3 According to the detailed description of step S110 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S110 in the JNA-based file scanning and processing method may include the following steps:
[0052] S112, in response to the submission of a scan task, uses JNA to define an interface, maps the scan functions of the scan engine, and forms a dynamic link library.
[0053] S114, Package each dynamic link file in the dynamic link library into the distributed cache of the scanning task.
[0054] In this embodiment, by packaging the dynamic link library and distributing it to the caches of various nodes, it is ensured that multiple nodes can share the resources of the scanning engine, avoiding duplicate loading and improving the response speed and efficiency of file scanning. Simultaneously, defining interfaces and mapping scanning functions through JNA makes the scanning engine calls more efficient, reducing potential performance bottlenecks. Finally, packaging the dynamic link library into a distributed cache avoids each node loading the library file separately, reducing network and storage overhead, thereby improving the overall efficiency of large-scale file scanning.
[0055] In S112, after receiving a task, the interface with the local dynamic link library can be defined through JNA (Java Native Access) technology.
[0056] Specifically, a Java interface can be created containing methods corresponding to functions in the dynamic link library. These methods map to the core functionalities of the scanning engine, such as scanning files and retrieving scan results. Then, through the mechanisms provided by JNA, functions from the native dynamic link library (such as scanFile, initEngine, etc.) are mapped to Java methods. This allows Java code to directly call native functions implemented in C or C++ without complex inter-process communication.
[0057] Once the JNA interface is defined and mapped, the scanning engine's functionality can be triggered using standard Java calling methods. For example, when a task is submitted, the scanning engine's `scanFile` function can be directly called to begin scanning the specified file.
[0058] In S114, all relevant files of the dynamic link library (including .so, .dll, etc.) are first packaged into a single package to ensure that all necessary scanning engine library files can be shared in a distributed environment. These dynamic link files typically contain the scanning engine implementation, virus definitions, configuration files, etc. Necessary scanning engine library files refer to all resource files required for the entire scanning process.
[0059] Once the dynamic link library is packaged, it can be pushed into a distributed cache (e.g., using a distributed caching system such as Redis, Memcached, or a distributed file system such as HDFS). Each node in the cache will then be able to access these library files, avoiding the hassle of loading the library files individually on each node. This ensures that all scanning nodes can share the same library file, preventing duplicate loading and reducing storage pressure.
[0060] When a node receives a task, it can load the dynamic link library directly from its local cache, instead of loading it from a remote location or disk each time. This significantly reduces network bandwidth consumption and file I / O burden, thereby improving task response speed. Nodes can execute file scanning tasks in parallel; in a distributed environment, multiple nodes share the dynamic link library and can quickly process different file scanning tasks.
[0061] Specifically, in some embodiments, the specific implementation of step S114 can be found in the following embodiments. This embodiment is based on... Figure 4 According to the detailed description of step S114 in the JNA-based file scanning and processing method shown in the corresponding embodiment, in the JNA-based file scanning and processing method, the distributed system is a blockchain, the blockchain includes multiple task processing nodes, and step S114 may include the following steps:
[0062] Package the dynamic link files in the dynamic link library into dynamic link blocks.
[0063] The dynamically linked blocks are uploaded to each task processing node via the blockchain and loaded into the cache of each task processing node.
[0064] In this embodiment, by packaging dynamic link library files into dynamic link blocks and uploading them to each task processing node using blockchain, the reliability and consistency of resources can be guaranteed. The immutability of blockchain ensures that resources shared between task nodes will not be maliciously modified or lost. The encryption mechanism and decentralized nature of blockchain improve the security of data transmission. During data upload and download, file integrity and security are guaranteed, avoiding the data leakage or tampering risks that traditional distributed systems may face. Simultaneously, the consensus mechanism of blockchain enables effective coordination of task allocation and node load. Blockchain records the execution status of each task and the load status of each node, preventing excessive concentration of tasks on certain nodes and contributing to improved overall system efficiency and stability.
[0065] Specifically, all files in the dynamic link library are first packaged into one or more dynamic link blocks. These blocks are the basic data units in the blockchain system. Each block contains a certain number of dynamic link library files, related metadata (such as file type, version, hash value, etc.), and the file content. The metadata of each block includes information such as file type, size, version, upload time, and source node. This information will help with subsequent node queries and task scheduling. Dynamic link blocks ensure that files are transmitted as a whole during upload and download, rather than being uploaded as multiple separate files, thereby improving data transmission efficiency.
[0066] During the packaging process, a hash value can be generated for each dynamically linked block to ensure file integrity. Before being uploaded to the blockchain, the block's hash value is calculated and stored, allowing verification of whether the block has been tampered with at any time in the future.
[0067] After a dynamically linked block is formed, it can be uploaded to multiple nodes in the blockchain network. In the blockchain, the upload operation involves multiple task processing nodes, and a consensus mechanism ensures that the upload is valid and consistent. Each node verifies and accepts the newly uploaded dynamically linked block according to the blockchain protocol and records it in its local ledger. The uploaded blockchain can be transmitted through a decentralized network protocol, ensuring no single point of failure and no centralized bottlenecks.
[0068] Upon receiving dynamic link library (DLL) blocks, each task processing node loads these blocks into its local cache. The purpose of this cache is to improve access speed, ensuring that task processing nodes can quickly read and use resources from DLLs. The node's cache is managed based on records in the blockchain, ensuring that the cache stores the latest versions of DLL files. Through the blockchain's version control mechanism, each task node can ensure that it is using correct and consistent DLL resources.
[0069] The task scheduling system determines the tasks each node can handle based on records in the blockchain. The execution status of each task and node is recorded and updated on the blockchain, aiding the system in load balancing and task allocation. Once the necessary dynamically linked blocks are loaded into the task node's cache, task processing automatically begins. Nodes, according to the task scheduling system's allocation, perform file scans and upload the scan results to the blockchain, ensuring the security and immutability of the results.
[0070] In S120, after loading the dynamic link library, the scanning engine instance needs to be initialized. Initialization includes engine configuration and parameter initialization, such as setting the target path for scanning, specifying scanning rules (virus database, signature database, etc.), and initializing and configuring the number of scanning threads. During initialization, the scanning engine also needs to allocate memory and system resources for processing, such as allocating buffers for the files to be scanned or allocating computing resources for concurrent scanning tasks.
[0071] During initialization, the local scanning engine's initialization function can be called via JNA to fully load and configure the scanning engine instance. At this point, the scanning engine is ready to receive scanning tasks and can begin processing file scans.
[0072] This step loads and initializes the engine instance via JNA, enabling faster response to scanning tasks. Especially during large-scale file scanning, it significantly reduces engine initialization time, thereby improving the overall efficiency of file scanning.
[0073] In S200, within a distributed system, the target sample file may be stored across multiple nodes or storage units. To efficiently retrieve the file, the system may use a distributed database such as HBase or Cassandra to retrieve the target file one by one based on specified query conditions (such as the file's hash value, file type, etc.).
[0074] The system can improve file reading efficiency by batch retrieving or processing files based on storage structure and file location. This avoids the wasted time of requesting each file individually and allows for rapid retrieval of information from multiple files from a distributed database, thus improving data acquisition efficiency.
[0075] Specifically, in some embodiments, the specific implementation of step S200 can be found in [reference needed]. Figure 5 . Figure 5 It is based on Figure 2 According to the detailed description of step S200 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S200 in the JNA-based file scanning and processing method may include the following steps:
[0076] S210: Store each sample file in a distributed database in fragments.
[0077] S220, Download target fragments one by one from the distributed database according to the target hash to obtain the target sample file, wherein the target hash is the hash of the target sample file and the target fragment is the sample fragment corresponding to the target sample file.
[0078] In this embodiment, by storing file fragments in a distributed database and using hash values as unique identifiers for each file, accurate storage and efficient retrieval of file fragments can be ensured. The distributed storage scheme effectively distributes storage pressure and downloads target fragments via hash values, avoiding bottlenecks in traditional storage methods and providing higher storage and access efficiency. Simultaneously, hash values ensure that files are not lost or corrupted in the distributed system, allowing for complete recovery of the target file and improving file reliability. Downloading fragments one by one and assembling them into a complete file enables more efficient processing of large-scale files, making it particularly suitable for environments requiring high-performance, high-capacity storage.
[0079] In S210, the size of each shard can be set according to actual needs. Typically, considering transmission efficiency and storage space, the shard size is designed to a certain standard (e.g., 1MB or 2MB). These file shards are stored on different nodes of the distributed database. The distributed storage system can be such as HDFS (Hadoop Distributed File System) or Ceph, to ensure storage scalability and fault tolerance.
[0080] Specifically, in some embodiments, the specific implementation of step S210 can be found in [reference needed]. Figure 6 . Figure 6 It is based on Figure 5 According to the detailed description of step S210 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S210 in the JNA-based file scanning and processing method may include the following steps:
[0081] S212, perform fragmentation on the sample file to obtain sample fragments.
[0082] S214, store each of the sample fragments to a distributed database.
[0083] In this embodiment, by rationally fragmenting the sample files, not only is storage efficiency improved, but file processing and recovery can also be performed in parallel across multiple nodes, optimizing system performance. Fragmented storage allows the system to scale smoothly, meeting ever-increasing data storage demands. Simultaneously, redundant storage and hash indexing ensure data integrity and consistency. Fragmented storage also makes file recovery more efficient; even in the event of a storage node failure, files can be quickly recovered from other copies, enhancing system reliability and fault tolerance.
[0084] In S212, the sample file is segmented according to a predetermined strategy, and each segment is assigned a unique identifier. Common identification methods are based on hash values or file metadata. After segmentation, each file fragment is independent and can be processed independently during storage or transmission. For example, if a segment is corrupted or lost, the system only needs to re-download that segment instead of retransmitting the entire file.
[0085] Specifically, in some embodiments, the specific implementation of step S212 can be found in the following embodiments. This embodiment is based on... Figure 5 According to the detailed description of step S212 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S212 in the JNA-based file scanning and processing method may include the following steps:
[0086] Compress each sample file to obtain a compressed sample file.
[0087] The compressed sample file is split into fragments to obtain sample fragments.
[0088] In this embodiment, file compression effectively reduces file size. During sharded storage, each shard is also smaller, reducing the space requirements of storage nodes and improving storage resource utilization efficiency. Compared to uncompressed files, compressed files occupy less space in the distributed database, increasing storage density and saving significant storage costs. Because compressed files are smaller, network bandwidth consumption and transmission time are reduced during transmission and recovery, improving overall system transmission efficiency. Smaller compressed file shards allow for faster downloading and decompression during recovery, improving recovery efficiency. Compressed files are also more efficient to store, occupying less storage space and transmitting faster, enabling smooth scaling and maintaining high performance when handling large amounts of data storage and transmission.
[0089] In S214, when storing shards in a distributed database, each shard needs to be evenly distributed across multiple storage nodes. Each storage node can handle a different number of shards, and the specific allocation method depends on the storage system's load balancing strategy. Typically, shard storage is evenly distributed using a hash algorithm to avoid excessive storage pressure on some nodes.
[0090] To ensure data reliability and fault tolerance, distributed database systems can employ redundant storage strategies (such as replication mechanisms), where each shard stores multiple copies on different nodes. This way, even if one node fails, other copies can still provide data, ensuring that the file recovery process is unaffected.
[0091] The specific implementation of step S214 can be found in the following embodiment. This embodiment is based on... Figure 5 According to the detailed description of step S214 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S214 in the JNA-based file scanning and processing method may include the following steps:
[0092] A sample data table containing each of the aforementioned sample fragments is generated and stored in a distributed database.
[0093] A hash mapping table is formed based on the sample database.
[0094] In this embodiment, by storing each sample shard in a sample data table containing shard information, each shard can be managed and queried more systematically. The sample data table acts as an index containing shard information, making storage management clearer and more standardized. Using a distributed database to store the data table also ensures efficient storage and fast access. Simultaneously, by generating a hash mapping table, a fast mapping relationship between shards and their storage locations can be established. The hash mapping table can quickly locate the storage location of each shard, thereby reducing query time and improving data retrieval efficiency. When recovering files, the system can rely on the hash mapping table to quickly locate and extract all shards, improving recovery efficiency.
[0095] By using sample data tables and hash maps, the query performance and scalability of distributed databases are improved. Hash maps support rapid shard location, enabling the system to quickly respond to query requests and scale smoothly when processing large amounts of data.
[0096] In S220, when retrieving a target file, the target file's hash value can be used as a query condition to retrieve all file fragments corresponding to that hash value from the distributed database. Since the file is fragmented and stored on different storage nodes, the location of each fragment can be accurately located using the hash value index, allowing all fragments to be downloaded one by one. During download, a parallel approach may be used to accelerate the download process, especially when file fragments are distributed across multiple storage nodes, enabling parallel download of fragments and improving efficiency.
[0097] After the file chunks are downloaded, they can be assembled into the original target sample file according to the order of the chunks. Typically, the download order is determined by the chunk's metadata (such as chunk number). Once all chunks are downloaded and correctly assembled, the complete target file can be restored, ready for subsequent file scanning. At this point, dynamic link libraries can be used to further scan the target file. Since the file has been fully recovered, the scanning process can be targeted according to specific file types, ensuring scanning efficiency and accuracy.
[0098] Specifically, in some embodiments, the specific implementation of step S220 can be found in [reference needed]. Figure 7 . Figure 7 It is based on Figure 5 According to the detailed description of step S220 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S220 in the JNA-based file scanning and processing method may include the following steps:
[0099] S222, Read the target fragments one by one from the distributed database according to the target hash and download them to the cache.
[0100] S224, Concatenate the target fragments in the cache to obtain the target sample file.
[0101] In this embodiment, by downloading the target fragments one by one according to the target hash order and storing them in the cache, fragments can be efficiently extracted from the distributed database, and it is ensured that they are assembled in the correct order to successfully recover the target sample file. During the download process, fragments are read one by one according to the target hash order, avoiding the problem of fragment order disorder, thereby ensuring that the target sample file can be assembled in the correct order without misalignment.
[0102] Once downloaded to the cache, the process of assembling the target fragments can proceed quickly because the order of all fragments in the cache is already arranged according to the target hash value, and data processing will not be affected by delays or disorder issues.
[0103] In S222, the hash value of the target file is first obtained. The target hash value is a unique identifier that accurately maps to each fragment of the target file. Based on the target hash, the target fragments can be retrieved one by one from the distributed database in a predetermined order. Each fragment is stored on a different node, and through the query system of the distributed database, each fragment can be read and downloaded sequentially. Each downloaded target fragment is temporarily stored in a local cache.
[0104] Specifically, in some embodiments, the specific implementation of step S222 can be found in the following embodiments. This embodiment is based on... Figure 7 According to the detailed description of step S222 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S222 in the JNA-based file scanning and processing method may include the following steps:
[0105] The target hash is filtered in the distributed database according to the preset configuration rules.
[0106] The target shards are read sequentially from the distributed database according to the target hash.
[0107] Download the target fragment and store it in the cache.
[0108] In this embodiment, by filtering the target hash using preset configuration rules, the target fragment can be quickly located and downloaded. When faced with a large number of fragments, the preset configuration rules can accurately find the required fragments, avoiding unnecessary downloads and improving recovery efficiency. Filtering the target hash in the distributed database according to preset rules also makes the download process more accurate, avoiding wasting time and resources downloading irrelevant fragments, reducing data redundancy, decreasing network load, and improving recovery speed.
[0109] In S224, after all target fragments have been successfully downloaded into the cache, these fragments can be concatenated according to the order of the target hashes to recover the complete target sample file. Since the order of each fragment is guaranteed in the cache, the concatenation process is efficient and error-free.
[0110] In S300, for each target sample file, scanning functions in the already loaded dynamic link libraries are called via JNA. These scanning functions contain the specific logic for file processing, such as parsing file content, feature extraction, virus detection, and file format identification. Because these operations are performed using native functions, it is more efficient than using traditional process calls, reducing the overhead of data transfer and process switching.
[0111] After each target file is acquired, it is sequentially passed to the scanning engine for processing. Through the scanning functions of the dynamic link library, the system can process the files in parallel or sequentially, ultimately obtaining the scan results for each file. If the system supports parallel processing (e.g., using multithreading or multinodes), multiple files can be processed simultaneously in a distributed environment, improving processing efficiency. The scan results may include information such as whether the file contains security threats, whether it conforms to the prescribed format, and whether it contains inappropriate content.
[0112] After each file is processed, the scan results are returned to the main system for subsequent storage, analysis, or report generation.
[0113] Specifically, in some embodiments, the specific implementation of step S300 can be found in [reference needed]. Figure 8 . Figure 8 It is based on Figure 2 According to the detailed description of step S300 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S300 in the JNA-based file scanning and processing method may include the following steps:
[0114] S310, Select the corresponding dynamic link file according to each target sample file.
[0115] S320 calls the corresponding scan function through the corresponding dynamic link file.
[0116] S330, use the corresponding scanning function to process the corresponding target sample file and obtain the scanning result.
[0117] In this embodiment, by calling the corresponding dynamic linker and scanning function for each target sample file, optimized processing methods can be used for different file types, thereby improving scanning efficiency. Only necessary dynamic link libraries are loaded during each processing iteration, avoiding the waste of loading unnecessary resources. Simultaneously, the dynamic selection mechanism based on the target file type ensures that each target sample file is processed using the optimal dynamic linker and scanning function, guaranteeing efficient file processing results.
[0118] JNA provides a secure and standardized interface that ensures correct data transfer during function calls, avoiding issues such as memory leaks and parameter mismatches, and improving the security and stability of the scanning process.
[0119] In S310, the target sample file is first identified, and the file type (e.g., text file, image file, PDF file, etc.) is analyzed. Typically, the file type is determined by the file extension or the identifier in the file header.
[0120] Select the appropriate dynamic link library based on the type or characteristics of the target sample file. For example, certain file types may require specific scanning libraries (e.g., image files may require an image processing library, and PDF files may require a PDF parsing library). These dynamic link libraries contain scanning functions for specific file formats. After selecting the appropriate dynamic link libraries, load them dynamically via JNA to ensure that each target sample file uses the appropriate scanning method.
[0121] In some embodiments, for image files, an image scanning library (such as the OpenCV library) can be selected; for document files, a dedicated document scanning dynamic link library can be selected; and for compressed files, a dynamic link library for processing compressed files can be used.
[0122] Specifically, in some embodiments, the specific implementation of step S310 can be found in the following embodiments. This embodiment is based on... Figure 8 According to the detailed description of step S310 in the JNA-based file scanning and processing method shown in the corresponding embodiment, step S310 in the JNA-based file scanning and processing method may include the following steps:
[0123] Determine the file type of each target sample file.
[0124] Based on the file type, determine the corresponding dynamic link file.
[0125] In this embodiment, by identifying the type of each file and selecting the appropriate dynamic link file, the most suitable scanning function can be chosen for each type of file, avoiding the inefficiency of using the same method for all files. During scanning, only the dynamic link file matching the file type is loaded and called, avoiding unnecessary dynamic library loading, thereby saving computing resources and improving overall scanning efficiency. This embodiment can select different dynamic link files according to different file types, adapting to different file formats, increasing the system's flexibility and scalability, and enabling it to handle a wider variety of file types.
[0126] Specifically, file types can be determined through file extensions, file header information, and file content analysis. In this embodiment, it is necessary to determine the type of each target sample file. For example, some files may be identified as text files, while others may be identified as image files or PDF files, etc.
[0127] In some embodiments, the file type can be preliminarily determined by checking the file extension (e.g., .txt, .jpg, .pdf, etc.). In other embodiments, some file formats may not have a standard extension, or the extension may be inaccurate. The file type can be confirmed by analyzing the file header (i.e., the first few bytes of the file) and reading the file's identification information (e.g., PDF files usually start with %PDF-, and JPEG files start with FF D8 FF). In still other embodiments, if the file header information is unclear or the extension does not match the file content, its type can be determined by in-depth analysis of the file content, thus resolving the identification of non-standard or unknown file formats.
[0128] After identifying the file type, the appropriate dynamic link library can be selected for each type. For example, for image files (such as .jpg, .png, etc.), an image processing library (such as OpenCV, ImageMagick, etc.) can be selected; for text files, a text file scanning library (such as a library for malicious code detection) can be selected; for PDF files, a dedicated PDF parsing library (such as PDFBox, iText, etc.) can be selected; and for compressed files (such as .zip, .rar, etc.), a dedicated decompression library can be selected to process the files.
[0129] The aforementioned dynamic link files typically contain scanning functions for specific file types to ensure scanning accuracy and efficiency. Different dynamic link files are loaded for different file types; these files are pre-prepared and optimized to ensure efficient operation during scanning. For example, for PDF files, the libpdfscan.so dynamic link file is loaded and its scanning functions are called; for image files, the libimagescan.so dynamic link file is loaded and its image processing functions are called; for document files, libdocscan.so is loaded and the corresponding text scanning functions are called.
[0130] When dynamically loading dynamically linked files that match the target file type, Java Native Access (JNA) technology is required. JNA enables Java programs to directly call functions and libraries written natively in C / C++. Through the JNA API, Java programs can load the necessary dynamic link libraries at runtime and call functions within them to perform file scanning.
[0131] Once loading is complete, the corresponding scanning functions are invoked. These functions perform specific file scanning tasks based on the type of the target file. For example, an image scanning library might analyze the image content, while a PDF scanning library might check for potential malicious code or scripts in the PDF file.
[0132] In S320, each dynamic link library contains scanning functions for different file types. JNA provides a cross-platform interface, enabling Java code to call native code (such as scanning functions written in C or C++) to process target files one by one. It's important to note that JNA automatically handles the conversion between Java and native code data types during function calls, ensuring correct data transfer. Furthermore, to prevent scan failures due to incorrect parameters or memory issues, JNA ensures parameter matching and proper memory management.
[0133] In some embodiments, if the target file is an image file, the scanning function called by JNA may be an image analysis or feature extraction function; if it is a PDF file, JNA may call a function for text extraction or malware scanning.
[0134] In S330, after the scan function is invoked, it processes the target sample file. The specific scanning process may involve parsing file content, feature extraction, and malware identification. For example, during the scanning of an image file, the scan function may extract the image's metadata to identify whether it contains viruses or abnormal content; during the scanning of a PDF file, the function may analyze the text content or embedded macros to look for potential malicious code.
[0135] In some embodiments, the scanning function generates scan results based on the characteristics of the target sample file. These results may include information such as whether the file is safe, whether it contains malicious code, and whether further processing is required. The scan results are returned to the main program or saved to a log file for subsequent analysis and processing.
[0136] The scan results described above can be used for further automated processing, such as automatically isolating, deleting, or repairing files, or determining whether manual review is required based on the scan results.
[0137] In the embodiments of this application, Java is allowed to directly call native C / C++ code without additional JNI configuration, solving the complexity and overhead of engine loading in traditional methods. By using dynamic link libraries, the scanning engine can be encapsulated into multiple shared library files, eliminating the need to restart the process and load the engine for each scan. After a scan task is submitted, JNA can load the dynamic link library, complete engine initialization, and then process the target files by calling the scanning functions. Target files in a distributed system can be retrieved one by one through database queries or file system indexes, ensuring that the scan task can efficiently retrieve target files from distributed storage. During the scan, it is not necessary to load all files at once; they can be retrieved one by one as needed, reducing memory usage and optimizing data retrieval efficiency. The dynamic link files contain multiple scanning functions, allowing each file to be processed by calling the corresponding scanning function. This approach avoids the overhead of repeatedly loading scanning functions for each scan. Furthermore, JNA's calling method allows the scanning engine to flexibly invoke different processing logic based on different file types or characteristics.
[0138] This application directly loads and calls dynamic link libraries via JNA, avoiding the waste of starting a new process or reloading the engine for each scan task. This significantly reduces process management overhead and improves task execution efficiency. In a distributed system, by acquiring target files one by one and processing them individually using the scanning functions in the dynamic link library, bottlenecks caused by centralized storage and large-scale scanning are avoided. Distributed acquisition and sequential file processing enable file scanning to be more efficiently distributed across multiple nodes for parallel processing. The multiple scanning functions in the dynamic link library can be flexibly selected according to different file types or scanning requirements, ensuring flexibility, while also possessing good scalability when facing larger-scale file scanning tasks.
[0139] The following describes an apparatus embodiment of this application, which can be used to execute the JNA file scanning and processing method in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the JNA file scanning and processing method described above.
[0140] Figure 9 A block diagram of a JNA document scanning processing apparatus according to an embodiment of this application is shown.
[0141] Reference Figure 9 As shown, a JNA file scanning processing apparatus 900 according to an embodiment of this application is applied in a distributed system and includes: a task submission module 910, a file acquisition module 920, and a scan execution module 930.
[0142] The task submission module 910 is used to initialize the scanning engine by loading a dynamic link library using JNA in response to the submission of a scanning task. The dynamic link library contains multiple dynamic link files. The file acquisition module 920 is used to acquire target sample files one by one from the distributed database. The scan execution module 930 is used to process the target sample files one by one by calling the scan function through the corresponding dynamic link file to obtain the scan results.
[0143] In some feasible embodiments of this disclosure, the task submission module 910 specifically includes: a cache loading submodule, used to load the dynamic link library into the cache via JNA in response to the submission of the scanning task; and a file loading submodule, used to load the dynamic link file and initialize the scanning engine instance.
[0144] In some feasible embodiments disclosed herein, the cache loading submodule specifically includes: an interface definition unit, used to define an interface using JNA in response to the submission of a scan task, map the scan functions of the scan engine, and form a dynamic link library; and a file packaging unit, used to package each dynamic link file in the dynamic link library into the distributed cache of the scan task.
[0145] In some feasible embodiments disclosed herein, the distributed system is a blockchain, which includes multiple task processing nodes. The file packaging unit is specifically used to perform the following: packaging each dynamic link file in the dynamic link library into a dynamic link block; uploading the dynamic link block to each task processing node through the blockchain, and loading it into the cache of each task processing node.
[0146] In some feasible embodiments of this disclosure, the scan execution module 930 specifically includes: a file selection submodule, used to select a corresponding dynamic link file according to each of the target sample files; a function call submodule, used to call a corresponding scan function through the corresponding dynamic link file; and a file processing submodule, used to obtain scan results by using the corresponding scan function and the corresponding target sample file.
[0147] In some feasible embodiments of this disclosure, the file selection submodule specifically includes: a type determination unit, used to determine the file type of each target sample file; and a file determination unit, used to determine the corresponding dynamic link file according to the file type.
[0148] In some feasible embodiments of this disclosure, the file acquisition module 920 specifically includes: a fragmented storage submodule, used to store each sample file fragment to a distributed database; and a fragmented download submodule, used to download target fragments one by one from the distributed database according to the target hash to obtain the target sample file, wherein the target hash is the hash of the target sample file, and the target fragment is the sample fragment corresponding to the target sample file.
[0149] In some feasible embodiments of this disclosure, the fragmented storage submodule specifically includes: a sample fragmentation unit, used to fragment the sample file to obtain sample fragments; and a fragmented storage unit, used to store each of the sample fragments to a distributed database.
[0150] In some feasible embodiments of this disclosure, the sample fragmentation unit specifically includes: a file compression subunit, used to compress each sample file to obtain a sample compressed file; and a file fragmentation subunit, used to fragment the sample compressed file to obtain sample fragments.
[0151] In some feasible embodiments of this disclosure, the sharded storage unit specifically includes: a distributed storage subunit, used to form a sample data table containing each of the sample shards and store it in a distributed database; and a mapping table generation subunit, used to form a hash mapping table based on the sample database.
[0152] In some feasible embodiments disclosed herein, the segmented download submodule specifically includes: a segmented reading unit, used to read target segments sequentially from the distributed database according to the target hash and download them to the cache; and a segmented splicing unit, used to splice the target segments in the cache to obtain a complete target sample file.
[0153] In some feasible embodiments disclosed herein, the shard reading unit specifically includes: a target filtering subunit, used to filter target hashes in the distributed database according to preset configuration rules; a sequential reading subunit, used to read target shards sequentially from the distributed database according to the target hashes; and a shard caching subunit, used to download the target shards and store them in the cache.
[0154] In the embodiments of this application, Java is allowed to directly call native C / C++ code without additional JNI configuration, solving the complexity and overhead of engine loading in traditional methods. By using dynamic link libraries, the scanning engine can be encapsulated into multiple shared library files, eliminating the need to restart the process and load the engine for each scan. After a scan task is submitted, JNA can load the dynamic link library, complete engine initialization, and then process the target files by calling the scanning functions. Target files in a distributed system can be retrieved one by one through database queries or file system indexes, ensuring that the scan task can efficiently retrieve target files from distributed storage. During the scan, it is not necessary to load all files at once; they can be retrieved one by one as needed, reducing memory usage and optimizing data retrieval efficiency. The dynamic link files contain multiple scanning functions, allowing each file to be processed by calling the corresponding scanning function. This approach avoids the overhead of repeatedly loading scanning functions for each scan. Furthermore, JNA's calling method allows the scanning engine to flexibly invoke different processing logic based on different file types or characteristics.
[0155] This application directly loads and calls dynamic link libraries via JNA, avoiding the waste of starting a new process or reloading the engine for each scan task. This significantly reduces process management overhead and improves task execution efficiency. In a distributed system, by acquiring target files one by one and processing them individually using the scanning functions in the dynamic link library, bottlenecks caused by centralized storage and large-scale scanning are avoided. Distributed acquisition and sequential file processing enable file scanning to be more efficiently distributed across multiple nodes for parallel processing. The multiple scanning functions in the dynamic link library can be flexibly selected according to different file types or scanning requirements, ensuring flexibility, while also possessing good scalability when facing larger-scale file scanning tasks.
[0156] Figure 10 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0157] It should be noted that, Figure 10 The computer system of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0158] like Figure 10As shown, the computer system includes a Central Processing Unit (CPU) 1801, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 1802 or programs loaded from storage portion 1808 into Random Access Memory (RAM) 1803, such as performing the methods described in the above embodiments. The RAM 1803 also stores various programs and data required for system operation. The CPU 1801, ROM 1802, and RAM 1803 are interconnected via a bus 1804. An Input / Output (I / O) interface 1805 is also connected to the bus 1804.
[0159] The following components are connected to I / O interface 1805: an input section 1806 including a keyboard, mouse, etc.; an output section 1807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1808 including a hard disk, etc.; and a communication section 1809 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1809 performs communication processing via a network such as the Internet. A drive 1810 is also connected to I / O interface 1805 as needed. Removable media 1811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1810 as needed so that computer programs read from them can be installed into storage section 1808 as needed.
[0160] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1809, and / or installed from removable medium 1811. When the computer program is executed by central processing unit (CPU) 1801, it performs various functions defined in the system of this application.
[0161] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0162] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0163] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0164] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0165] This specification also provides a computer program product that stores at least one instruction, said at least one instruction being loaded and executed by the processor as described above. Figures 1 to 8 The method described in the illustrated embodiment can be found in the following document for a detailed execution process. Figures 1 to 8 The specific details of the illustrated embodiments will not be elaborated here.
[0166] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0167] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.
[0168] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0169] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A file scanning and processing method based on JNA, characterized in that, When applied to distributed systems, the JNA-based file scanning and processing method includes: In response to the submission of a scan task, the scan engine is initialized by loading a dynamic link library using JNA, which contains multiple dynamic link files; Retrieve target sample files one by one from the distributed database; The target sample files are processed one by one by calling the scanning function through the corresponding dynamic link file to obtain the scanning results.
2. The JNA-based document scanning and processing method as described in claim 1, characterized in that, In response to the submission of a scan task, the scanning engine is initialized using JNA to load the dynamic link file, specifically including: In response to the submission of a scan task, the dynamic link library is loaded into the cache via JNA; Load the dynamic link file and initialize the scanning engine instance.
3. The JNA-based document scanning and processing method as described in claim 2, characterized in that, In response to the submission of the scanning task, the dynamic link library is loaded into the cache via JNA, specifically including: In response to the submission of a scan task, an interface is defined using JNA to map the scan functions of the scan engine, forming a dynamic link library; Each dynamic link file in the dynamic link library is packaged into the distributed cache of the scanning task.
4. The JNA-based file scanning and processing method as described in claim 3, characterized in that, The distributed system is a blockchain, which includes multiple task processing nodes. The step of packaging each dynamic link file in the dynamic link library into the distributed cache of the scanning task specifically includes: Package the dynamic link files in the dynamic link library into dynamic link blocks; The dynamically linked blocks are uploaded to each task processing node via the blockchain and loaded into the cache of each task processing node.
5. The JNA-based document scanning and processing method as described in claim 1, characterized in that, The process of calling the scanning function through the corresponding dynamic link file to process the target sample files one by one to obtain the scanning results specifically includes: Select the corresponding dynamic link file based on each target sample file; The corresponding scanning function is called through the corresponding dynamic link file; The corresponding target sample file is processed using the corresponding scanning function to obtain the scanning results.
6. The JNA-based document scanning and processing method as described in claim 5, characterized in that, The step of selecting the corresponding dynamic link file based on each target sample file specifically includes: Determine the file type of each of the target sample files; Based on the file type, determine the corresponding dynamic link file.
7. A JNA-based document scanning and processing device, characterized in that, When applied to a distributed system, the JNA-based file scanning and processing device includes: The task submission module is used to respond to the submission of a scan task by using JNA to load a dynamic link library to initialize the scan engine. The dynamic link library contains multiple dynamic link files. The file acquisition module is used to retrieve target sample files one by one from a distributed database; The scanning execution module is used to call the scanning function through the corresponding dynamic link file to process the target sample files one by one and obtain the scanning results.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the JNA-based file scanning and processing method as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the JNA-based file scanning processing method as described in any one of claims 1 to 6.
10. A computer program product comprising one or more computer programs, characterized in that, When the one or more computer programs are executed by one or more processors, they implement the steps of the JNA-based file scanning processing method as described in any one of claims 1 to 6.