CN116527658A - Resource loading method, device, medium and electronic equipment - Google Patents

Resource loading method, device, medium and electronic equipment Download PDF

Info

Publication number
CN116527658A
CN116527658A CN202310567596.2A CN202310567596A CN116527658A CN 116527658 A CN116527658 A CN 116527658A CN 202310567596 A CN202310567596 A CN 202310567596A CN 116527658 A CN116527658 A CN 116527658A
Authority
CN
China
Prior art keywords
resource
target
information
resources
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310567596.2A
Other languages
Chinese (zh)
Inventor
温荣林
颜启发
黄键东
马东东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 CN202310567596.2A priority Critical patent/CN116527658A/en
Publication of CN116527658A publication Critical patent/CN116527658A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a resource loading method, a device, a medium and an electronic device, wherein the method comprises the following steps: determining target resources to be loaded in target application; determining a storage address of the target resource in a target package file stored in a cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address; if the target resources are multiple, combining the storage addresses of the multiple target resources to obtain target addresses for applying for the multiple target resources; and sending a resource request to a cloud according to the target address, and loading the target resource according to target data returned by the cloud. Therefore, the on-demand loading of the resources can be realized, meanwhile, the resource request can be sent based on the target addresses corresponding to the resources, the loading of the resources by one request is realized, and the efficiency of the resource loading is improved.

Description

