CN112256196A - File reading method and device, electronic equipment and computer readable medium - Google Patents

File reading method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN112256196A
CN112256196A CN202011122067.4A CN202011122067A CN112256196A CN 112256196 A CN112256196 A CN 112256196A CN 202011122067 A CN202011122067 A CN 202011122067A CN 112256196 A CN112256196 A CN 112256196A
Authority
CN
China
Prior art keywords
file
target file
target
information
data table
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011122067.4A
Other languages
Chinese (zh)
Other versions
CN112256196B (en
Inventor
章敏捷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202011122067.4A priority Critical patent/CN112256196B/en
Publication of CN112256196A publication Critical patent/CN112256196A/en
Application granted granted Critical
Publication of CN112256196B publication Critical patent/CN112256196B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket

Abstract

The embodiment of the disclosure discloses a file reading method, a file reading device, electronic equipment and a computer readable medium. One specific implementation of the file reading method comprises the following steps: in response to a retrieval request of a first target file, determining access path information of the first target file in the retrieval request. And determining the storage position of the first target file by utilizing a first data table according to the access path information of the first target file. The first data table comprises first attribute information of a plurality of files, and the first attribute information of the files comprises: a first mapping relationship between at least one access path information of the file and a storage location of the file. And reading the first target file in the entity file based on the storage position of the first target file. According to the embodiment, the pre-established first data table is used for simply, conveniently and effectively reading the resources in the target file, the loading speed of the resources is increased, and the memory occupation of data is reduced.

Description

File reading method and device, electronic equipment and computer readable medium
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a file reading method, a file reading device, electronic equipment and a computer readable medium.
Background
When the device file system accesses the target file through the file path, the device file system needs to load the position information of the target file according to the file path, and then accesses the target file according to the position information. The file access method increases the times of Input/Output (I/O) operation, thereby reducing the loading speed of resources and increasing the memory occupation of data.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a file reading method, apparatus, device and computer readable medium to solve the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a file reading method, including: responding to an acquisition request of a first target file, and determining access path information of the first target file in the acquisition request. And determining the storage position of the first target file by utilizing a first data table according to the access path information of the first target file. Wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file. And reading the first target file in the entity file based on the storage position of the first target file.
In a second aspect, some embodiments of the present disclosure provide a document reading apparatus comprising: the file access device comprises a first determining unit and a second determining unit, wherein the first determining unit is configured to respond to an acquisition request of a first target file and determine access path information of the first target file in the acquisition request. And the second determining unit is configured to determine the storage position of the first target file by using the first data table according to the access path information of the first target file. Wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file. A reading unit configured to read the first object file in an entity file based on a storage location of the first object file.
In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as in any one of the first aspects.
In a fourth aspect, some embodiments of the disclosure provide a computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements a method as in any one of the first aspect.
One of the above-described various embodiments of the present disclosure has the following advantageous effects: according to the file reading method of some embodiments of the disclosure, the pre-established first data table can be used for simply, conveniently and effectively reading the resources in the target file, so that the loading speed of the resources is increased, and the memory occupation of data is reduced. Specifically, the inventors found that the reason why the loading speed is not fast enough and the data memory occupancy is too high is that: when the device file system accesses the target file through the file path, the device file system needs to load the position information of the target file according to the file path, and then accesses the target file according to the position information. This file access method increases the number of input/output operations. Based on this, the file reading method of some embodiments of the present disclosure determines a mapping relationship between access path information of a file and a storage location of the file through a first data table. Therefore, in response to the file acquisition request, the storage location of the corresponding file can be determined from the first data table directly according to the access path information of the file. The number of input/output operations is reduced. Furthermore, the loading speed of resources can be increased, and the memory occupation of data is reduced.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
FIG. 1 is a schematic diagram of an application scenario diagram of a file reading method of some embodiments of the present disclosure;
FIG. 2 is a flow diagram of some embodiments of a file reading method according to the present disclosure;
FIG. 3 is a schematic illustration of information stored by a first data table of some embodiments of the present disclosure;
FIG. 4 is a schematic illustration of information stored by a second data table of some embodiments of the present disclosure;
FIG. 5 is a schematic illustration of a mapping relationship between access path information of a file, content information of the file, and a storage location of the file of some embodiments of the present disclosure;
FIG. 6 is a schematic diagram of a storage structure of a device file system of some embodiments of the present disclosure;
FIG. 7 is a schematic diagram of a device file system read file method of some embodiments of the present disclosure;
FIG. 8 is a flow chart of further embodiments of a document reading method according to the present disclosure;
FIG. 9 is a schematic diagram of some embodiments of altering the content of a target file according to the present disclosure;
FIG. 10 is a schematic diagram of some embodiments of deleting a third mapping that is not associated with access path information of a file, according to the present disclosure;
FIG. 11 is a schematic diagram of some embodiments of original document reading methods according to the present disclosure;
FIG. 12 is a schematic structural diagram of some embodiments of a document reading apparatus according to the present disclosure;
FIG. 13 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of an application scenario diagram of a file reading method according to some embodiments of the present disclosure.
As shown in fig. 1, in response to the acquisition request 102 of the first target file, the electronic device 101 may first determine the access path information 104 of the first target file corresponding to the access path 103 of the first target file in the acquisition request 102 of the first target file. Then, the storage location 109 of the first object file is specified by using the first data table 105 based on the access path information 104 of the first object file. In this application scenario, the first data table 105 includes: the first attribute information 106 corresponding to the first object file 1101, the first attribute information 107 corresponding to the second object file 1102, and the first attribute information 108 corresponding to the third object file 1103. The first attribute information 106 may be "a first mapping relationship between the access path information 1061 of the first target file and the storage location 1062 of the first target file". The first attribute information 107 may be "a first mapping relationship between the access path information 1071 of the second target file and the storage location 1072 of the second target file". The first attribute information 108 may be "a first mapping relationship between the access path information 1081 of the third destination file and the storage location 1082 of the third destination file". Finally, the first object file 1101 in the entity file 110 is read according to the storage location 109 of the first object file 1101. Alternatively, the first target file 1101 in the entity file 110 may be read by receiving file location access information written by a person skilled in the relevant art using relevant compiling software.
It should be noted that the file reading method may be executed by the electronic device 101. The electronic device 101 may be hardware or software. When the electronic device is hardware, the electronic device may be implemented as a distributed cluster formed by a plurality of servers or terminal devices, or may be implemented as a single server or a single terminal device. When the electronic device 101 is embodied as software, it may be implemented as multiple pieces of software or software modules, for example, to provide distributed services, or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of electronic devices in fig. 1 is merely illustrative. There may be any number of electronic devices, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of some embodiments of a file reading method according to the present disclosure is shown. The file reading method comprises the following steps:
step 201, in response to an acquisition request of a first target file, determining access path information of the first target file in the acquisition request.
In some embodiments, in response to an acquisition request of a first target file, an executing entity (e.g., the electronic device 101 shown in fig. 1) of the file reading method may determine access path information of the first target file in the acquisition request. The access path of the file may be a folder line for finding the file on the disk. The access path of the file may be a request externally input to the virtual file system by a user. The access path information of the file may be information obtained by converting path information of the access path of the file. As an example, the access path information of the file may be information obtained by encrypting the access path of the file. For example, the access path of the file is converted into a hash value of the access path of the corresponding file. The hash value of the access path of the file may be a result of performing a hash calculation on the access path of the file. For example, the access path for a file may be "D: \ WaChat Files \ wxid _ ryzddvhlofenacp 22". The hash value of the access path of the file can be obtained through an information Digest Algorithm (MD5, MD5Message-Digest Algorithm): "1C 55DB92340E 8996".
As an example, in response to an acquisition request of a first target file, a hash value of an access path of the first target file in the acquisition request is determined.
Step 202, determining the storage location of the first object file by using the first data table according to the access path information of the first object file.
In some embodiments, the execution agent may determine the storage location of the first object file by using a first data table according to the access path information of the first object file. Wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file. The storage location of the file may be a parameter required in the device file system to actually access the target file. Further, the storage location of the file may also be a location of the target file in the entity file (the body file). For example, the size of the target file is 10 bytes, and the target file is located at the 100 th and 110 th byte positions of the entity file, then the storage position of the file is 100 th and 110 th byte positions. The first mapping relationship may be (at least one access path information of the file, a storage location of the file). At least one access path may exist for the target file, and at least one access path information correspondingly exists. But the target file only has one storage location for the corresponding file. It is obtained that the at least one access path information of the target file corresponds to the determined storage location of the one file.
As an example, as shown in fig. 3, a first mapping relationship between at least one access path information of the target file and the storage location of the target file is as follows: a first mapping between the first access path information 302 of the target file and the storage location 301 of the target file, a first mapping between the second access path information 303 of the target file and the storage location 301 of the target file, and a first mapping between the third access path 304 of the target file and the storage location 301 of the target file.
In some optional implementations of some embodiments, the first mapping relationship is obtained based on second attribute information of the file in the second data table. Wherein the second data table includes second attribute information of the plurality of files, and the second attribute information of the file includes: a second mapping relationship between at least one access path information of the file and content information of the file, and a third mapping relationship between the content information of the file and a storage location of the file.
The content information of the file may be information obtained by encrypting the content of the file. For example, the content of the file is converted into a hash value of the content of the corresponding file. The hash value of the content of the file may be a result of hash calculation of the content of the file. For example, the content of the file Is "This Is A Sample", and the hash value of the content of the file can be obtained as "865C 52B1C0E053D 7" by the information digest algorithm. The second mapping relationship may be a binary group: (at least one access path information of the file, content information of the file). The third mapping relationship may be a binary group: (content information of the file, storage location of the file).
As an example, as shown in fig. 4, the second data table 401 includes second attribute information of the plurality of files, and the second attribute information of the file includes: a second mapping 402 between at least one access path information 404 of the file and content information 405 of the file, and a third mapping 403 between the content information 405 of the file and a storage location 406 of the file.
Optionally, the second data table is stored in a data file, and the first data table is stored in the memory. And correspondingly updating the first attribute information of the file in the first data table based on the change of the second attribute information of the file in the second data table. The data file and the entity file constitute a virtual file system, and the virtual file system is stored in the device file system. The Virtual File Systems (VFS) may be distributed File Systems or non-distributed File Systems used in a network environment, or may be interfaces that allow different File Systems to be used with an operating system. It should be noted that the virtual file system is stored on the disk in the form of an entity file and a metadata file. The entity file stores actual file data, and the data file stores information describing the file data in the virtual file system.
As an example, the storage location of the first destination file in the second attribute information of the file in the second data table is changed. Namely, the second attribute information of the first target file stored in the original second data table is: a second mapping relationship between at least one access path information of the first object file and the content information of the first object file, and a third mapping relationship between the content information of the first object file and the storage location of the original first object file. The second attribute information of the first target file stored in the changed second data table is: a second mapping relationship between at least one access path information of the first object file and the content information of the first object file, and a third mapping relationship between the content information of the first object file and the changed storage location of the first object file. Further, the second attribute information of the first destination file stored in the first data table is changed from "a third mapping relationship between at least one access path information of the first destination file and the storage location of the original first destination file" to "a third mapping relationship between at least one access path information of the first destination file and the storage location of the changed first destination file".
Optionally, the first data table is generated by the following steps:
the first step is to determine a mapping relationship between at least one access path information of the file and a storage location of the file as a first mapping relationship by using the second mapping relationship and the third mapping relationship in the second data table.
And secondly, storing the first mapping relation in a data table in a memory to obtain the first data table.
Optionally, the second attribute information of the fourth target file in the second data table is added through the following steps:
the first step is to acquire the content of the fourth object file and at least one access path of the fourth object file.
And a second step of encrypting the content of the fourth object file and at least one access path of the fourth object file to obtain content information of the fourth object file and at least one access path information of the fourth object file.
And thirdly, determining the storage position of the fourth target file in the entity file based on the content of the fourth target file. As an example, the size of the storage space occupied by the fourth target file may be determined first according to the content of the fourth target file described above. Then, in response to the fact that the storage space occupied by the fourth object file is larger than or equal to a preset threshold value, a storage area capable of storing the fourth object file is randomly selected from the entity files, and therefore the storage position of the fourth object file is determined. And in response to the fact that the storage space occupied by the fourth target file is smaller than a preset threshold value, expanding the storage space of the entity file to store the fourth target file, and determining the storage position of the fourth target file.
And fourthly, establishing a mapping relation between the content information of the fourth target file and at least one piece of access path information of the fourth target file as a second mapping relation of the fourth target file.
And fifthly, establishing a mapping relation between the content information of the fourth target file and the storage position of the fourth target file as a third mapping relation of the fourth target file.
And sixthly, adding the second mapping relation of the fourth target file and the third mapping relation of the fourth target file to the second data table.
Optionally, the determining a storage location of the fourth target file in the entity file based on the content of the fourth target file may include the following steps:
first, size information of the fourth object file is determined based on the content of the fourth object file. The size information of the fourth object file may be a byte size occupied by the fourth object file. For example, the related function may be called through the content of the fourth target file to determine the byte size occupied by the fourth target file.
And secondly, determining the storage position of each file in the entity files.
And thirdly, determining the storage position of a fourth target file in the entity file based on the size information of the fourth target file and the storage positions of the files. As an example, the storage location of the fourth object file in the entity file is determined by various methods according to the size information of the fourth object file and the storage locations of the respective files.
Optionally, the determining the storage location of the fourth target file in the entity file based on the size information of the fourth target file and the storage locations of the respective files may include:
and step one, determining a residual storage area set in the entity file according to the storage position of each file. As an example, first, the determination information of the relevant storage area determination unit may be received according to the storage location of each file to determine the remaining storage area set in the entity file.
And secondly, determining whether a residual storage area for storing the fourth target file exists in the residual storage area set or not according to the size information of the fourth target file. As an example, it may be determined whether or not a remaining storage area storing the fourth object file exists in the remaining storage area set by receiving determination information of a relevant storage area determining unit.
And thirdly, in response to determining that the residual storage areas for storing the fourth target file exist in the residual storage area set, screening out residual storage areas meeting preset conditions from the residual storage area set to serve as storage areas of the fourth target file.
And fourthly, determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
Optionally, the above steps further include: and in response to determining that no residual storage area for storing the fourth target file exists in the residual storage area set, amplifying the entity file to obtain an amplified entity file. And storing the fourth target file in an amplified region of the amplified physical file. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
In some optional implementations of some embodiments, the content information of the file is in one-to-one correspondence with a storage location of the file.
It should be noted that, in response to that the at least one access path information of the file is the hash value of the at least one access path of the file and the content information of the file is the hash value of the content of the file, compared with the original access path of the file and the content of the file, the problem that the security of the access path of the file and the content of the file stored locally in the user equipment is low is solved, and the security of reading the corresponding resource in the target file is improved.
In addition, the second attribute information of the files in the second data table can solve the problem that access paths of different files correspond to the content of the same file. That is, when the access paths of two different files correspond to the content of the same file, the content information of the files corresponding to both files is the same. Furthermore, the access paths of two files may correspond to the access location of the same file. Thus, the problem of file redundancy is solved.
As an example, as shown in fig. 5, access path information a501 of a file has a mapping relationship with content information a504 of the file. The content information a504 of the file has a unique mapping relationship with the storage location a506 of the file. The access path information B502 of the file has a mapping relationship with the content information B505 of the file. In addition, the access path information C503 of the file has a mapping relationship with the content information B505 of the file. The content information B505 of the file has a unique mapping relationship with the storage location B507 of the file. Further, the access path information B502 for the file and the access path information C503 for the file have the same file content and the same file storage location B507.
In some optional implementations of some embodiments, the file corresponding to the storage location of the file is stored in an entity file in a device file system, where the entity file is a set of files in which the files are closely arranged. The file system of the device can organize, distribute, recycle, store, retrieve, share and protect the storage space of the file memory.
Optionally, the files in the entity file include an encrypted file and a target resource. The encryption file is used for encrypting the target resource. As an example, the encrypted file may store an algorithm file for encrypting the target resource. The algorithm of encryption may include, but is not limited to, at least one of: a symmetric IDEA algorithm, an asymmetric RSA algorithm, an irreversible AES algorithm.
Optionally, the target resource includes a game resource. The game resources may include, but are not limited to, at least one of: art resources, audio resources, and program script resources of the game.
As an example, as shown in fig. 6, a file corresponding to a storage location of the file is stored in an entity file 602 in a device file system 601. The entity file 602 is a file set with files arranged closely. The entity file 602 includes: object file 603, object file 604, object file 605. The files in the entity file 602 include an encrypted file and a target resource. The target resource includes a game resource. The target file 603 includes an encrypted file a and a game resource a. The object file 604 includes an encrypted file B and a game resource B. The target file 605 includes an encrypted file C and a game resource C.
Step 203, reading the first object file in the entity file based on the storage location of the first object file.
In some embodiments, the executing entity may read the first object file in an entity file according to a storage location of the first object file. As an example, the above-mentioned first target file in the entity file may be read by receiving file location access information written by a related technician using related compiling software.
In some optional implementations of some embodiments, the reading the first target file in the entity file based on the storage location information of the first target file may include:
first, file position attribute information corresponding to the storage position of the first target file is determined. The file position attribute information includes a data offset of the first target file in the entity file and a data length of the target file.
And secondly, reading the first target file according to the file position attribute information.
Optionally, the determining the file location attribute information corresponding to the storage location of the first target file may include the following steps:
the first step is to determine the data offset based on the location information of the first target file in the physical file. As an example, the data offset of the first target file may be determined for the storage space structure of the entity file described above.
And secondly, determining the number of bytes occupied by the first target file as the data length.
It should be noted that when reading the target file, the content of the corresponding target file can be directly read only by obtaining the file location attribute information of the target file, and the location information of the target file does not need to be obtained from the device file system first and then read, so that the loading speed of the resource can be increased.
As an example, as shown in fig. 7, the first target file 702 in the entity file 701 may be read by using file location attribute information 705 corresponding to a storage location of the first target file 702. The file location attribute information 705 includes a data offset 7051 and a data length 7052. The second object file 703 in the entity file 701 may be read by using file location attribute information 706 corresponding to the storage location of the second object file 703. The file location attribute information 706 includes a data offset 7061 and a data length 7062. The third target file 704 in the entity file 701 may be read with file location attribute information 707 corresponding to a storage location of the third target file 704. The file location attribute information 707 includes a data offset 7071 and a data length 7072.
It can be seen from the foregoing embodiments that, by using the file reading method according to some embodiments of the present disclosure, the resource in the target file can be simply and effectively read by using the established first data table, so that the resource loading speed is increased, and the memory usage of the data is reduced. Specifically, the inventors found that the reason why the loading speed is not fast enough and the data memory occupancy is too high is that: when the device file system accesses the target file through the file path, the device file system needs to load the position information of the target file according to the file path, and then accesses the target file according to the position information. This file access method increases the number of input/output operations. Based on this, the file reading method of some embodiments of the present disclosure determines a mapping relationship between access path information of a file and a storage location of the file through a first data table. Therefore, in response to the file acquisition request, the storage location of the corresponding file can be determined from the first data table directly according to the access path information of the file. The number of input/output operations is reduced. Furthermore, the loading speed of resources can be increased, and the memory occupation of data is reduced.
With continued reference to FIG. 8, a flow 800 of further embodiments of a document reading method according to the present disclosure is shown. The file reading method comprises the following steps:
step 801, in response to an acquisition request of a first target file, determining access path information of the first target file in the acquisition request.
Step 802, determining a storage location of the first object file by using a first data table according to the access path information of the first object file.
Step 803, reading the first object file in the entity file based on the storage location of the first object file.
In some embodiments, the specific implementation and technical effects of steps 801 and 803 may refer to steps 201 and 203 in the embodiments corresponding to fig. 2, which are not described herein again.
Here, the first mapping relationship is obtained based on the second attribute information of the file in the second data table. Wherein the second data table includes second attribute information of the plurality of files, and the second attribute information of the file includes: a second mapping relationship between at least one access path information of the file and content information of the file, and a third mapping relationship between the content information of the file and a storage location of the file.
Step 804, deleting the second mapping relationship corresponding to the second target file in the second data table according to the update request of the content of the second target file.
In some embodiments, the execution principal may delete the second mapping relationship corresponding to the second target file in the second data table according to the update request of the content of the second target file.
Step 805 is to store a second mapping relationship between the access path information of the second object file and the content information of a third object file and a third mapping relationship between the content information of the third object file and the storage location of the third object file in the second data table.
In some embodiments, the execution agent may store a second mapping relationship between the access path information of the second object file and the content information of a third object file and a third mapping relationship between the content information of the third object file and a storage location of the third object file in the second data table.
As an example, as shown in fig. 9, before the content of the second object file is not modified, the second data table stores a second mapping relationship between access path information a901 of the second object file and content information a902 of the second object file, a third mapping relationship between the content information a902 of the second object file and the storage location a903 of the second object file, and a second mapping relationship between access path information B904 of the second object file and the content information a902 of the second object file. In response to the update request of the content 902 of the second target file, first, the second mapping relationship between the access path information B904 of the second target file and the content information a902 of the second target file is deleted in the second data table. A second mapping relationship between the access path information 904 of the second object file and the content information 905 of a third object file and a third mapping relationship between the content information 905 of the third object file and the storage location 906 of the third object file are stored in the second data table.
Step 806, in response to detecting that the second attribute information of the file in the second data table is changed, determining that there is no third mapping relationship associated with the access path information of the file.
In some embodiments, in response to detecting that the second attribute information of the file in the second data table is changed, the execution subject may determine that there is no third mapping relationship associated with the access path information of the file.
In step 807, the third mapping relation not associated with the access path information of the file is deleted in the second data table.
In some embodiments, the execution subject may delete the third mapping relation not associated with the access path information of the file in the second data table.
As an example, as shown in fig. 10, in response to detecting that the second attribute information of the file in the second data table 1001 is changed, the second attribute information of the plurality of files in the second data table 1001 includes: a second mapping relationship between access path information a1002 of the file and content information a1003 of the file, a third mapping relationship between content information a1003 of the file and storage location a1004 of the file, a third mapping relationship between content information B1005 of the file and storage location B1006 of the file, a second mapping relationship between access path information C1007 of the file and content information C1008 of the file, and a third mapping relationship between content information C1008 of the file and storage location C1009 of the file. First, it is determined that the third mapping relation not associated with the access path information of the file is the third mapping relation between the content information B1005 of the file and the storage location B1006 of the file. Then, the third mapping relationship between the content information B1005 of the file and the storage location B1006 of the file is deleted in the second data table 1001.
Step 808, deleting the file associated with the third mapping relation which is not associated with the access path information of the file in the entity file.
In some embodiments, the execution subject may delete the file associated with the third mapping relation not associated with the access path information of the file in the entity file.
As can be seen from fig. 8, compared with the description of some embodiments corresponding to fig. 2, the process 800 of the file reading method in some embodiments corresponding to fig. 2 highlights the specific steps of modifying the content of the target file and deleting the third mapping relation not associated with the access path information of the file. Therefore, the solutions described in the embodiments delete the third mapping relation not associated with the access path information of the file, which can solve the problem of file redundancy and the related process of changing the content of the target file can simply and effectively implement the change of the content of the target file.
As shown in fig. 11, fig. 11 shows a schematic diagram of some embodiments of an original file reading method according to the present disclosure.
In response to reading the access path 1102 for the file, the device file system 1101 may read the access path 1102 for the file. In turn, encrypted file 1105 and target resource 1106 may be obtained. The encrypted file 1105 is used to encrypt the target resource 1106. In response to using the target resource 1106, decrypting the encrypted file 1105 may result in the target resource 1106. In response to updating the access path 1103 of the file, the device file system 1101 may access the access path 1104 of the updated file to obtain an encrypted file 1107 and a target resource 1108. Wherein, the encryption file 1107 encrypts the target resource 1108. In response to receiving an instruction to replace target resource 1108, encrypted file 1107 in the device file system may be replaced with encrypted file 1109 and target resource 1108 in the device file system may be replaced with target resource 1110. The encrypted file 1109 may encrypt the target resource 1110.
With continued reference to fig. 12, as an implementation of the above-described method for the above-described figures, the present disclosure provides some embodiments of a document reading apparatus, which correspond to those of the method embodiments described above for fig. 2, and which may be applied in particular to various electronic devices.
As shown in fig. 12, a document reading apparatus 1200 of some embodiments includes: a first determination unit 1201, a second determination unit 1202, and a reading unit 1203. The first determining unit 1201 is configured to determine, in response to an acquisition request of a first target file, access path information of the first target file in the acquisition request. The second determining unit 1202 is configured to determine a storage location of the first object file by using the first data table according to the access path information of the first object file. Wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file. The reading unit 1203 is configured to read the first object file in the entity file based on the storage location of the first object file.
In some optional implementations of some embodiments, the first mapping relationship is obtained based on second attribute information of the file in the second data table. Wherein the second data table includes second attribute information of the plurality of files, and the second attribute information of the file includes: a second mapping relationship between at least one access path information of the file and content information of the file, and a third mapping relationship between the content information of the file and a storage location of the file.
In some optional implementations of some embodiments, the apparatus 1200 may further include an updating unit (not shown in the figures). The updating unit may be configured to correspondingly update the first attribute information of the file in the first data table based on a change of the second attribute information of the file in the second data table.
In some optional implementations of some embodiments, the apparatus 1200 may further include a first deletion unit and a storage unit (not shown in the figures). The first deleting unit may be configured to delete the second mapping relationship corresponding to the second target file in the second data table according to an update request of the content of the second target file. The storage unit may be configured to store a second mapping relationship between access path information of the second object file and content information of a third object file and a third mapping relationship between content information of the third object file and a storage location of the third object file in the second data table. Wherein the second object file and the third object file are different files.
In some optional implementations of some embodiments, the apparatus 1200 may further include a second deletion unit and a third deletion unit (not shown in the figures). Wherein the second deletion unit may be configured to delete the third mapping relationship not associated with the access path information of the file in the second data table. The third deletion unit may be configured to delete the file associated with the third mapping relation not associated with the access path information of the file in the entity file.
In some optional implementations of some embodiments, the first data table is generated by: and determining a mapping relation between at least one access path information of the file and a storage position of the file as a first mapping relation by using the second mapping relation and the third mapping relation in the second data table. And storing the first mapping relation in a data table in a memory to obtain the first data table.
In some optional implementations of some embodiments, the second attribute information of the fourth target file in the second data table is added by: and acquiring the content of the fourth target file and at least one access path of the fourth target file. And encrypting the content of the fourth target file and at least one access path of the fourth target file to obtain the content information of the fourth target file and at least one access path information of the fourth target file. And determining the storage position of the fourth target file in the entity file based on the content of the fourth target file. And establishing a mapping relation between the content information of the fourth target file and at least one piece of access path information of the fourth target file as a second mapping relation of the fourth target file. And establishing a mapping relation between the content information of the fourth target file and the storage position of the fourth target file as a third mapping relation of the fourth target file. And adding the second mapping relation of the fourth target file and the third mapping relation of the fourth target file to the second data table.
In some optional implementations of some embodiments, the determining, based on the content of the fourth target file, a storage location of the fourth target file in the entity file includes: and determining size information of the fourth object file based on the content of the fourth object file. And determining the storage position of each file in the entity files. And determining the storage position of the fourth target file in the entity file based on the size information of the fourth target file and the storage positions of the files.
In some optional implementations of some embodiments, the determining, based on the size information of the fourth target file and the storage locations of the respective files, a storage location of the fourth target file in the entity file includes: and determining the residual storage area set in the entity file according to the storage position of each file. And determining whether a residual storage area for storing the fourth object file exists in the residual storage area set according to the size information of the fourth object file. And screening out the residual storage areas meeting the preset conditions from the residual storage area set as the storage areas of the fourth target file in response to determining that the residual storage areas for storing the fourth target file exist in the residual storage area set. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
In some optional implementation manners of some embodiments, in response to determining that no remaining storage region storing the fourth target file exists in the remaining storage region set, the entity file is augmented to obtain an augmented entity file. And storing the fourth target file in an amplified region of the amplified physical file. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
In some optional implementations of some embodiments, the reading unit 1203 may be further configured to: and determining file position attribute information corresponding to the storage position of the first target file. The file position attribute information includes a data offset of the first target file in the entity file and a data length of the target file. And reading the first target file according to the file position attribute information.
In some optional implementations of some embodiments, the reading unit 1203 may be further configured to: and determining the data offset based on the position information of the first target file in the entity file. And determining the number of bytes occupied by the first target file as the data length.
In some optional implementations of some embodiments, the content information of the file is in one-to-one correspondence with a storage location of the file.
In some optional implementations of some embodiments, the file corresponding to the storage location of the file is stored in an entity file in a file system of the device, where the entity file is a set of files in which the files are closely arranged.
In some optional implementations of some embodiments, the files in the entity file include an encrypted file and a target resource. The encryption file is used for encrypting the target resource.
In some optional implementations of some embodiments, the target resource includes a game resource.
It will be understood that the units described in the apparatus 1200 correspond to the various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 1200 and the units included therein, and are not described herein again.
Referring now to fig. 13, shown is a schematic diagram of an electronic device (e.g., the electronic device of fig. 1) 1300 suitable for use in implementing some embodiments of the present disclosure. The electronic device shown in fig. 13 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 13, electronic device 1300 may include a processing means (e.g., central processing unit, graphics processor, etc.) 1301 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1302 or a program loaded from storage device 1308 into a Random Access Memory (RAM) 1303. In the RAM 1303, various programs and data necessary for the operation of the electronic apparatus 1300 are also stored. The processing device 1301, the ROM 1302, and the RAM 1303 are connected to each other via a bus 1304. An input/output (I/O) interface 1305 is also connected to bus 1304.
Generally, the following devices may be connected to the I/O interface 1305: input devices 1306 including, for example, touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, and the like; an output device 1307 including, for example, a Liquid Crystal Display (LCD), speaker, vibrator, etc.; storage devices 1308 including, for example, magnetic tape, hard disk, etc.; and a communication device 1309. The communications device 1309 may allow the electronic device 1300 to communicate wirelessly or by wire with other devices to exchange data. While fig. 13 illustrates an electronic device 1300 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 13 may represent one device or may represent a plurality of devices as necessary.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed over a network through the communication device 1309, or installed from the storage device 1308, or installed from the ROM 1302. The computer program, when executed by the processing apparatus 1301, performs the functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described above in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the apparatus; or may exist separately without being 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: responding to an acquisition request of a first target file, and determining access path information of the first target file in the acquisition request; determining the storage position of the first target file by utilizing a first data table according to the access path information of the first target file; wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file; and reading the first target file in the entity file based on the storage position of the first target file.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes a first determination unit, a second determination unit, and a reading unit. The names of these units do not in some cases constitute a limitation on the units themselves, and for example, the first determining unit may also be described as a "unit that determines, in response to an acquisition request for a first target file, access path information of the first target file in the acquisition request".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
According to one or more embodiments of the present disclosure, there is provided a file reading method including: responding to an acquisition request of a first target file, and determining access path information of the first target file in the acquisition request. And determining the storage position of the first target file by utilizing a first data table according to the access path information of the first target file. Wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file. And reading the first target file in the entity file based on the storage position of the first target file.
According to one or more embodiments of the present disclosure, the first mapping relationship is obtained based on the second attribute information of the file in the second data table. Wherein the second data table includes second attribute information of the plurality of files, and the second attribute information of the file includes: a second mapping relationship between at least one access path information of the file and content information of the file, and a third mapping relationship between the content information of the file and a storage location of the file.
According to one or more embodiments of the present disclosure, the second data table is stored in a data file, the first data table is stored in a memory, and the method further includes: and correspondingly updating the first attribute information of the file in the first data table based on the change of the second attribute information of the file in the second data table.
According to one or more embodiments of the present disclosure, the method further includes: and deleting the second mapping relation corresponding to the second target file in the second data table according to the updating request of the content of the second target file. And storing a second mapping relationship between the access path information of the second object file and the content information of a third object file and a third mapping relationship between the content information of the third object file and the storage location of the third object file in the second data table. Wherein the second object file and the third object file are different files.
According to one or more embodiments of the present disclosure, the method further includes: and determining that the third mapping relation is not associated with the access path information of the file in response to detecting that the second attribute information of the file in the second data table is changed. And deleting the third mapping relation which is not related to the access path information of the file in the second data table. And deleting the file associated with the third mapping relation which is not associated with the access path information of the file in the entity file.
According to one or more embodiments of the present disclosure, the first data table is generated by: and determining a mapping relation between at least one access path information of the file and a storage position of the file as a first mapping relation by using the second mapping relation and the third mapping relation in the second data table. And storing the first mapping relation in a data table in a memory to obtain the first data table.
According to one or more embodiments of the present disclosure, the second attribute information of the fourth target file in the second data table is added by: and acquiring the content of the fourth target file and at least one access path of the fourth target file. And encrypting the content of the fourth target file and at least one access path of the fourth target file to obtain the content information of the fourth target file and at least one access path information of the fourth target file. And determining the storage position of the fourth target file in the entity file based on the content of the fourth target file. And establishing a mapping relation between the content information of the fourth target file and at least one piece of access path information of the fourth target file as a second mapping relation of the fourth target file. And establishing a mapping relation between the content information of the fourth target file and the storage position of the fourth target file as a third mapping relation of the fourth target file. And adding the second mapping relation of the fourth target file and the third mapping relation of the fourth target file to the second data table.
According to one or more embodiments of the present disclosure, the determining a storage location of a fourth target file in the entity file based on the content of the fourth target file includes: and determining size information of the fourth object file based on the content of the fourth object file. And determining the storage position of each file in the entity files. And determining the storage position of the fourth target file in the entity file based on the size information of the fourth target file and the storage positions of the files.
According to one or more embodiments of the present disclosure, the determining a storage location of a fourth target file in the entity file based on the size information of the fourth target file and the storage locations of the respective files includes: and determining the residual storage area set in the entity file according to the storage position of each file. And determining whether a residual storage area for storing the fourth object file exists in the residual storage area set according to the size information of the fourth object file. And screening out the residual storage areas meeting the preset conditions from the residual storage area set as the storage areas of the fourth target file in response to determining that the residual storage areas for storing the fourth target file exist in the residual storage area set. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
According to one or more embodiments of the present disclosure, the method further includes: and in response to determining that no residual storage area for storing the fourth target file exists in the residual storage area set, amplifying the entity file to obtain an amplified entity file. And storing the fourth target file in an amplified region of the amplified physical file. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
According to one or more embodiments of the present disclosure, the reading of the first object file in the entity file based on the storage location information of the first object file includes: and determining file position attribute information corresponding to the storage position of the first target file. The file position attribute information includes a data offset of the first target file in the entity file and a data length of the target file. And reading the first target file according to the file position attribute information.
According to one or more embodiments of the present disclosure, the determining file location attribute information corresponding to the first target file storage location includes: and determining the data offset based on the position information of the first target file in the entity file. And determining the number of bytes occupied by the first target file as the data length.
According to one or more embodiments of the present disclosure, the content information of the file is in one-to-one correspondence with the storage location of the file.
According to one or more embodiments of the present disclosure, a file corresponding to a storage location of the file is stored in an entity file in a device file system, where the entity file is a set of files in which the files are closely arranged.
According to one or more embodiments of the present disclosure, the files in the entity files include an encrypted file and a target resource. The encryption file is used for encrypting the target resource.
According to one or more embodiments of the present disclosure, the target resource includes a game resource.
According to one or more embodiments of the present disclosure, there is provided a document reading apparatus including: the file access device comprises a first determining unit and a second determining unit, wherein the first determining unit is configured to respond to an acquisition request of a first target file and determine access path information of the first target file in the acquisition request. And the second determining unit is configured to determine the storage position of the first target file by using the first data table according to the access path information of the first target file. Wherein the first data table includes first attribute information of a plurality of files, and the first attribute information of the files includes: a first mapping relationship between at least one access path information of the file and a storage location of the file. A reading unit configured to read the first object file in an entity file based on a storage location of the first object file.
According to one or more embodiments of the present disclosure, the first mapping relationship is obtained based on the second attribute information of the file in the second data table. Wherein the second data table includes second attribute information of the plurality of files, and the second attribute information of the file includes: a second mapping relationship between at least one access path information of the file and content information of the file, and a third mapping relationship between the content information of the file and a storage location of the file.
According to one or more embodiments of the present disclosure, the apparatus may further include an updating unit (not shown in the figure). The updating unit may be configured to correspondingly update the first attribute information of the file in the first data table based on a change of the second attribute information of the file in the second data table.
According to one or more embodiments of the present disclosure, the apparatus may further include a first deletion unit and a storage unit (not shown in the drawings). The first deleting unit may be configured to delete the second mapping relationship corresponding to the second target file in the second data table according to an update request of the content of the second target file. The storage unit may be configured to store a second mapping relationship between access path information of the second object file and content information of a third object file and a third mapping relationship between content information of the third object file and a storage location of the third object file in the second data table. Wherein the second object file and the third object file are different files.
According to one or more embodiments of the present disclosure, the apparatus may further include a second deletion unit and a third deletion unit (not shown in the drawings). Wherein the second deletion unit may be configured to delete the third mapping relationship not associated with the access path information of the file in the second data table. The third deletion unit may be configured to delete the file associated with the third mapping relation not associated with the access path information of the file in the entity file.
According to one or more embodiments of the present disclosure, the first data table is generated by: and determining a mapping relation between at least one access path information of the file and a storage position of the file as a first mapping relation by using the second mapping relation and the third mapping relation in the second data table. And storing the first mapping relation in a data table in a memory to obtain the first data table.
According to one or more embodiments of the present disclosure, the second attribute information of the fourth target file in the second data table is added by: and acquiring the content of the fourth target file and at least one access path of the fourth target file. And encrypting the content of the fourth target file and at least one access path of the fourth target file to obtain the content information of the fourth target file and at least one access path information of the fourth target file. And determining the storage position of the fourth target file in the entity file based on the content of the fourth target file. And establishing a mapping relation between the content information of the fourth target file and at least one piece of access path information of the fourth target file as a second mapping relation of the fourth target file. And establishing a mapping relation between the content information of the fourth target file and the storage position of the fourth target file as a third mapping relation of the fourth target file. And adding the second mapping relation of the fourth target file and the third mapping relation of the fourth target file to the second data table.
According to one or more embodiments of the present disclosure, the determining a storage location of a fourth target file in the entity file based on the content of the fourth target file includes: and determining size information of the fourth object file based on the content of the fourth object file. And determining the storage position of each file in the entity files. And determining the storage position of the fourth target file in the entity file based on the size information of the fourth target file and the storage positions of the files.
According to one or more embodiments of the present disclosure, the determining a storage location of a fourth target file in the entity file based on the size information of the fourth target file and the storage locations of the respective files includes: and determining the residual storage area set in the entity file according to the storage position of each file. And determining whether a residual storage area for storing the fourth object file exists in the residual storage area set according to the size information of the fourth object file. And screening out the residual storage areas meeting the preset conditions from the residual storage area set as the storage areas of the fourth target file in response to determining that the residual storage areas for storing the fourth target file exist in the residual storage area set. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
According to one or more embodiments of the present disclosure, in response to determining that there is no remaining storage region storing the fourth target file in the remaining storage region set, the entity file is augmented to obtain an augmented entity file. And storing the fourth target file in an amplified region of the amplified physical file. And determining the storage position of the fourth target file in the entity file according to the storage area of the fourth target file.
According to one or more embodiments of the present disclosure, the reading unit may be further configured to: and determining file position attribute information corresponding to the storage position of the first target file. The file position attribute information includes a data offset of the first target file in the entity file and a data length of the target file. And reading the first target file according to the file position attribute information.
According to one or more embodiments of the present disclosure, the reading unit may be further configured to: and determining the data offset based on the position information of the first target file in the entity file. And determining the number of bytes occupied by the first target file as the data length.
According to one or more embodiments of the present disclosure, the content information of the file is in one-to-one correspondence with the storage location of the file.
According to one or more embodiments of the present disclosure, a file corresponding to a storage location of the file is stored in an entity file in a device file system, where the entity file is a set of files in which the files are closely arranged.
According to one or more embodiments of the present disclosure, the files in the entity files include an encrypted file and a target resource. The encryption file is used for encrypting the target resource.
According to one or more embodiments of the present disclosure, the target resource includes a game resource.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors. A storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as described in any of the embodiments above.
According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the method as described in any of the embodiments above.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (19)

1. A file reading method, comprising:
responding to an acquisition request of a first target file, and determining access path information of the first target file in the acquisition request;
determining the storage position of the first target file by utilizing a first data table according to the access path information of the first target file; wherein the first data table includes first attribute information of a plurality of files, the first attribute information of the files including: a first mapping relationship between at least one access path information of the file and a storage location of the file;
reading the first target file in an entity file based on the storage position of the first target file.
2. The method of claim 1, wherein the first mapping relationship is derived based on second attribute information of the file in a second data table; wherein the second data table includes second attribute information of the plurality of files, the second attribute information of the files including: a second mapping relationship between at least one access path information of the file and content information of the file, and a third mapping relationship between the content information of the file and a storage location of the file.
3. The method of claim 2, wherein the second data table is stored in a data file and the first data table is stored in a memory; and
the method further comprises the following steps:
and correspondingly updating the first attribute information of the file in the first data table based on the change of the second attribute information of the file in the second data table.
4. The method of claim 2, wherein the method further comprises:
deleting a second mapping relation corresponding to a second target file in the second data table according to an updating request of the content of the second target file;
storing a second mapping relation between the access path information of the second target file and the content information of a third target file and a third mapping relation between the content information of the third target file and the storage position of the third target file in the second data table; wherein the second target file and the third target file are different files.
5. The method of claim 2, wherein the method further comprises:
in response to detecting that the second attribute information of the file in the second data table is changed, determining that no third mapping relation is associated with the access path information of the file;
deleting the third mapping relation which is not associated with the access path information of the file in the second data table;
deleting the file associated with the third mapping relation which is not associated with the access path information of the file in the entity file.
6. The method of claim 2, wherein the first data table is generated by:
determining a mapping relation between at least one access path information of the file and a storage position of the file as a first mapping relation by using the second mapping relation and the third mapping relation in the second data table;
and storing the first mapping relation in a data table in a memory to obtain the first data table.
7. The method of claim 2, wherein the second attribute information of the fourth target file in the second data table is added by:
acquiring the content of the fourth target file and at least one access path of the fourth target file;
encrypting the content of the fourth target file and at least one access path of the fourth target file to obtain content information of the fourth target file and at least one access path information of the fourth target file;
determining a storage position of a fourth target file in the entity file based on the content of the fourth target file;
establishing a mapping relation between the content information of the fourth target file and at least one access path information of the fourth target file as a second mapping relation of the fourth target file;
establishing a mapping relation between the content information of the fourth target file and the storage position of the fourth target file as a third mapping relation of the fourth target file;
adding the second mapping relationship of the fourth target file and the third mapping relationship of the fourth target file to the second data table.
8. The method of claim 7, wherein said determining a storage location of a fourth target file in the entity file based on the content of the fourth target file comprises:
determining size information of the fourth target file based on the content of the fourth target file;
determining the storage position of each file in the entity files;
and determining the storage position of a fourth target file in the entity file based on the size information of the fourth target file and the storage positions of the files.
9. The method of claim 8, wherein the determining the storage location of the fourth target file in the entity files based on the size information of the fourth target file and the storage locations of the respective files comprises:
determining a residual storage area set in the entity file according to the storage position of each file;
determining whether a residual storage area for storing the fourth target file exists in the residual storage area set according to the size information of the fourth target file;
in response to determining that a residual storage area for storing the fourth target file exists in the residual storage area set, screening out a residual storage area meeting a predetermined condition from the residual storage area set as a storage area of the fourth target file;
and determining the storage position of a fourth target file in the entity file according to the storage area of the fourth target file.
10. The method of claim 9, wherein the method further comprises:
in response to determining that no remaining storage area for storing the fourth target file exists in the remaining storage area set, amplifying the entity file to obtain an amplified entity file;
storing the fourth target file in an amplification region of the amplified entity file;
and determining the storage position of a fourth target file in the entity file according to the storage area of the fourth target file.
11. The method of claim 1, wherein the reading the first target file in an entity file based on storage location information of the first target file comprises:
determining file position attribute information corresponding to the storage position of the first target file; wherein the file location attribute information includes a data offset of the first target file in the entity file and a data length of the target file;
and reading the first target file according to the file position attribute information.
12. The method of claim 11, wherein said determining file location attribute information corresponding to said first target file storage location comprises:
determining the data offset based on the position information of the first target file in the entity file;
and determining the number of bytes occupied by the first target file as the data length.
13. The method of claim 1, wherein the content information of the file is in one-to-one correspondence with storage locations of the file.
14. The method of claim 1, wherein the file corresponding to the storage location of the file is stored in a physical file in a device file system, wherein the physical file is a tightly arranged file set.
15. The method of claim 1, wherein ones of the entity files comprise an encrypted file and a target resource; wherein the encrypted file is used for encrypting the target resource.
16. The method of claim 15, wherein the target resource comprises a game resource.
17. A document reading apparatus comprising:
a first determination unit configured to determine, in response to an acquisition request for a first target file, access path information of the first target file in the acquisition request;
a second determining unit configured to determine a storage location of the first target file by using a first data table according to the access path information of the first target file; wherein the first data table includes first attribute information of a plurality of files, the first attribute information of the files including: a first mapping relationship between at least one access path information of the file and a storage location of the file;
a reading unit configured to read the first object file in an entity file based on a storage location of the first object file.
18. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-16.
19. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-16.
CN202011122067.4A 2020-10-20 2020-10-20 File reading method and device, electronic equipment and computer readable medium Active CN112256196B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011122067.4A CN112256196B (en) 2020-10-20 2020-10-20 File reading method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011122067.4A CN112256196B (en) 2020-10-20 2020-10-20 File reading method and device, electronic equipment and computer readable medium

Publications (2)

Publication Number Publication Date
CN112256196A true CN112256196A (en) 2021-01-22
CN112256196B CN112256196B (en) 2023-03-24

Family

ID=74245521

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011122067.4A Active CN112256196B (en) 2020-10-20 2020-10-20 File reading method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN112256196B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170139614A1 (en) * 2015-11-13 2017-05-18 International Business Machines Corporation Performing collective i/o operations within operating system processes
CN109446160A (en) * 2018-11-06 2019-03-08 郑州云海信息技术有限公司 A kind of file reading, system, device and computer readable storage medium
CN109582644A (en) * 2018-12-21 2019-04-05 深圳前海微众银行股份有限公司 File memory method, device, equipment and computer readable storage medium
CN111414337A (en) * 2019-01-08 2020-07-14 阿里巴巴集团控股有限公司 File reading method and device, computing equipment and storage medium
CN111629063A (en) * 2020-05-29 2020-09-04 宁波富万信息科技有限公司 Block chain based distributed file downloading method and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170139614A1 (en) * 2015-11-13 2017-05-18 International Business Machines Corporation Performing collective i/o operations within operating system processes
CN109446160A (en) * 2018-11-06 2019-03-08 郑州云海信息技术有限公司 A kind of file reading, system, device and computer readable storage medium
CN109582644A (en) * 2018-12-21 2019-04-05 深圳前海微众银行股份有限公司 File memory method, device, equipment and computer readable storage medium
CN111414337A (en) * 2019-01-08 2020-07-14 阿里巴巴集团控股有限公司 File reading method and device, computing equipment and storage medium
CN111629063A (en) * 2020-05-29 2020-09-04 宁波富万信息科技有限公司 Block chain based distributed file downloading method and electronic equipment

Also Published As

Publication number Publication date
CN112256196B (en) 2023-03-24

Similar Documents

Publication Publication Date Title
CN110516462B (en) Method and apparatus for encrypting data
CN110019080B (en) Data access method and device
CN108777685B (en) Method and apparatus for processing information
CN110909521A (en) Synchronous processing method and device for online document information and electronic equipment
CN113032818B (en) Task encryption method and device, electronic equipment and computer readable medium
CN110753020A (en) Network request processing method and device
CN113553300A (en) File processing method and device, readable medium and electronic equipment
CN112748962A (en) Application loading method and device, electronic equipment and computer readable medium
CN112256196B (en) File reading method and device, electronic equipment and computer readable medium
CN112966303A (en) Data encryption and decryption method and device, electronic equipment and computer storage medium
CN110674082A (en) Method and device for removing online document, electronic equipment and computer readable medium
CN111787041A (en) Method and apparatus for processing data
CN115934640A (en) Data storage method, system, electronic equipment and storage medium
CN113987471A (en) Executable file execution method and device, electronic equipment and computer readable medium
CN114491421A (en) File encryption method, file processing method, file encryption device, file processing device, readable medium and electronic equipment
CN113760927A (en) Data processing method and device, electronic equipment and computer readable medium
CN114115941A (en) Resource sending method, page rendering method, device, electronic equipment and medium
CN112650722B (en) File processing method and device based on android application program, electronic equipment and medium
CN112464255A (en) Data processing method and device, storage medium and electronic equipment
CN110795408A (en) Data processing method and device based on object storage, server and storage medium
CN114091022A (en) Target file detection and deletion method, device, electronic equipment and readable medium
CN116702169B (en) Data encryption migration method, electronic device and computer readable medium
CN111835846B (en) Information updating method and device and electronic equipment
CN112468470B (en) Data transmission method and device and electronic equipment
CN116820354B (en) Data storage method, data storage device and data storage system

Legal Events

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