Resource loading method, device, medium and electronic equipment
Technical Field
The disclosure relates to the technical field of computers, and in particular relates to a resource loading method, a resource loading device, a resource loading medium and electronic equipment.
Background
The in-game resource package typically includes in-game logical scripts (Lua, JS) and static resources (pictures, special effects material, audio-video material, text files, configuration files, etc.). Typically, the number of resources in the game is very large (several thousands to tens of thousands), the resources in the game are very scattered, and the file size of each resource is very small, usually several KB to several MB.
Because each resource in the resource package is scattered, the downloading efficiency of the resource package is usually low, and the downloading speed is slow. For example, to download more than 1 ten thousand files, only several hundred KB to several MB per file, the resource download speed is very slow, and it is inconvenient for the user.
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.
In a first aspect, the present disclosure provides a resource loading method, the method comprising:
determining target resources to be loaded in target application;
Determining a storage address of the target resource in a target package file stored in a cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address;
if the target resources are multiple, combining the storage addresses of the multiple target resources to obtain target addresses for applying for the multiple target resources;
and sending a resource request to a cloud according to the target address, and loading the target resource according to target data returned by the cloud.
In a second aspect, the present disclosure provides a resource loading apparatus, the apparatus comprising:
the first determining module is used for determining target resources to be loaded in the target application;
the second determining module is used for determining a storage address of the target resource in a target package file stored in the cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address;
the third determining module is used for merging the storage addresses of the plurality of target resources if the target resources are a plurality of so as to obtain target addresses for applying for the plurality of target resources;
The loading module is used for sending a resource request to the cloud according to the target address and loading the target resource according to target data returned by the cloud.
In a third aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which when executed by a processing device performs the steps of the method of the first aspect.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method of the first aspect.
In the technical scheme, for the target package file stored in the cloud and containing each resource, the target address corresponding to the target resource can be loaded once by determining the target resource loaded therein, and further the corresponding resource is requested from the cloud based on the target address, so that the target resource is loaded, the on-demand loading of the resource can be realized, meanwhile, the resource request can be sent based on the target addresses corresponding to the plurality of resources, the resource loading can be realized once, the problems of low efficiency and low loading success rate caused by too frequent resource loading requests are avoided, the efficiency of resource loading is further improved, real-time application after the resource loading can be supported, and the running efficiency and response efficiency of the application program are improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
fig. 1 is a flow chart of a resource loading method provided in accordance with one embodiment of the present disclosure.
Fig. 2 is a schematic diagram of a resource information region in a target package file provided according to one embodiment of the present disclosure.
Fig. 3 is a schematic structural diagram of target data returned by the cloud according to an embodiment of the present disclosure.
Fig. 4 is a schematic diagram of a target resource documentation process in a target package file provided according to one embodiment of the present disclosure.
Fig. 5 is a block diagram of a resource loading device provided in accordance with one embodiment of the present disclosure.
Fig. 6 is a schematic diagram illustrating a configuration of an electronic device suitable for use in implementing 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 have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
It will be appreciated that prior to using the technical solutions disclosed in the embodiments of the present disclosure, the user should be informed and authorized of the type, usage range, usage scenario, etc. of the personal information related to the present disclosure in an appropriate manner according to the relevant legal regulations.
For example, in response to receiving an active request from a user, a prompt is sent to the user to explicitly prompt the user that the operation it is requesting to perform will require personal information to be obtained and used with the user. Thus, the user can autonomously select whether to provide personal information to software or hardware such as an electronic device, an application program, a server or a storage medium for executing the operation of the technical scheme of the present disclosure according to the prompt information.
As an alternative but non-limiting implementation, in response to receiving an active request from a user, the manner in which the prompt information is sent to the user may be, for example, a popup, in which the prompt information may be presented in a text manner. In addition, a selection control for the user to select to provide personal information to the electronic device in a 'consent' or 'disagreement' manner can be carried in the popup window.
It will be appreciated that the above-described notification and user authorization process is merely illustrative and not limiting of the implementations of the present disclosure, and that other ways of satisfying relevant legal regulations may be applied to the implementations of the present disclosure.
Meanwhile, it can be understood that the data (including but not limited to the data itself, the acquisition or the use of the data) related to the technical scheme should conform to the requirements of the corresponding laws and regulations and related regulations.
As described above, in general, the number of resources included in a resource package of a game application is large, and when the resource package is loaded, a resource list to be updated may be requested from a server after an application program is started, and the resources to be updated may be sequentially loaded one by one. Or each discrete resource is packaged into a zip package, and the zip package is loaded. The applicant found that when files are loaded one by one through a resource, a new download request needs to be initiated every time a resource is downloaded, thereby resulting in low resource loading efficiency. And because of the slow start mechanism of TCP, the network transmission speed can be slow, it is difficult to realize high-speed downloading, and the success rate of the whole downloading of resources can be reduced by multiple requests. When loading resources based on the download mode of the zip package, a zip file needs to be downloaded at the client, the zip file is decompressed after the downloading is completed, the zip file is restored to individual resources, and finally the zip file is deleted. In the process, not only the intermediate file can be generated, but also the resources in the intermediate file can not be used until the whole zip packet is downloaded, and the file needs to be decompressed.
Based on this, the present disclosure provides the following examples. Fig. 1 is a flowchart of a resource loading method according to an embodiment of the disclosure, where, as shown in fig. 1, the method may include:
in step 11, a target resource to be loaded in the target application is determined.
In this embodiment, all the resources in the resource package of the target application may be loaded, or the resources may be loaded as needed, that is, which part of the resources are loaded first by which part of the resources are currently applied, so that the corresponding application program responds to running in time.
In step 12, a storage address of the target resource in the target package file stored in the cloud is determined according to the target resource and a resource management table, wherein the resource management table includes a correspondence between a path of the target resource in the target package file and the storage address.
The target package file contains all resources required by the application program, and the path and the storage address of the target resource in the target package file can be determined based on the resource management table, so that the corresponding resource can be loaded from the cloud. As an example, the resource data in the target package file can be downloaded in a streaming manner, so that the application of the target resource can be realized after the target resource is loaded, and the efficiency of the resource loading and the application is further improved.
In step 13, if the target resources are plural, the storage addresses of the plural target resources are merged to obtain the target addresses for applying for the plural target resources. In this embodiment, it is possible to support loading of a part of resource files from the target package file, and at the same time, by merging the storage addresses of the plurality of target resources, the target addresses for loading the plurality of target resources at a time are obtained.
In step 14, a resource request is sent to the cloud according to the target address, and the target resource is loaded according to the target data returned by the cloud.
Therefore, in the technical scheme, for the target package file stored in the cloud and containing each resource, the target address corresponding to the target resource can be loaded once by determining the target resource loaded therein, and further the corresponding resource is requested from the cloud based on the target address, so that the target resource is loaded, the on-demand loading of the resource can be realized, meanwhile, the resource request can be sent based on the target address corresponding to the plurality of resources, the problem of low efficiency and loading success rate caused by too frequent resource loading requests is solved, the efficiency of resource loading is further improved, real-time application after the resource loading can be supported, and the running efficiency and response efficiency of the application program are improved.
In a possible embodiment, the destination packet file includes a resource information area and a resource data area, and the resource management table is determined by:
and sending a head acquisition request of the target package file to the cloud, wherein the head acquisition request is used for acquiring information of a head area in a resource information area of the target package file. As an example, the resource information region may be as shown in fig. 2. Wherein a header region may be used to represent the header region. Illustratively, the header acquisition request may be sent according to a URL (Uniform Resource Locator ) of the target package file to load the header region in the target package file. The header area may be fixed in length, and if it may be preset to 64 bytes, the data range requested in the header acquisition request may be represented as 0-63, so as to load the header area information in the target packet file.
And determining the total length of the resource information area according to the information of the head area.
The header area information may include a plurality of fields, as shown in table 1 below:
TABLE 1
Thus, after the header area information is obtained, the value of the metaLength field therein indicates the total length of the resource information area.
And determining an information request address of the resource information area according to the total length, and sending an information acquisition request to the cloud end based on the information request address of the resource information area, wherein the information acquisition request is used for acquiring resource data information except for information of the head area in the resource information area.
If the information of the header area in the resource information area is already acquired, the information of the header area in the resource information area does not need to be acquired again, and the length indicated by the metaLength from the last bit of the end address of the header area of the target packet file can be used as the information request address of the resource information area, so that an information acquisition request can be sent to the cloud based on the address of the resource information area to acquire the resource data information of the information except the header area in the resource information area.
And analyzing the resource data information to obtain paths and storage addresses corresponding to the resources in the target packet file so as to form the resource management table.
Therefore, the index of each resource in the target package file can be obtained by firstly acquiring the information in the resource information area in the target package file and analyzing the information so as to realize the on-demand downloading of the resource.
In a possible embodiment, the resource information area further includes a base information area, a resource index area, and a resource path area;
the analyzing the resource data information to obtain paths and storage addresses corresponding to the resources in the target packet file, so as to form an exemplary implementation manner of the resource management table may include: and determining the corresponding addresses of the resource index area and the resource path area respectively according to the resource data information of the basic information area. The following fields may be included in the basic information area, as shown in table 2:
TABLE 2
Therefore, the addresses corresponding to the resource index area and the resource path area can be determined based on the field value in the basic information area, for example, according to the initial offset address of the resource index area in the packet file and the length of the resource index area, the address corresponding to the initial offset address of the resource index area in the packet file, the length of which is the length of the resource index area, can be used as the address of the resource index area, and similarly, the corresponding address can be obtained based on the initial offset address of the resource path area in the packet file and the length of the resource path area.
And then, acquiring resource index information from the resource data information according to the address corresponding to the resource index area, wherein the resource index information comprises the storage address of the path of each resource in the target packet file and the storage address of the resource. The data corresponding to the address corresponding to the resource index region in the resource data information may be used as the resource index information.
And acquiring resource path information from the resource data information according to the address corresponding to the resource path area. Similarly, the resource path information may be data corresponding to an address corresponding to the resource path region in the resource data information.
And acquiring the path of the resource from the resource path information according to the storage address of the path of each resource.
The resource index information may include index information corresponding to each resource in the package file, where each index information may include fields as shown in table 3:
TABLE 3 Table 3
Thus, the storage address of the path of each resource can be determined based on the values of the path_m.startoffest and the path_m.length of the resource, and the storage address of the resource, that is, the storage address of the data corresponding to the resource per se, can be determined according to the data_m.startoffest and the data_m.length of the resource.
In the above example, the path_m.startoffset and path_m.length of the resource index area may determine the storage address of the path, where the storage order of the resource path information of each resource in the resource path area is consistent with the corresponding resource storage order in the resource index area. If the storage address of the path of the 3 rd resource can be determined according to the path_3.startoffset and the path_3.length for the 3 rd resource, the information corresponding to the storage address of the 3 rd resource in the resource path information can be used as the path of the 3 rd resource. If the path corresponding to the 3 rd resource is root/A/A1.
In this embodiment, the paths corresponding to the resources are stored through the resource path information of the resource path area, and the paths of the resources are indexed through the resource index area, so that unified management and storage of the paths with the indefinite length under the resources are realized, the query efficiency of the paths is improved, and support is provided for subsequently improving the resource loading efficiency.
And for each resource, forming a corresponding relation according to the path of the resource and the storage address of the resource so as to obtain the resource management table.
Correspondingly, if the 3 rd resource in the package file is the root/A1, the corresponding storage address is the storage address add3 determined by data_3.Startoffest and data_3.Length, a corresponding relation can be generated, if the corresponding relation can be expressed in Map form, if < root/A1, add3>, that is, the storage address of the resource of which the path is root/A1 in the package file is add3, the client can determine that the storage address of the resource in the package file is add3 based on the resource management table when the client applies for the resource of which the path is root/A1, and further can generate a resource request based on the add3, so that the on-demand loading and use of the resource are realized.
Therefore, through the technical scheme, the path and the storage address of each resource in the target package file can be obtained based on the analysis of the information in the resource information area of the obtained target package file, so that the resource management table is generated, the address of the target resource to be loaded can be quickly and accurately determined based on the resource management table, and the resource loading efficiency is improved.
As an example, determining the target resource to be loaded in the target application may be determining the target resource by acquiring a path of the target resource through a running trigger of the application program.
As another example, the resource information region further includes a tag region; the implementation manner of determining the target resource to be loaded in the target application may include:
the target label of the target resource to be loaded is obtained, wherein the target label can be determined from resource loading operation triggered by an application program, such as a game program, and the target label can be a checkpoint 4, namely, the target label is used for loading various resources corresponding to the checkpoint 4.
Inquiring a tag management table according to the target tag, and determining the resource corresponding to the target tag in the inquired target package file as the target resource;
The label management table comprises a corresponding relation between each label and the corresponding identifier of each resource under each label, and the label management table is determined by the following modes:
and determining the address corresponding to the tag area according to the resource data information of the basic information area.
The address corresponding to the tag area may be determined according to the values of the fields of the label. Startoffset and label. Length in the basic information area.
And acquiring resource tag information from the resource data information according to the address corresponding to the tag area, wherein the resource tag information comprises each tag information in the target packet file.
And taking information corresponding to the address of the tag area in the resource data information as the resource tag information. For example, a total of 8 tags in the object package file are denoted as L1-L8, respectively, and the order is L1-L8, i.e., bit 1 in the data_m.label field corresponds to L1, bit 2 corresponds to L2, and so on.
And determining the label corresponding to the resource according to the label flag bit of each resource in the resource index information.
In the above example, each index information in the resource index information may include a data_m.label field, where the value of the field is a tag flag bit, and may be used to indicate the tag of the resource corresponding to the index information, if the value of data_1.label of resource 1 is 10000000, the first bit is 1, the tag of resource 1 is L1, the value of data_1.label of resource 2 is 00010000, and the 4 th bit is 1, the tag of resource 2 is L4. Thus, the labels corresponding to the resources can be resolved.
And generating a corresponding relation between the label and the identification of the resource corresponding to the label for each label to obtain the label management table, wherein the identification of the resource corresponds to the path of the resource one by one.
The identifiers of the resources and the paths of the resources are in one-to-one correspondence, and then the corresponding relationship can be generated according to the identifiers of the resources corresponding to the same tag after the tags corresponding to the resources are analyzed. Therefore, after the target label of the target resource to be loaded is determined, the note management table can be queried directly based on the target label, and as described above, the note management table can be queried according to the target label L4, and each resource corresponding to the L4 is used as the target resource, so that the determination efficiency of the target resource can be improved, and the loading efficiency of the resource can be improved.
In one possible embodiment, the exemplary implementation of merging the storage addresses of the plurality of target resources to obtain the target addresses for applying for the plurality of target resources is as follows, and the step may include:
and if the storage addresses of the target resources are continuous, combining the storage addresses of the target resources to obtain the target addresses.
Illustratively, the target resources include resources D1, D2, and D3 whose storage addresses are [101,200], [201,500], and [501,1000], respectively, which represent a succession between the storage addresses of the plurality of target resources, where the storage addresses may be directly combined to obtain the address [101,1000] as the target address.
If the discontinuous resources exist between the at least two storage addresses in the plurality of target resources, combining the storage addresses of the plurality of continuous resources among the storage addresses in the target resources to obtain a combined address, and taking the storage addresses of the discontinuous resources among the combined address and the at least two storage addresses as the target addresses.
As an example, if the storage addresses of the plurality of target resources are not consecutive to each other, the storage addresses of the plurality of target resources may be directly used as the target addresses.
As another example, the target resource comprises resources D1, D3, D4, and D5 whose storage addresses are [101,200], [501,1000], [2001,3000], and [3001,3400], respectively, where D1, D3 are discontinuous and D4 and D5 are continuous, the storage addresses of D4 and D5 may be combined, e.g., as in [2001,3000] and [3001,3400], to obtain a combined address [2001,3400], and further, as the target addresses, [101,200], [501,1000], and [2001,3400 ].
Therefore, through the technical scheme, the addresses of the target resources can be combined, so that the process of frequently sending network requests in the resource loading process can be effectively avoided, the influence of the frequent requests on the network transmission speed is avoided, and the resource loading efficiency and the resource loading success rate are improved conveniently. Meanwhile, the storage addresses of the resources in the network requests under any condition can be combined, the problem of low downloading efficiency caused by frequent network requests for downloading the loose files is completely avoided, the network requests and the transmission efficiency are greatly improved, the network bandwidth is fully utilized, and the downloading speed is accelerated.
In one possible embodiment, the exemplary implementation manner of sending the resource request to the cloud according to the target address may include:
and determining the request address corresponding to each thread under the multithreading according to the resource application data quantity corresponding to the target address.
For example, the requests of each thread under the multithreading may be evenly distributed, for example, the target address includes [101,200], [501,1000] and [2001,3400], and it may be determined that the resource application data amount corresponding to the target address is 2000 (100+500+1400), if the multithreading includes 4 threads, the resource application amount may be evenly distributed for the 4 threads, for example, the request addresses corresponding to the thread 1 are [100,200] and [501,900], the request addresses corresponding to the thread 2 are [901,1000] and [2001,2400], the request address corresponding to the thread 3 is [2401,2900], and the request address corresponding to the thread 4 is [2901,3400].
And for example, the resource application amount can be allocated by combining the utilization rate of each thread in the multithreading, if the resource application amount corresponding to the thread with high current utilization rate is less, the resource application amount corresponding to the thread with low current utilization rate is more, so that the efficiency of resource loading is further improved.
And generating the resource request according to the request address, and sending the resource request based on the multithreading.
Therefore, through the technical scheme, resources can be carried out through multithreading in the resource loading process, so that the resource utilization rate can be further improved, the processing efficiency of an application program is improved, and the use experience of a user is improved.
In one possible embodiment, after the loading of the resources corresponding to a certain thread in the multithreading is completed, the request address may be determined continuously according to the addresses corresponding to the unloaded resources in other threads, and the resource request may be sent, so as to speed up the downloading until the loading of the multiple target resources is completed.
In a possible embodiment, an exemplary implementation manner of loading the target resource according to the target data returned by the cloud may include:
and determining the data corresponding to the storage address of the target resource in the target data as resource data corresponding to the target resource, wherein the data corresponding to discontinuous addresses in the target data are separated by separators.
As described above, the number of the target addresses used for performing the resource request may be one or more, if the number of the target addresses is one, the target data returned by the cloud is a segment of data with continuous addresses, and if the number of the target addresses is more than one, the data corresponding to discontinuous addresses in the target data returned by the cloud may be separated by a separator, as shown in fig. 3. Where the H1 line is used to represent separator, boundary is used to represent boundary separation, and CRLF is used to represent carriage return. The H2 line and the H3 line are used to represent the response header, type/pkg is used to represent the type of data, bytes: x1-y1/length is used to represent the range of the first piece of data. The H4 line is used to represent the blank line, the H5 line is used to represent the first piece of data, and the H6 line is used to represent the second piece of data. bytes x2-y2/length is used to represent the range of the second piece of data. For the returned target data shown in fig. 3, the target data may be parsed to delete the separator therein to obtain the entity data of the target resource.
And generating a target file corresponding to the target resource according to the path of the target resource, and writing the resource data of the target resource into the target file so as to load the target resource.
Further, as shown above, for the parsed data corresponding to address [2001,3400], where the memory address of resource D4 is [2001,3000], and the memory address of resource D5 is [3001,3400]. The path of D4 is root/a/C/x, the path of D5 is root/B/y, as shown in fig. 4, two files may be generated according to the paths, the data corresponding to [2001,3000] in the target data is written into the file corresponding to root/a/C/x, and the data corresponding to [3001,3400] in the target data is written into the file corresponding to root/B/y, so that after loading the resource, the user side may obtain the resource file with the same structure as that developed by the game development side. As shown in fig. 4, after the game development side develops the code files of each resource, the code files can be packaged by a packaging tool to obtain a target package file, and the target package file is uploaded to the CDN (Content Delivery Network ), and a client corresponding to the user side, i.e., the target application, can load part or all of the resources in the target package file from the CDN, and keep the same structure as the resource file of the game development side. For other resources, the loading manner of the target data returned from the cloud is the same, and is not described herein.
Therefore, through the technical scheme, the response and the data stream corresponding to the resource request can be analyzed, when the data stream is analyzed, the obtained target data can be disassembled, restored and stored into the original resource scattered file according to the corresponding relation between the address range of each target resource and the target address of the resource request, namely, the target file corresponding to each resource, the network data stream can be directly disassembled and restored into the original scattered file from the network data stream layer, decompression is not needed, and no intermediate temporary file is generated, so that the resource loading efficiency can be further improved.
In a possible embodiment, based on the scheme of the present disclosure, when a plurality of target resources are requested at a time, each target resource may be loaded in turn according to returned target data, after the resource data corresponding to any target resource is written into its corresponding target file, loading and use of the target resource may be implemented, and compared with the prior art in which resource loading is implemented by using a ZIP compression packet, it is unnecessary to wait for loading of other resources to be completed, so that on-demand downloading of resources and on-demand use of resources may be implemented, and stability and response efficiency of application running may be further improved.
In a possible embodiment, the destination packet file includes a resource information area and a resource data area, and the method further includes:
and under the condition that the target package file corresponding to the target application is determined to be updated, acquiring data information in a resource information area corresponding to the updated target package file from the cloud, wherein the data information comprises abstract information of each resource in the updated target package file.
The version number and the release date are generally updated after the package file is updated, which is taken as an example, whether the version number of the target package file currently loaded by the target application is the same as the version number of the target package file stored in the cloud end or not may be determined, and if the version numbers are different, the target package file is updated. Or may be determined by comparing the release dates, which is not limited by the present disclosure.
As an example, obtaining, from the cloud, data information in a resource information area corresponding to the updated target package file may include:
transmitting a header acquisition request of the updated target package file to the cloud, wherein the header acquisition request is used for acquiring information of a header area in a resource information area of the updated target package file;
Determining the total length of the resource information area of the updated target package file according to the information of the head area in the resource information area of the updated target package file;
determining a request address of the resource information area of the updated target packet file according to the total length of the resource information area of the updated target packet file, and sending an information acquisition request to the cloud terminal based on the information request address of the resource information area of the updated target packet file, wherein the information acquisition request is used for acquiring resource data information except for information of the head area in the resource information area of the updated target packet file, and a structure corresponding to the resource data information and fields contained in the resource data information are described in detail above and are not described in detail herein.
The value of data_md5 of each resource in the resource index area in the updated target packet file can be used as the abstract information of the resource.
Matching each resource in the resource management table and the abstract information of each resource with each resource in the data information and the abstract information of each resource;
the determining the target resource to be loaded in the target application comprises the following steps:
And determining the resources which are not matched with the resource management table in the data information and the resources which are not matched with the abstract information in the data information in the resource management table as the target resources.
For example, the path of each resource in the resource management table may be matched with the path of each resource in the data information, and if the resource in the data information does not have a matched resource in the resource management table, it indicates that the resource in the data information is newly added in the updated target packet file, and at this time, it may be determined as the target resource. If the resources in the data information have matched resources in the resource management table, whether the abstract information of the two resources is the same or not can be further matched, if the abstract information of the two resources is different, the resources in the data information are modified in the updated target package file, and the updated target package file can be determined to be the target resources.
Therefore, through the technical scheme, after the target package file is updated, the difference comparison of single resources can be supported, and the resources which need to be updated and loaded are determined by respectively comparing the difference between the resources in the resource management table and the updated resources in the target package file. Based on the method, only the resources which are modified and newly added after the updating of the target package file are needed to be downloaded, so that the problem that the whole new zip file needs to be reloaded once the resources in the zip package are modified or newly added is effectively solved, and the efficiency of resource loading is further improved.
The present disclosure further provides a resource loading device, as shown in fig. 5, the device 10 includes:
a first determining module 100, configured to determine a target resource to be loaded in a target application;
the second determining module 200 is configured to determine, according to the target resource and a resource management table, a storage address of the target resource in a target packet file stored in the cloud, where the resource management table includes a correspondence between a path of the target resource in the target packet file and the storage address;
a third determining module 300, configured to, if the target resources are plural, combine the storage addresses of the plural target resources to obtain a target address for applying for the plural target resources;
the loading module 400 is configured to send a resource request to the cloud according to the target address, and load the target resource according to target data returned by the cloud.
Optionally, the target package file includes a resource information area and a resource data area, the resource management table is determined by a generating module, and the generating module includes:
a first sending sub-module, configured to send a header acquisition request of the target package file to the cloud end, where the header acquisition request is used to acquire information of a header area in a resource information area of the target package file;
A first determining submodule, configured to determine a total length of the resource information area according to the information of the header area;
the second sending sub-module is used for determining a request address of the resource information area according to the total length, and sending an information acquisition request to the cloud terminal based on the information request address of the resource information area, wherein the information acquisition request is used for acquiring resource data information except for information of the head area in the resource information area;
the first generation sub-module is used for analyzing the resource data information to obtain paths and storage addresses corresponding to all resources in the target packet file so as to form the resource management table.
Optionally, the resource information area further includes a basic information area, a resource index area, and a resource path area;
the first generation sub-module includes:
the second determining submodule is used for determining corresponding addresses of the resource index area and the resource path area respectively according to the resource data information of the basic information area;
the first acquisition sub-module is used for acquiring resource index information from the resource data information according to the address corresponding to the resource index area, wherein the resource index information comprises the storage address of each path of the resource and the storage address of the resource in the target packet file;
The second acquisition sub-module is used for acquiring the resource path information from the resource data information according to the address corresponding to the resource path area;
a third obtaining sub-module, configured to obtain, according to the storage address of each path of the resource, the path of the resource from the resource path information;
and the second generation sub-module is used for forming a corresponding relation according to the path of the resource and the storage address of the resource for each resource so as to obtain the resource management table.
Optionally, the resource information area further includes a tag area; the first determining module includes:
the second acquisition sub-module is used for acquiring a target label of a target resource to be loaded;
the third determining submodule is used for inquiring a tag management table according to the target tag and determining the resource corresponding to the target tag in the inquired target package file as the target resource;
the label management table comprises a corresponding relation between each label and the corresponding identifier of each resource under each label, and the label management table is determined by the following modes:
determining the address corresponding to the tag area according to the resource data information of the basic information area;
Acquiring resource tag information from the resource data information according to the address corresponding to the tag area, wherein the resource tag information comprises tag information in the target package file;
determining a label corresponding to the resource according to the label flag bit of each resource in the resource index information;
and generating a corresponding relation between the label and the identification of the resource corresponding to the label for each label to obtain the label management table, wherein the identification of the resource corresponds to the path of the resource one by one.
Optionally, the third determining module includes:
a fourth determining submodule, configured to combine the storage addresses of the plurality of target resources to obtain the target address if the storage addresses of the plurality of target resources are consecutive;
and a fifth determining submodule, configured to, if there are resources in the plurality of target resources that are discontinuous between at least two storage addresses, combine storage addresses of the plurality of resources that are continuous between the storage addresses in the target resources, obtain a combined address, and use the storage addresses of the resources that are discontinuous between the combined address and the at least two storage addresses as the target addresses.
Optionally, the loading module includes:
a sixth determining submodule, configured to determine a request address corresponding to each thread in the multithreading according to the resource application data amount corresponding to the target address;
and the third sending sub-module is used for generating the resource request according to the request address and sending the resource request based on the multithreading.
Optionally, the loading module includes:
a seventh determining submodule, configured to determine data corresponding to the storage address of the target resource in the target data as resource data corresponding to the target resource, where data corresponding to discontinuous addresses in the target data are separated by separators;
and the loading sub-module is used for generating a target file corresponding to the target resource according to the path of the target resource, and writing the resource data of the target resource into the target file so as to load the target resource.
Optionally, the apparatus further comprises:
the acquisition module is used for acquiring data information in a resource information area of the updated target package file from the cloud under the condition that the target package file corresponding to the target application is determined to be updated, wherein the data information comprises abstract information of each resource in the updated target package file;
The matching module is used for matching each resource in the resource management table and the abstract information of each resource with each resource in the data information and the abstract information of each resource;
the first determining module is used for:
and determining the resources which are not matched with the resource management table in the data information and the resources which are not matched with the abstract information in the data information in the resource management table as the target resources.
Referring now to fig. 6, a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 6 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 601.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 the context of this 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 the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication 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 networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated 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: determining target resources to be loaded in target application; determining a storage address of the target resource in a target package file stored in a cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address; if the target resources are multiple, combining the storage addresses of the multiple target resources to obtain target addresses for applying for the multiple target resources; and sending a resource request to a cloud according to the target address, and loading the target resource according to target data returned by the cloud.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts 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 modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module is not limited to the module itself in some cases, and for example, the first determining module may also be described as "a module that determines a target resource to be loaded in a target application".
The functions described above herein 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: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on 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.
According to one or more embodiments of the present disclosure, example 1 provides a resource loading method, wherein the method comprises:
determining target resources to be loaded in target application;
determining a storage address of the target resource in a target package file stored in a cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address;
if the target resources are multiple, combining the storage addresses of the multiple target resources to obtain target addresses for applying for the multiple target resources;
and sending a resource request to a cloud according to the target address, and loading the target resource according to target data returned by the cloud.
According to one or more embodiments of the present disclosure, example 2 provides the method of example 1, wherein the destination packet file includes a resource information area and a resource data area, and the resource management table is determined by:
transmitting a header acquisition request of the target package file to the cloud, wherein the header acquisition request is used for acquiring information of a header area in a resource information area of the target package file;
Determining the total length of the resource information area according to the information of the head area;
determining a request address of the resource information area according to the total length, and sending an information acquisition request to the cloud end based on the information request address of the resource information area, wherein the information acquisition request is used for acquiring resource data information except for information of the head area in the resource information area;
and analyzing the resource data information to obtain paths and storage addresses corresponding to the resources in the target packet file so as to form the resource management table.
Example 3 provides the method of example 2, wherein the resource information region further comprises a base information region, a resource index region, and a resource path region, according to one or more embodiments of the present disclosure;
the analyzing the resource data information to obtain paths and storage addresses corresponding to the resources in the target packet file, so as to form the resource management table, including:
determining the corresponding addresses of the resource index area and the resource path area according to the resource data information of the basic information area;
acquiring resource index information from the resource data information according to the address corresponding to the resource index area, wherein the resource index information comprises the storage address of each path of the resource in the target packet file and the storage address of the resource;
Acquiring resource path information from the resource data information according to the address corresponding to the resource path area;
acquiring the path of the resource from the resource path information according to the storage address of the path of each resource;
and for each resource, forming a corresponding relation according to the path of the resource and the storage address of the resource so as to obtain the resource management table.
Example 4 provides the method of example 3, wherein the resource information region further comprises a tag region, according to one or more embodiments of the present disclosure; the determining the target resource to be loaded in the target application comprises the following steps:
acquiring a target label of a target resource to be loaded;
inquiring a tag management table according to the target tag, and determining the resource corresponding to the target tag in the inquired target package file as the target resource;
the label management table comprises a corresponding relation between each label and the corresponding identifier of each resource under each label, and the label management table is determined by the following modes:
determining the address corresponding to the tag area according to the resource data information of the basic information area;
Acquiring resource tag information from the resource data information according to the address corresponding to the tag area, wherein the resource tag information comprises tag information in the target package file;
determining a label corresponding to the resource according to the label flag bit of each resource in the resource index information;
and generating a corresponding relation between the label and the identification of the resource corresponding to the label for each label to obtain the label management table, wherein the identification of the resource corresponds to the path of the resource one by one.
According to one or more embodiments of the present disclosure, example 5 provides the method of example 1, wherein the merging the storage addresses of the plurality of target resources to obtain the target address for applying for the plurality of target resources includes:
if the storage addresses of the target resources are continuous, combining the storage addresses of the target resources to obtain the target addresses;
if the discontinuous resources exist between the at least two storage addresses in the plurality of target resources, combining the storage addresses of the plurality of continuous resources among the storage addresses in the target resources to obtain a combined address, and taking the storage addresses of the discontinuous resources among the combined address and the at least two storage addresses as the target addresses.
Example 6 provides the method of example 1, according to one or more embodiments of the present disclosure, wherein the sending the resource request to the cloud according to the target address includes:
determining a request address corresponding to each thread under the multithreading according to the resource application data volume corresponding to the target address;
and generating the resource request according to the request address, and sending the resource request based on the multithreading.
Example 7 provides the method of example 1, according to one or more embodiments of the present disclosure, wherein the loading the target resource according to the target data returned by the cloud comprises:
determining the data corresponding to the storage address of the target resource in the target data as resource data corresponding to the target resource, wherein the data corresponding to discontinuous addresses in the target data are separated by separators;
and generating a target file corresponding to the target resource according to the path of the target resource, and writing the resource data of the target resource into the target file so as to load the target resource.
Example 8 provides the method of example 1, according to one or more embodiments of the present disclosure, wherein the method further comprises:
Under the condition that the target package file corresponding to the target application is determined to be updated, acquiring data information in a resource information area of the updated target package file from the cloud, wherein the data information comprises abstract information of each resource in the updated target package file;
matching each resource in the resource management table and the abstract information of each resource with each resource in the data information and the abstract information of each resource;
the determining the target resource to be loaded in the target application comprises the following steps:
and determining the resources which are not matched with the resource management table in the data information and the resources which are not matched with the abstract information in the data information in the resource management table as the target resources.
Example 9 provides a resource loading apparatus according to one or more embodiments of the present disclosure, the apparatus comprising:
the first determining module is used for determining target resources to be loaded in the target application;
the second determining module is used for determining a storage address of the target resource in a target package file stored in the cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address;
The third determining module is used for merging the storage addresses of the plurality of target resources if the target resources are a plurality of so as to obtain target addresses for applying for the plurality of target resources;
the loading module is used for sending a resource request to the cloud according to the target address and loading the target resource according to target data returned by the cloud.
According to one or more embodiments of the present disclosure, example 10 provides a computer-readable medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the method of any of examples 1-8.
Example 11 provides an electronic device according to one or more embodiments of the present disclosure, comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to implement the steps of the method of any one of examples 1-8.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.

Claims (11)

1. A method of resource loading, the method comprising:
determining target resources to be loaded in target application;
determining a storage address of the target resource in a target package file stored in a cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address;
if the target resources are multiple, combining the storage addresses of the multiple target resources to obtain target addresses for applying for the multiple target resources;
and sending a resource request to a cloud according to the target address, and loading the target resource according to target data returned by the cloud.
2. The method of claim 1, wherein the destination packet file includes a resource information area and a resource data area, and wherein the resource management table is determined by:
transmitting a header acquisition request of the target package file to the cloud, wherein the header acquisition request is used for acquiring information of a header area in a resource information area of the target package file;
determining the total length of the resource information area according to the information of the head area;
Determining a request address of the resource information area according to the total length, and sending an information acquisition request to the cloud end based on the information request address of the resource information area, wherein the information acquisition request is used for acquiring resource data information except for information of the head area in the resource information area;
and analyzing the resource data information to obtain paths and storage addresses corresponding to the resources in the target packet file so as to form the resource management table.
3. The method of claim 2, wherein the resource information region further comprises a base information region, a resource index region, and a resource path region;
the analyzing the resource data information to obtain paths and storage addresses corresponding to the resources in the target packet file, so as to form the resource management table, including:
determining the corresponding addresses of the resource index area and the resource path area according to the resource data information of the basic information area;
acquiring resource index information from the resource data information according to the address corresponding to the resource index area, wherein the resource index information comprises the storage address of each path of the resource in the target packet file and the storage address of the resource;
Acquiring resource path information from the resource data information according to the address corresponding to the resource path area;
acquiring the path of the resource from the resource path information according to the storage address of the path of each resource;
and for each resource, forming a corresponding relation according to the path of the resource and the storage address of the resource so as to obtain the resource management table.
4. The method of claim 3, wherein the resource information region further comprises a tag region; the determining the target resource to be loaded in the target application comprises the following steps:
acquiring a target label of a target resource to be loaded;
inquiring a tag management table according to the target tag, and determining the resource corresponding to the target tag in the inquired target package file as the target resource;
the label management table comprises a corresponding relation between each label and the corresponding identifier of each resource under each label, and the label management table is determined by the following modes:
determining the address corresponding to the tag area according to the resource data information of the basic information area;
acquiring resource tag information from the resource data information according to the address corresponding to the tag area, wherein the resource tag information comprises tag information in the target package file;
Determining a label corresponding to the resource according to the label flag bit of each resource in the resource index information;
and generating a corresponding relation between the label and the identification of the resource corresponding to the label for each label to obtain the label management table, wherein the identification of the resource corresponds to the path of the resource one by one.
5. The method of claim 1, wherein the merging the storage addresses of the plurality of target resources to obtain the target address for applying for the plurality of target resources comprises:
if the storage addresses of the target resources are continuous, combining the storage addresses of the target resources to obtain the target addresses;
if the discontinuous resources exist between the at least two storage addresses in the plurality of target resources, combining the storage addresses of the plurality of continuous resources among the storage addresses in the target resources to obtain a combined address, and taking the storage addresses of the discontinuous resources among the combined address and the at least two storage addresses as the target addresses.
6. The method of claim 1, wherein the sending the resource request to the cloud according to the target address comprises:
Determining a request address corresponding to each thread under the multithreading according to the resource application data volume corresponding to the target address;
and generating the resource request according to the request address, and sending the resource request based on the multithreading.
7. The method of claim 1, wherein loading the target resource according to the target data returned by the cloud comprises:
determining the data corresponding to the storage address of the target resource in the target data as resource data corresponding to the target resource, wherein the data corresponding to discontinuous addresses in the target data are separated by separators;
and generating a target file corresponding to the target resource according to the path of the target resource, and writing the resource data of the target resource into the target file so as to load the target resource.
8. The method according to claim 1, wherein the method further comprises:
under the condition that the target package file corresponding to the target application is determined to be updated, acquiring data information in a resource information area of the updated target package file from the cloud, wherein the data information comprises abstract information of each resource in the updated target package file;
Matching each resource in the resource management table and the abstract information of each resource with each resource in the data information and the abstract information of each resource;
the determining the target resource to be loaded in the target application comprises the following steps:
and determining the resources which are not matched with the resource management table in the data information and the resources which are not matched with the abstract information in the data information in the resource management table as the target resources.
9. A resource loading device, the device comprising:
the first determining module is used for determining target resources to be loaded in the target application;
the second determining module is used for determining a storage address of the target resource in a target package file stored in the cloud according to the target resource and a resource management table, wherein the resource management table comprises a corresponding relation between a path of the target resource in the target package file and the storage address;
the third determining module is used for merging the storage addresses of the plurality of target resources if the target resources are a plurality of so as to obtain target addresses for applying for the plurality of target resources;
The loading module is used for sending a resource request to the cloud according to the target address and loading the target resource according to target data returned by the cloud.
10. A computer readable medium on which a computer program is stored, characterized in that the program, when being executed by a processing device, carries out the steps of the method according to any one of claims 1-8.
11. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-8.
CN202310567596.2A 2023-05-18 2023-05-18 Resource loading method, device, medium and electronic equipment Pending CN116527658A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310567596.2A CN116527658A (en) 2023-05-18 2023-05-18 Resource loading method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310567596.2A CN116527658A (en) 2023-05-18 2023-05-18 Resource loading method, device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116527658A true CN116527658A (en) 2023-08-01

Family

ID=87392149

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310567596.2A Pending CN116527658A (en) 2023-05-18 2023-05-18 Resource loading method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116527658A (en)

Similar Documents

Publication Publication Date Title
CN111581563B (en) Page response method and device, storage medium and electronic equipment
CN111291103B (en) Interface data analysis method and device, electronic equipment and storage medium
CN111198859B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN111246228B (en) Method, device, medium and electronic equipment for updating gift resources of live broadcast room
CN111273999B (en) Data processing method and device, electronic equipment and storage medium
US11809429B2 (en) Method for processing model parameters, and apparatus
CN112379982B (en) Task processing method, device, electronic equipment and computer readable storage medium
CN111338944B (en) Remote Procedure Call (RPC) interface testing method, device, medium and equipment
CN111625422B (en) Thread monitoring method, thread monitoring device, electronic equipment and computer readable storage medium
CN112115217A (en) Data processing method and device for high-precision map, electronic equipment and storage medium
CN111596992A (en) Navigation bar display method and device and electronic equipment
CN116527658A (en) Resource loading method, device, medium and electronic equipment
CN112100211B (en) Data storage method, apparatus, electronic device, and computer readable medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN113239301A (en) Page loading request method and device and electronic equipment
CN115225586B (en) Data packet transmitting method, device, equipment and computer readable storage medium
CN112948108B (en) Request processing method and device and electronic equipment
CN111831655B (en) Data processing method, device, medium and electronic equipment
CN117591048B (en) Task information processing method, device, electronic equipment and computer readable medium
CN111581305B (en) Feature processing method, device, electronic equipment and medium
CN116302140B (en) Method and device for starting computing terminal based on storage and calculation separation cloud primary number bin
CN114745371A (en) Point-to-point downloading method, device, equipment and medium
CN117880608A (en) Data processing method and device, readable medium and electronic equipment
CN115705193A (en) Distributed compiling method, device, equipment and medium

Legal Events

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