Object storage service calling method, device, electronic device and storage medium
By deploying target plug-ins in electronic devices of front-end applications and using encapsulated API to call multiple object storage services, the development and update complexity problems caused by changes in object storage service APIs in the prior art are solved, and high universality and low-complexity updates of front-end applications are achieved.
Patent Information
- Application Number
- CN202510112010.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-24
AI Technical Summary
When calling object storage services in an application system, code modifications need to be made according to the API changes of the object storage product, which increases the complexity of development and updates.
By deploying and running the target plug-in in the electronic device of the front-end application, the target plug-in includes the encapsulation API, and the encapsulation API encapsulates multiple object storage services to call interfaces, the front-end application can call different object storage services through the same target plug-in.
It reduces the development cost and update complexity of front-end applications, realizes that front-end applications seamlessly switch different object storage services, and improves the universality of applications.
Smart Images

Figure CN119577017B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of object storage technology, and in particular to an object storage service calling method, device, electronic device and storage medium. Background Art
[0002] In the development process of various application systems, a large number of technical components or products, including object storage, databases, reports, etc., are often used to achieve different technical goals. The general way of use is: the software system calls the interfaces of these components through code writing to integrate or access them. This method is to deeply bind the components with the application system, which is a tight coupling method. Taking the common component of object storage service as an example, by configuring the ACCESSKey ID (authentication identifier) and ACCESSKey Secret (private key) of a specific object storage product in the configuration file of the application system, the interface of the specific object storage product can be called to implement file upload, file download and other operations; if the upgrade of a specific object storage product causes the API to change, it is necessary to modify the program code of various application systems to adapt to the changes in technical components, which increases the complexity of application system development and update. Summary of the invention
[0003] The present application provides an object storage service calling method, device, electronic device and storage medium. The technical solution is as follows:
[0004] According to one aspect of the present application, a method for calling an object storage service is provided, the method being applied to an electronic device in which a target plug-in is running, the method comprising:
[0005] If the front-end application has a call demand for the target storage service, a target call request is sent to the target plug-in through the front-end application;
[0006] Receiving the target call request through the target plug-in, and verifying the target call request to obtain a verification result;
[0007] If the verification result indicates that the front-end application is allowed to call the target storage service, the target storage service is called through the encapsulation API in the target plug-in to perform the target call operation indicated by the target call request, and the encapsulation API encapsulates calling interfaces of multiple object storage services.
[0008] According to another aspect of the present application, an object storage service calling device is provided, the device is applied to an electronic device, a target plug-in is running in the electronic device, and the device includes:
[0009] A first sending module is used to send a target calling request to the target plug-in through the front-end application if the front-end application has a calling demand for the target storage service;
[0010] A first verification module, used for receiving the target call request through the target plug-in, and verifying the target call request to obtain a verification result;
[0011] A calling module is used to call the target storage service through the encapsulation API in the target plug-in to execute the target call operation indicated by the target call request if the verification result indicates that the front-end application is allowed to call the target storage service, and the encapsulation API encapsulates the calling interfaces of multiple object storage services.
[0012] According to one aspect of the present application, an electronic device is provided, including: a processor and a memory storing a program, wherein the program includes instructions, and when the instructions are executed by the processor, the processor executes the object storage service calling method as described above.
[0013] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the object storage service calling method as described above.
[0014] According to another aspect of the present application, a computer program product is provided, the computer program product including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the object storage service calling method.
[0015] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0016] By deploying and running a target plug-in in an electronic device or platform where a front-end application runs, the target plug-in includes an encapsulation API, which encapsulates calling interfaces of multiple object storage services. Multiple front-end applications in the electronic device can call various object storage services through the same target plug-in; this makes it unnecessary for the front-end application to configure relevant code to call the interface of a specific object storage service during the development process, and if the calling interface of the object storage service is upgraded, there is no need to change the application code of the front-end application, which can reduce the development cost and update complexity of the front-end application; in addition, since the application system calls the target plug-in (adaptation and encapsulation component), it only needs to call a set of SDK or API, and the encapsulation API in the target plug-in encapsulates calling interfaces of multiple object storage services. When the front-end application needs to switch to different object storage services according to scenario requirements, it only needs to modify the basic API information in the configuration, and basically no code needs to be modified in the front-end application, which can realize seamless switching of different object storage services for the front-end application, while improving the versatility of the front-end application and reducing the impact on the corresponding application code of the front-end application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Further details, features and advantages of the present application are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0018] Figure 1 It is a system architecture diagram provided by an embodiment of the present application;
[0019] Figure 2 A flowchart of an object storage service calling method according to an exemplary embodiment of the present application is shown;
[0020] Figure 3 A flowchart of another object storage service calling method according to an exemplary embodiment of the present application is shown;
[0021] Figure 4 It is a schematic diagram of the principle of a direct calling mode provided by an exemplary embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of the principle of a pre-signature calling mode provided by an exemplary embodiment of the present application;
[0023] Figure 6 A flowchart of another object storage service calling method according to an exemplary embodiment of the present application is shown;
[0024] Figure 7 It is an execution flow chart of a write data request in a pre-signature call mode provided by an exemplary embodiment of the present application;
[0025] Figure 8A flowchart of another object storage service calling method according to an exemplary embodiment of the present application is shown;
[0026] Fig. 9 It is an execution flow chart of a read data request in a pre-signature call mode provided by an exemplary embodiment of the present application;
[0027] Fig.10 A flowchart of another object storage service calling method according to an exemplary embodiment of the present application is shown;
[0028] Fig.11 It is an execution flow chart of a segment upload request in a pre-signed call mode provided by an exemplary embodiment of the present application;
[0029] Fig.12 It is a structural diagram of an object storage service calling device provided in an embodiment of the present application;
[0030] Fig.13 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present application is shown. DETAILED DESCRIPTION
[0031] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.
[0032] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0033] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units. It should be noted that the modifications of "one" and "multiple" mentioned in this application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more". The names of the messages or information exchanged between multiple devices in the embodiments of this application are only for illustrative purposes, and are not used to limit the scope of these messages or information.
[0034] The solution of the present invention is described below with reference to the accompanying drawings, and the technical solution provided by the embodiment of the present invention is explained in detail through specific embodiments and their application scenarios.
[0035] In the development process of various application systems, a large number of technical components or products, including object storage, databases, reports, etc., are often used to achieve different technical goals. The general usage method is: the software system calls the interfaces of these components through code writing to integrate or access them. This method is to deeply bind the components with the application system, which is a tight coupling method. Taking the common component of object storage service as an example, by configuring the ACCESSKey ID (authentication identifier) and ACCESSKey Secret (private key) of a specific object storage product in the configuration file of the application system, the file upload, file download and other operations can be implemented through calling the interface of the specific object storage product; if the upgrade of a specific object storage product causes the API to change, it is necessary to modify the program code of various application systems to adapt to the changes in technical components, which increases the complexity of updating the application system; moreover, in the process of application system development, developers are also required to understand the usage of various components in order to configure various component calling methods in the application system, which further increases the development cost and complexity of the application system.
[0036] In order to reduce the complexity of application system development and update, the embodiment of the present application encapsulates different components with similar functions through adaptation and encapsulation components, is backward compatible with multiple types of products, and is exposed upward as a set of SDK (Software Development Kit) or API (Application Programming Interface) components. The application system can directly call the encapsulated components without paying attention to the actual components used in the lower layer, thereby realizing a weak dependency relationship between the application system and the components, that is, decoupling. Figure 1 It is a system architecture diagram provided by an exemplary embodiment of the present application, which includes various application systems 110 (or various application programs), a target plug-in 120, a configuration database 130, and multiple object storage services 140. Among them, the target plug-in 120 includes a business control layer 121, a business middle platform 122, and an encapsulation API 123. The business control layer 121 is used to provide a full range of usage methods, including upload, download, batch operation, query, etc.; the business middle platform 122 is responsible for managing various configuration information, and can write various configuration information into the configuration database 130; the encapsulation API 123 encapsulates the calling interface of multiple object storage services 140, so that various application systems 110 can call multiple object storage services 140 through the encapsulation API 123 in the target plug-in 120.
[0037] Optionally, before various application systems 110 call multiple object storage services 140 through the target plug-in 120, authentication operations are required.
[0038] based on Figure 1 The system architecture diagram provided, this application embodiment provides an improved object storage service calling method. Please refer to Figure 2 , which shows a flowchart of an object storage service calling method according to an exemplary embodiment of the present application. Figure 1 The system architecture shown in the figure is used as an example to illustrate. Figure 2 As shown, the method includes:
[0039] Step 201: If the front-end application has a call demand for the target storage service, a target call request is sent to the target plug-in through the front-end application.
[0040] In order to reduce the development cost and update complexity of front-end applications, an embodiment of the present application provides a target plug-in, which includes an encapsulation API, and the encapsulation API encapsulates the calling interfaces of multiple object storage services. By deploying and running the target plug-in in the electronic device or platform where the front-end application runs, multiple front-end applications in the electronic device can call various object storage services through the same target plug-in; so that the front-end application does not need to configure relevant code to call the interface of a specific object storage service during the development process, and if the calling interface of the object storage service is upgraded, there is no need to change the application code of the front-end application, which can reduce the development cost and update complexity of the front-end application; in addition, since the application system calls the target plug-in (adaptation and encapsulation component), it only needs to call a set of SDK or API, and the encapsulation API in the target plug-in encapsulates the calling interfaces of multiple object storage services. When the front-end application needs to switch to different object storage services according to scenario requirements, it only needs to modify the basic API information in the configuration, and basically no code needs to be modified in the front-end application, which can realize the seamless switching of the front-end application to different object storage services, improve the versatility of the front-end application, and reduce the impact on the corresponding application code of the front-end application.
[0041] After the target plug-in is run in the electronic device, if the front-end application has a call demand for the target storage service, the front-end application can directly call the interface corresponding to the target plug-in to send a target call request to the target plug-in.
[0042] Exemplarily, the target call request may be a write data request, which may also be called a file (or data) upload request; or, the target call request may also be a read data request, which may also be called a file (or data) download request; or, the target call request may also be a fragment upload request. The specific target call request may be determined by the specific application scenario, and the embodiments of the present application do not specifically limit the target call request.
[0043] Step 202: receiving a target call request through the target plug-in, and verifying the target call request to obtain a verification result.
[0044] After the corresponding target plug-in receives the target call request sent by the front-end application, since the target plug-in is a common plug-in for multiple front-end applications, in order to avoid malicious calls to the target storage service by the front-end application, it will first verify the target call request to verify whether the front-end application has the authority to call the target storage service, and obtain the verification result. Among them, the verification result includes two types: having the authority and not having the authority.
[0045] Regarding the verification method, in one possible implementation, a permission relationship table is pre-stored in the target plug-in, and the permission relationship table stores the application identifiers of front-end applications that have calling permissions for various object storage services. After the target plug-in receives the target call request, the application identifier of the front-end application carried in the target call request can be matched with the permission relationship table. If the application identifier can be matched, it is determined that the front-end application has permission. If the application identifier is not matched, it is determined that the front-end application does not have permission.
[0046] Step 203, if the verification result indicates that the front-end application is allowed to call the target storage service, the target storage service is called through the encapsulation API in the target plug-in to perform the target call operation indicated by the target call request, and the encapsulation API encapsulates the call interfaces of multiple object storage services.
[0047] If the verification result is that the permission is granted, indicating that the front-end application is allowed to call the target service, the target storage service can be further called through the encapsulation API in the target plug-in to execute the target call operation indicated by the target call request. Specifically, the target storage service is called through the target call interface corresponding to the target storage service in the encapsulation API. Conversely, if the verification result is that the permission is not granted, indicating that the front-end application is not allowed to call the target service, a call failure message can be returned to the front-end application.
[0048] In summary, an embodiment of the present application provides an object storage service calling method: by deploying and running a target plug-in in an electronic device or platform where a front-end application runs, the target plug-in includes an encapsulation API, and the encapsulation API encapsulates a plurality of object storage service calling interfaces, and a plurality of front-end applications in the electronic device can all call various object storage services through the same target plug-in; so that the front-end application does not need to configure relevant code to call the interface of a specific object storage service during the development process, and if the calling interface of the object storage service is upgraded, there is no need to change the application code of the front-end application, which can reduce the development cost and update complexity of the front-end application; in addition, since the application system calls the target plug-in (adaptation and encapsulation component), it only needs to call a set of SDK or API, and the encapsulation API in the target plug-in encapsulates a plurality of object storage service calling interfaces. When the front-end application needs to switch to different object storage services according to scenario requirements, it only needs to modify the basic API information in the configuration, and basically no code needs to be modified in the front-end application, which can realize seamless switching of the front-end application to different object storage services, improve the versatility of the front-end application, and reduce the impact on the corresponding application code of the front-end application.
[0049] Since the target plug-in may need to be responsible for the call requests of multiple front-end applications, the target plug-in may be overloaded during operation. In order to avoid the excessive load affecting the operating performance of the target plug-in and further affecting the execution of the corresponding call requests of the front-end application, the embodiment of the present application also provides two call modes, a direct call mode and a pre-signed call mode, to avoid the need for all data indicated by the target call request to be forwarded through the target plug-in.
[0050] Please refer to Figure 3 , which shows a flowchart of another object storage service calling method according to an exemplary embodiment of the present application. Figure 1 The system architecture shown in the figure is used as an example to illustrate. Figure 3 As shown, the method includes: step 301, if the front-end application has a call demand for the target storage service, a target call request is sent to the target plug-in through the front-end application.
[0051] Step 302: receiving a target call request through the target plug-in, and verifying the target call request to obtain a verification result.
[0052] The implementation of step 301 and step 302 can refer to the above embodiment, and this embodiment will not be described in detail here.
[0053] Step 303: If the verification result indicates that the front-end application is allowed to call the target storage service, determine the target call mode corresponding to the target call request, and the target call mode is a direct call mode or a pre-signed call mode.
[0054] Among them, the target plug-in provides two calling modes: direct calling mode and pre-signed calling mode. In direct calling mode, the front-end application directly calls the object storage service through the encapsulated API in the target plug-in to perform the calling operation. Taking the calling request as a file upload request as an example, in direct calling mode, the front-end application directly calls the object storage service through the encapsulated API in the target plug-in and uploads the file; in pre-signed calling mode, the front-end application calls the object storage service through the encapsulated API in the target plug-in to obtain a pre-signed URL (Uniform Resource Locator). The subsequent front-end application can directly call the object storage service through the pre-signed URL to perform the calling operation. Taking the calling request as a file upload request as an example, in pre-signed calling mode, the front-end application calls the object storage service through the encapsulated API in the target plug-in. The object storage service returns a pre-signed URL to the front-end application through the encapsulated API. The front-end application can call the object storage service based on the pre-signed URL to upload the file. It can be seen that in direct calling mode, the files to be uploaded by the front-end application need to be uploaded through the target plug-in, while the files to be uploaded in pre-signed calling mode do not need to be uploaded through the target plug-in. The load of the target plug-in in pre-signed calling mode is relatively lower than the load of the target plug-in in direct calling mode.
[0055] If the verification result indicates that the front-end application is allowed to call the target storage service, the target call mode corresponding to the target call request can be further determined, and then different subsequent object storage service call processes can be executed according to different target call modes.
[0056] Regarding the method of determining the target calling mode, in one possible implementation, the target calling request carries a calling mode identifier, the direct calling mode corresponds to the first mode identifier, and the pre-signed calling mode corresponds to the second mode identifier, so that the target plug-in can determine whether the target calling mode is a direct calling mode or a pre-signed calling mode based on the calling mode identifier carried in the target calling request.
[0057] Optionally, the target plug-in can also automatically adjust which target call mode is used to execute the target call request. For example, the target plug-in can determine the target call mode of the target call request based on the current workload. Specifically, if the current workload is greater than a preset threshold, it means that the current target plug-in is under a large load. If the direct call mode is still used, it may affect the response speed of the target call request. In this case, the target call mode of the target call request is adjusted to the pre-signed call mode. On the contrary, if the current workload is less than the preset threshold, it means that the current target plug-in is under a small load. In order to reduce more request processes for front-end applications, the target call mode of the target call request can be adjusted to the direct call mode.
[0058] Step 304: If the target call mode is the direct call mode, the target storage service is called directly through the encapsulated API in the target plug-in to directly perform the target call operation.
[0059] If the target plug-in determines that the target call mode of the target call request is the direct call mode, the target storage service may be called directly through the encapsulation API in the target plug-in to perform the target call operation.
[0060] Taking the target call mode as direct call mode and the target call request as a write data request as an example, the write data request sent by the front-end application contains the target uploaded file to be written. The target storage service can be called directly through the encapsulation API in the target plug-in, and the target uploaded file can be written to the backend storage corresponding to the target storage service.
[0061] Taking the target call mode as direct call mode and the target call request as a read data request as an example, the encapsulation API in the target plug-in directly downloads and obtains the target download file from the backend storage corresponding to the target storage service, and then the target plug-in feeds the target download file back to the front-end application.
[0062] Taking the target call mode as direct call mode and the target call request as a batch upload request as an example, the front-end application divides the target file to be uploaded into multiple shard files, and sends the call request carrying the multiple shard files to the target plug-in, calls the target storage service through the encapsulation API in the target plug-in, and uploads the multiple shard files to the back-end storage corresponding to the target storage service.
[0063] For example, Figure 4 As shown, it is a schematic diagram of the principle of a direct calling mode provided by an exemplary embodiment of the present application. Figure 4 As shown, in the direct call mode, if the front-end application 111 has the need to write the target uploaded file to the target storage service 141, the front-end application 111 sends a write data request to the target plug-in 120, and the write data request carries the target uploaded file. After receiving the write data request, the target plug-in 120 calls the target storage service 141 through the encapsulation API 123 to directly write the target uploaded file to the storage layer corresponding to the target storage service 141; if the front-end application 111 has the need to download files from the target storage service 141, the front-end application 111 sends a read data request to the target plug-in 120. After receiving the read data request, the target plug-in 120 calls the target storage service 141 through the encapsulation API 123 to download the target download file.
[0064] Step 305, if the target call mode is the pre-signed call mode, call the target storage service through the encapsulated API in the target plug-in to obtain the target pre-signed URL; and feed back the target pre-signed URL to the front-end application through the target plug-in, and the front-end application uses the target pre-signed URL to call the target storage service to perform the target call operation.
[0065] If the target plug-in determines that the target call mode of the target call request is the pre-signed call mode, it first calls the target storage service through the encapsulation API in the target plug-in to obtain the target pre-signed URL. The target pre-signed URL can directly locate the target storage service. After the target plug-in obtains the target pre-signed URL, the target plug-in can feedback the target pre-signed URL to the front-end application. The front-end application can directly call the target storage service based on the target pre-signed URL to perform the target call operation.
[0066] Taking the target call request as a read data request as an example, after calling the target storage service through the encapsulated API in the target plug-in to obtain the read pre-signed URL, the read pre-signed URL is fed back to the front-end application. The front-end application can directly locate the target storage service according to the read pre-signed URL to directly download the target file or data from the target storage service. The target file or data does not need to be transmitted through the target plug-in, which can reduce the usage of the target plug-in's running memory and reduce its workload.
[0067] For example, Figure 5 As shown, it is a schematic diagram of the principle of a pre-signature calling mode provided by the exemplary embodiment of the present application. Figure 5 As shown, in the pre-signed mode, if the front-end application 111 has a call demand for the target storage service 141, the front-end application 111 can send a target call request to the target plug-in 120, and call the target storage service 141 through the encapsulation API 123 in the target plug-in 120. The target storage service 141 feeds back the target pre-signed URL to the front-end application 111 through the encapsulation API 123. After receiving the target pre-signed URL, the front-end application 111 calls the target storage service 141 to perform the target call operation.
[0068] In this embodiment, the target plug-in provides two calling modes, allowing the front-end application to implement specific calling operations through a direct calling mode or a pre-signed calling mode to meet the different calling requirements of the front-end application; in addition, the target plug-in can also evenly distribute its own workload through different calling modes to avoid excessive load and thus affect the response speed of the call request.
[0069] Similar to the direct call mode, the pre-signed call mode also includes at least requests such as write data request, read data request, batch upload request, etc. There are differences in the specific call processes corresponding to various call requests. The following embodiments respectively describe in detail the specific call processes of the above three call requests.
[0070] Please refer to Figure 6 , which shows a flowchart of another object storage service calling method according to an exemplary embodiment of the present application. Figure 1 The system architecture shown in the figure is used as an example to illustrate. Figure 6 As shown, the method includes:
[0071] Step 601: If the front-end application has a call demand for the target storage service, a target call request is sent to the target plug-in through the front-end application.
[0072] In addition to the encapsulated API, the target plug-in also includes a business control layer and a business middle platform. If the front-end application has a call demand for the target storage service, the front-end application sends a target call request to the target plug-in, specifically, the front-end application sends a target call request to the business control layer in the target plug-in.
[0073] Taking the target call request as a write data request as an example, when the front-end user initiates a write object operation (or write data operation), the front-end application sends a write data request to the business control layer of the target plug-in.
[0074] Step 602: receiving a target call request through the target plug-in, and verifying the target call request to obtain a verification result.
[0075] Specifically, the target call request is received through the business control layer in the target plug-in, and the target call request is verified to obtain a verification result.
[0076] Taking the target call request as a write data request as an example, the business control layer in the target plug-in receives the write data request. Optionally, after receiving the write data request, the business control layer will also call the business middle station to record the task status corresponding to the write data request as "not uploaded status"; and after receiving the write data request, the business middle station will also allocate resource information for the target upload file to be uploaded indicated by the write data request (the resource information is used to indicate the storage location of the target upload file after it is uploaded to the target storage service).
[0077] Step 603: If the verification result indicates that the front-end application is allowed to call the target storage service, determine the target call mode corresponding to the target call request.
[0078] The implementation of step 603 may refer to the above embodiment, and will not be described in detail in this embodiment.
[0079] Step 604: If the target calling mode is the pre-signed calling mode and the target calling request is a write data request, call the target storage service through the encapsulation API in the target plug-in to obtain the first pre-signed URL.
[0080] If the target calling mode is the pre-signed calling mode, and the target calling request is a write data request, the business control layer sends the write data request (the write data request also carries the resource information fed back to the business control layer by the business middle station) to the encapsulation API to call the target storage service through the encapsulation API, and the target storage service assigns a first pre-signed URL to the write data request.
[0081] Step 605: Feedback the first pre-signed URL to the front-end application through the target plug-in.
[0082] After the business control layer of the target plug-in receives the first pre-signed URL through the encapsulation API, the first pre-signed URL can be fed back to the front-end application through the business control layer.
[0083] Step 606: Upload the target upload file to the target storage service using the first pre-signed URL through the front-end application.
[0084] After the front-end application receives the first pre-signed URL, the first pre-signed URL can locate the specific target storage location in the target storage service, so that the front-end application can use the first pre-signed URL to upload the target upload file to the target storage service and write it to the storage layer corresponding to the target storage service.
[0085] Step 607: Receive a first verification value sent by the target storage service through the front-end application. The first verification value is generated after the target storage service completes the write operation of the target uploaded file.
[0086] If the target storage service completes the write operation of the target uploaded file, it can directly feedback the operation success information to the front-end application; in addition, in order to ensure that there are errors in the upload process of the target uploaded file, after the target storage service determines that the target uploaded file has been written to the storage layer, it will generate a first verification value based on the stored target uploaded file, and send the first verification value to the front-end application; that is, after the target storage service completes the write operation of the target uploaded file, it will feedback the operation success information and the first verification value to the front-end application.
[0087] Step 608: Perform a file integrity check based on the first check value through the front-end application.
[0088] The front-end application itself stores the target verification value corresponding to the target uploaded file. After the front-end application receives the operation success information and the first verification value, it can compare the first verification value and the target verification value to perform a file integrity check; if the first verification value and the target verification value are the same, it is determined that the target uploaded file is correctly uploaded to the target storage service and passes the file integrity check; if the first verification value and the target verification value are different, it is determined that the target uploaded file is incorrectly uploaded to the target storage service and fails to pass the file integrity check.
[0089] Optionally, both the first check value and the target check value may be generated by a hash algorithm.
[0090] Step 609: When the file integrity check passes, the target plug-in is notified through the front-end application that the task status of the data writing request is completed.
[0091] If the file integrity check passes, it is determined that the write data request has been executed. The corresponding front-end application can send a completion notification to the business control layer of the target plug-in, and the business control layer calls the business middle platform to update the task status of the write data request to completed; after the task status is updated, the business middle platform returns the update result (successful or not) to the business control layer, and the corresponding business control layer returns the final write data operation result to the front-end application.
[0092] Figure 7 This is an execution flow chart of a write data request in a pre-signed call mode provided by an exemplary embodiment of the present application, that is, a file upload process. Figure 7As shown, the process includes: (1) The front-end user initiates the write object operation. The user clicks the submit button or other triggering events on the application interface of the front-end application to initiate the write object operation. After receiving the write object operation, the front-end application initiates a write object request to the business control layer (the write object request is the write data request in this embodiment). (2) After receiving the write object request, the business control layer calls the API for writing data to the business middle station, and the object status is "not uploaded" (that is, the task completion status corresponding to the write object request added at the business middle station is not completed or not uploaded). (3) The business middle station responds. After receiving the write data request from the business control layer, the business middle station executes the corresponding business logic. After processing the request, the business middle station returns the result to the business control layer, and the return result includes the allocated resource information. (4) The business control layer forwards the response. The business control layer will obtain the pre-signed URL by encapsulating the API call storage (target storage service). The target storage service returns the pre-signed URL to the business control layer, and the corresponding business control layer forwards the pre-signed URL to the front-end application. (5) The front-end application receives the response. The front-end application receives the pre-signed URL returned by the business control layer. (6) The front-end application sends a direct write object request to the target storage service using a pre-signed URL. The pre-signed URL can be used to directly write data to the storage layer of the target storage service. (7) The storage layer operation corresponding to the target storage service. When the front-end application directly writes data to the storage layer, the storage layer will perform the actual write operation. After the storage layer operation is completed, it may return confirmation information such as successful operation and verification value to the front-end application. (8) The front-end application sends a completion object request (completion notification) to the business control layer. After the data is successfully written to the storage layer, the front-end application performs a file integrity check on the data. After the file integrity check passes, it sends a completion notification to the business control layer. (9) The business control layer marks the status. After receiving the completion notification sent by the front-end application, the business control layer calls the business middle platform to update the status of the write data request to completed. (10) The business middle platform responds again. After receiving the completion notification sent by the business control layer, the business middle platform performs the corresponding status update, that is, updates the object status from unfinished to completed. (11) The business control layer returns the final result. The business control layer returns the final operation result (such as success or failure) to the front-end application. (12) The front-end application displays the final result. After the front-end application receives the final result returned by the control layer, the final result of the successful operation can be displayed on the interface of the front-end application.
[0093] In this embodiment, the purpose of uploading files to the target storage service through the pre-signed URL is achieved by the interaction between the business control layer, the business middle platform and the encapsulation API in the target plug-in; moreover, the business middle platform can retain the record of the front-end application calling the target storage service through the target plug-in by updating the task status; in addition, the successful upload of the target uploaded file can also be ensured through the file integrity verification operation.
[0094] Please refer to Figure 8 , which shows a flowchart of another object storage service calling method according to an exemplary embodiment of the present application. Figure 1 The system architecture shown in the figure is used as an example to illustrate. Figure 8 As shown, the method includes:
[0095] Step 801: If the front-end application has a call demand for the target storage service, a target call request is sent to the target plug-in through the front-end application.
[0096] Taking the target call request as a write data request as an example, when the front-end user initiates a read object operation (or a download data operation), the front-end application sends a read data request to the business control layer of the target plug-in.
[0097] Step 802: receiving a target call request through the target plug-in, and verifying the target call request to obtain a verification result.
[0098] Taking the target call request as a write data request as an example, the business control layer in the target plug-in receives the write data request. Optionally, after receiving the read data request, the business middle station will also determine the object storage information corresponding to the target download file to be downloaded or read indicated by the read data request (the object storage information is used to indicate the storage location of the target download file in the storage layer corresponding to the target storage service).
[0099] Step 803: If the verification result indicates that the front-end application is allowed to call the target storage service, determine the target call mode corresponding to the target call request.
[0100] The implementation of step 803 may refer to the above embodiment, and this embodiment will not be described in detail here.
[0101] Step 804: If the target calling mode is the pre-signed calling mode and the target calling request is a read data request, call the target storage service through the encapsulation API in the target plug-in to obtain a second pre-signed URL.
[0102] If the target calling mode is the pre-signed calling mode, and the target calling request is a read data request, the business control layer sends the read data request (the read data request also carries the object storage information fed back to the business control layer by the business middle station) to the encapsulation API to call the target storage service through the encapsulation API, and the target storage service assigns a second pre-signed URL to the read data request.
[0103] Step 805: Feedback the second pre-signed URL to the front-end application through the target plug-in.
[0104] After the business control layer of the target plug-in receives the second pre-signed URL through the encapsulation API, the second pre-signed URL can be fed back to the front-end application through the business control layer.
[0105] Step 806: Obtain the target download file from the target storage service using the second pre-signed URL through the front-end application.
[0106] After the front-end application receives the second pre-signed URL, the second pre-signed URL can locate the specific target storage location in the target storage service, so that the front-end application can use the second pre-signed URL to call the specific storage location of the target storage service, and download and obtain the target download file from it.
[0107] Optionally, if the target download file is successfully read, the target storage service will send an operation completion notification to the front-end application, and the corresponding front-end application determines that the data read request has been completed.
[0108] Optionally, in order to avoid errors in the transmission of the target downloaded file, the target storage service, in addition to downloading the target downloaded file, will also carry a target verification value corresponding to the target downloaded file. After receiving the target downloaded file, the front-end application generates a third verification value based on the target downloaded file, and compares whether the third verification value is the same as the target verification value to perform a file integrity check on the target downloaded file. If the target downloaded file passes the file integrity check, the front-end application determines that the read data request has been completed.
[0109] Fig. 9 This is an execution flow chart of a read data request in a pre-signed call mode provided by an exemplary embodiment of the present application. That is, the file download process. Fig. 9As shown, the process includes: (1) The user initiates a read object operation. The user of the front-end application will initiate a read object operation. After the corresponding front-end application receives the read object operation, it can send a read object request to the business control layer (the read object request is the read data request in this embodiment). (2) The business control layer processes the read object request. The business control layer receives the read object request sent by the front-end application. (3) The business control layer calls the read data to the business middle platform. The business control layer will call the read data function of the business middle platform to obtain the object storage information. (4) The business middle platform returns the result. (5) The business control layer obtains the pre-signed URL by encapsulating the API call to the storage layer corresponding to the target storage service. (6) The storage layer returns the pre-signed URL to the business control layer. The storage layer responds to the encapsulated API call of the business control layer and returns the pre-signed URL to it. (7) The front-end application receives the pre-signed URL: The business control layer returns the pre-signed URL to the front-end application, and the corresponding front-end application receives the pre-signed URL returned by the storage layer. (8) The front-end application sends a request to obtain the object directly from the storage layer through the pre-signed URL, so that the front-end can use the obtained pre-signed URL to directly read the object from the storage layer. (9) The storage layer operation is successful. When the operation of directly reading the object is successful, the storage layer will send a notification to the front-end application to indicate that the operation is successful. (10) The result is returned. The front-end application receives a message that the operation is successful and returns the result.
[0110] In this embodiment, the purpose of downloading files from the target storage service through the pre-signed URL is achieved through the interaction between the business control layer, the business middle platform and the encapsulation API in the target plug-in.
[0111] Please refer to Fig.10 , which shows a flowchart of another object storage service calling method according to an exemplary embodiment of the present application. Figure 1 The system architecture shown in the figure is used as an example to illustrate. Fig.10 As shown, the method includes:
[0112] Step 1001: If the front-end application has a call demand for a target storage service, a target call request is sent to a target plug-in through the front-end application.
[0113] Taking the target call request as a multi-slice upload request as an example, the front-end application will divide the file to be uploaded into multiple multi-slice files before initiating the multi-slice upload request, and generate multi-slice information such as the file name corresponding to each multi-slice file; after the front-end user initiates the multi-slice upload operation, the front-end application sends a multi-slice upload request to the business control layer of the target plug-in, and the multi-slice upload request includes the multi-slice information.
[0114] Step 1002: receiving a target call request through the target plug-in, and verifying the target call request to obtain a verification result.
[0115] Taking the target call request as a multi-slice upload request as an example, the business control layer in the target plug-in receives the multi-slice upload request. Optionally, after receiving the multi-slice upload request, the business control layer will also call the business middle station to record the task status corresponding to the multi-slice upload request as "not uploaded status"; and after receiving the multi-slice upload request, the business middle station will also allocate resource information for each multi-slice file to be uploaded indicated by the multi-slice upload request (the resource information is used to indicate the storage location of each multi-slice file after it is uploaded to the target storage service), and different multi-slice files can correspond to different resource information.
[0116] Step 1003: If the verification result indicates that the front-end application is allowed to call the target storage service, determine the target call mode corresponding to the target call request.
[0117] The implementation of step 1003 may refer to the above embodiment, and will not be described in detail in this embodiment.
[0118] Step 1004: If the target calling mode is the pre-signed calling mode, and the target calling request is a multi-segment upload request, call the target storage service through the encapsulation API in the target plug-in to obtain multiple third pre-signed URLs.
[0119] If the target calling mode is the pre-signed calling mode, and the target calling request is a multi-slice upload request, the business control layer sends the multi-slice upload request (the multi-slice upload request also carries the resource information fed back to the business control layer by the business middle station) to the encapsulation API to call the target storage service through the encapsulation API. The target storage service allocates a third pre-signed URL for the multi-slice upload request. Since different multi-slice files have different storage locations, different multi-slice files have different third pre-signed URLs.
[0120] Step 1005: Feedback the plurality of third pre-signed URLs to the front-end application through the target plug-in.
[0121] After the business control layer of the target plug-in receives the multiple third pre-signed URLs through the encapsulation API, the multiple third pre-signed URLs can be fed back to the front-end application through the business control layer.
[0122] Step 1006: Upload the multiple segment files to the target storage service using multiple third pre-signed URLs through the front-end application.
[0123] After the front-end application receives multiple third pre-signed URLs, the multiple third pre-signed URLs can locate the specific target storage location of each shard file in the target storage service, so that the front-end application can use each third pre-signed URL to upload its corresponding shard file to the target storage service respectively, and write it into the storage layer corresponding to the target storage service.
[0124] Step 1007: If the upload operation completion information fed back by the target storage service is received, a segment upload completion request is sent to the target plug-in through the front-end application.
[0125] During the multi-slice upload process, considering the large amount of data in the file to be uploaded, it is divided into multiple multi-slice files for uploading. After the multiple multi-slice files are uploaded to the storage layer corresponding to the target storage service, the multiple multi-slice files need to be restored to the complete uploaded file. If the front-end application receives the upload operation completion information fed back by the target storage service, the front-end application can send a multi-slice upload completion request to the target plug-in. After receiving the multi-slice upload completion request, the corresponding target plug-in can continue to perform the multi-slice merge operation.
[0126] Step 1008: Control the target storage service through the target plug-in to merge multiple fragment files.
[0127] After receiving the upload operation completion information sent by the front-end application, the target plug-in can control the target storage service to perform the merge operation of multiple shard files through the encapsulation API.
[0128] In an illustrative example, step 1008 may also include steps 1008A to 1008D.
[0129] Step 1008A, calling the target storage service through the merge interface in the target plug-in to merge multiple shard files, and the merge interface is encapsulated in the encapsulation API.
[0130] Among them, in addition to encapsulating the calling interfaces of various object storage services, the encapsulation API also encapsulates the merging interfaces of various object storage services. Correspondingly, the target storage service can be called through the merging interface corresponding to the target storage service in the target plug-in to merge multiple shard files.
[0131] Step 1008B: Receive, through the target plug-in, the second check value corresponding to each shard file fed back by the target storage service.
[0132] After completing the merging operation of multiple shard files, the target storage service will also feedback the second verification value corresponding to each shard file to the target plug-in. After receiving the second verification value, the corresponding target plug-in can perform file integrity verification on the shard file based on the second verification value.
[0133] Step 1008C: Perform a file integrity check on the segment file based on the second check value through the target plug-in.
[0134] Among them, the segment upload completion request sent by the front-end application to the target plug-in carries the target verification value corresponding to each segment file, so that the business control layer in the target plug-in can perform file integrity verification on the segment file by comparing the second verification value and the target verification value.
[0135] Step 1008D: When the file integrity check passes, the task status of the segment upload request is updated to completed through the target plug-in.
[0136] If the file integrity check passes, it is determined that the segmented file has been successfully uploaded. The business control layer in the target plug-in can call the business middle platform to update the task status of the segmented upload request and update it to completed. After the task status is updated, the business middle platform returns the update result (successful or not) to the business control layer, and the corresponding business control layer returns the final segmented file upload operation result to the front-end application.
[0137] Fig.11 1 is a flowchart of executing a multi-slice upload request in a pre-signed call mode provided by an exemplary embodiment of the present application. Fig.11As shown in the figure, the process includes: (1) front-end application operation, the user initiates the operation of uploading the object in slices, including the slice information. After receiving the operation of uploading the object in slices, the front-end application sends a request for uploading the object in slices to the business control layer. (2) Business control layer processing: the business control layer receives the request for uploading the object in slices and sends the request for uploading the object in slices to the business middle station. (3) The business control layer calls the write data to the business middle station, the status is marked as not uploaded, the write data operation is performed in the business middle station, and the status is marked as "not uploaded". (4) Business middle station response: return the result, including the allocated resource information, the business middle station returns the operation result and informs the business control layer of the allocated resource information. (5) The business control layer obtains the pre-signed URL of each slice by calling the storage layer of the target storage service through the encapsulation API. The business middle station obtains the pre-signed URL of each slice by calling the storage service through the encapsulation API. (6) The front-end application receives the information and performs the operation. The front-end application receives the pre-signed URL of each slice. (7) The front-end application directly writes the object request to the storage layer through the pre-signed URL. The front-end application uses the pre-signed URL to directly send the write object request to the storage layer. (8) Storage layer operation: The operation is successful, and the storage layer confirms that the request is successful. (9) The front-end application sends the completion object request to the business control layer again, where the object id and the etag (entity tag) of each shard are required. (10) The business control layer calls the merge interface to merge the shards. The business control layer coordinates the operation of merging shards. Verify the shard etag and the etag returned by the merge interface to ensure the integrity of the data (that is, perform shard integrity verification). (11) The business middle station finally confirms: call to write data to the business middle station, and the status is marked as completed. After completing the merge of shards, the business middle station calls the write data operation and updates the status mark to "completed". (12) The front end receives the final result: returns the result. The business control layer returns the final result to the front-end application, indicating that the entire operation is successfully completed.
[0138] In this embodiment, the purpose of uploading files to the target storage service through the pre-signed URL is achieved through the interaction between the business control layer, the business middle platform and the encapsulation API in the target plug-in; moreover, the business middle platform can retain the record of the front-end application calling the target storage service through the target plug-in by updating the task status; in addition, the successful upload of the segmented file can also be guaranteed through the file integrity verification operation.
[0139] In other possible application scenarios, since the encapsulated API encapsulates APIs corresponding to multiple object storage services, if permissions permit, the front-end application can switch to different object storage services according to the requirements of different scenarios without updating the application code of the front-end application itself. It is only necessary to configure the application permissions of the front-end application at the business middle station of the target plug-in.
[0140] Optionally, if the permissions allow, the target plug-in can also dynamically adjust the target storage service called by the front-end application according to the task load of each object storage service. For example, if the front-end application has the calling permissions for object storage service 1 and object storage service 2, the target plug-in can compare the current task loads of object storage service 1 and object storage service 2, and use the object storage service 1 and object storage service 2 with the smallest current task load as the target storage service, so as to call the target storage service through the encapsulated API to perform the target call operation, so as to shorten the response time of the target call request.
[0141] Please refer to Fig.12 , which is a schematic diagram of the structure of an object storage service calling device provided in an embodiment of the present application. The device is applied to an electronic device, and a target plug-in is running in the electronic device. For example, Fig.12 As shown, the device 1200 includes:
[0142] The first sending module 1201 is used to send a target calling request to the target plug-in through the front-end application if the front-end application has a calling demand for the target storage service;
[0143] A first verification module 1202 is used to receive the target call request through the target plug-in, and verify the target call request to obtain a verification result;
[0144] The calling module 1203 is used to call the target storage service through the encapsulation API in the target plug-in to execute the target call operation indicated by the target call request if the verification result indicates that the front-end application is allowed to call the target storage service, and the encapsulation API encapsulates the calling interfaces of multiple object storage services.
[0145] Optionally, the calling module 1203 is further used to:
[0146] Determine a target call mode corresponding to the target call request, where the target call mode is a direct call mode or a pre-signed call mode;
[0147] If the target call mode is the direct call mode, the target call operation is directly performed by calling the target storage service through the encapsulation API in the target plug-in;
[0148] If the target call mode is the pre-signed call mode, the target storage service is called through the encapsulated API in the target plug-in to obtain the target pre-signed URL; and the target pre-signed URL is fed back to the front-end application through the target plug-in, and the front-end application uses the target pre-signed URL to call the target storage service to perform the target call operation.
[0149] Optionally, the calling module 1203 is further used to:
[0150] If the target call mode is the direct call mode, and the target call request is a write data request, the target uploaded file is written into the target storage service through the encapsulation API in the target plug-in, and the write data request includes the target uploaded file;
[0151] If the target call mode is the direct call mode, and the target call request is a read data request, the target download file is obtained from the target storage service through the encapsulation API in the target plug-in; and the target download file is fed back to the front-end application through the target plug-in.
[0152] Optionally, the calling module 1203 is further used to:
[0153] If the target call mode is the pre-signed call mode, and the target call request is a write data request, calling the target storage service through the encapsulation API in the target plug-in to obtain a first pre-signed URL;
[0154] The device also includes:
[0155] A first uploading module, configured to upload the target upload file to the target storage service using the first pre-signed URL through the front-end application;
[0156] A receiving module, configured to receive, through the front-end application, a first check value sent by the target storage service, wherein the first check value is generated after the target storage service completes a write operation on the target uploaded file;
[0157] A second verification module, configured to perform file integrity verification based on the first verification value through the front-end application;
[0158] The notification module is used to notify the target plug-in through the front-end application that the task status of the write data request is completed when the file integrity check passes.
[0159] Optionally, the calling module 1203 is further used to:
[0160] If the target call mode is the pre-signed call mode, and the target call request is a read data request, calling the target storage service through the encapsulation API in the target plug-in to obtain a second pre-signed URL;
[0161] The device also includes:
[0162] An acquisition module is used to acquire a target download file from the target storage service using the second pre-signed URL through the front-end application.
[0163] Optionally, the calling module 1203 is further used to:
[0164] If the target call mode is the pre-signed call mode, and the target call request is a multi-slice upload request, the target storage service is called through the encapsulation API in the target plug-in to obtain multiple third pre-signed URLs, wherein the file to be uploaded is divided into different multi-slice files, and different multi-slice files correspond to different third pre-signed URLs;
[0165] The device also includes:
[0166] A second uploading module is used to upload the plurality of segment files to the target storage service by using the plurality of third pre-signed URLs through the front-end application;
[0167] A second sending module is configured to send a shard upload completion request to the target plug-in through the front-end application upon receiving upload operation completion information fed back by the target storage service;
[0168] A merging module is used to control the target storage service to merge the multiple fragment files through the target plug-in.
[0169] Optionally, the merging module is further used for:
[0170] Calling the target storage service to merge the plurality of the shard files through a merge interface in the target plug-in, wherein the merge interface is encapsulated in the encapsulation API;
[0171] Receive, through the target plug-in, a second checksum corresponding to each of the shard files fed back by the target storage service;
[0172] Performing a file integrity check on the segment file based on the second check value by the target plug-in;
[0173] When the file integrity check passes, the task status of the segment upload request is updated to completed through the target plug-in.
[0174] The exemplary embodiment of the present application also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to cause the electronic device to perform the method according to the embodiment of the present application when executed by the at least one processor.
[0175] The exemplary embodiment of the present application further provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present application.
[0176] The exemplary embodiments of the present application further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, it is used to enable the computer to execute the method according to the embodiment of the present application.
[0177] refer to Fig.13 , the structural block diagram of the electronic device 1300 that can be used as the server or client of the present application will now be described, which is an example of a hardware device that can be applied to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computer equipment, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples, and are not intended to limit the implementation of the present application described and / or required herein.
[0178] like Fig.13 As shown, the electronic device 1300 includes a computing unit 1301, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1302 or a computer program loaded from a storage unit 1308 into a random access memory (RAM) 1303. In the RAM 1303, various programs and data required for the operation of the device 1300 can also be stored. The computing unit 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 the bus 1304.
[0179] Multiple components in the electronic device 1300 are connected to the I / O interface 1305, including: an input unit 1306, an output unit 1307, a storage unit 1308, and a communication unit 1309. The input unit 1306 can be any type of device that can input information to the electronic device 1300, and the input unit 1306 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device. The output unit 1307 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1308 can include but is not limited to a disk, an optical disk. The communication unit 1309 allows the electronic device 1300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0180] The computing unit 1301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1301 performs the various methods and processes described above. For example, in some embodiments, Figure 2 , Figure 3 , Figure 6 , Figure 8 , Fig.10 The method shown may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 1308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1300 via the ROM 1302 and / or the communication unit 1309. In some embodiments, the computing unit 1301 may be configured to execute the computer program by any other suitable means (e.g., by means of firmware). Figure 2 , Figure 3 , Figure 6 , Figure 8 , Fig.10 The method shown.
[0181] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0182] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0183] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0184] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0185] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by 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), and the Internet.
[0186] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
Claims
1. A method for calling an object storage service, characterized in that: The method is applied to an electronic device, in which a target plug-in is running, and multiple front-end applications in the electronic device all call various object storage services through the same target plug-in, and the target plug-in includes a business control layer, a business middle platform and an encapsulation API, and the method includes: If the front-end application has a call demand for the target storage service, a target call request is sent to the business control layer in the target plug-in through the front-end application; Receiving the target call request through the business control layer in the target plug-in, and verifying the target call request to verify whether the front-end application has the authority to call the target storage service, and obtaining a verification result; Calling the business middle platform through the business control layer to record the task status corresponding to the target call request; Allocate resource information or object storage information for the target call request through the business middle station, and feed back the resource information or the object storage information to the business control layer. If the target call request is a write data request, the business middle station allocates the resource information for the target call request. If the target call request is a read data request, the business middle station allocates the object storage information for the target call request. If the verification result indicates that the front-end application is allowed to call the target storage service, the target call request carrying the resource information or the object storage information is sent to the encapsulation API through the business control layer; The target storage service is called through the encapsulation API in the target plug-in to perform the target call operation indicated by the target call request, wherein the encapsulation API encapsulates the call interfaces of multiple object storage services; wherein, when the front-end application has call permissions for multiple object storage services, the target plug-in selects the object storage service with the smallest current task load as the target storage service according to the current task loads of the multiple object storage services, so as to call the target storage service through the encapsulation API to perform the target call operation; After the target call request is executed, a completion notification is sent to the business control layer through the front-end application; Calling the business middle station through the business control layer to update the task status of the target call request to completed; The step of calling the target storage service through the encapsulated API in the target plug-in to execute the target call operation indicated by the target call request includes: Determine a target call mode corresponding to the target call request, wherein the target call mode is a direct call mode or a pre-signed call mode, and the target call mode is determined by a current workload of the target plug-in; If the target call mode is the direct call mode, the target call operation is directly performed by calling the target storage service through the encapsulation API in the target plug-in; If the target call mode is the pre-signed call mode, the target storage service is called through the encapsulated API in the target plug-in to obtain the target pre-signed URL; and the target pre-signed URL is fed back to the front-end application through the target plug-in, and the front-end application uses the target pre-signed URL to call the target storage service to perform the target call operation.
2. The method according to claim 1, characterized in that: If the target call mode is the direct call mode, calling the target storage service directly through the encapsulation API in the target plug-in to perform the target call operation includes: If the target call mode is the direct call mode, and the target call request is a write data request, the target uploaded file is written into the target storage service through the encapsulation API in the target plug-in, and the write data request includes the target uploaded file; If the target call mode is the direct call mode, and the target call request is a read data request, the target download file is obtained from the target storage service through the encapsulation API in the target plug-in; and the target download file is fed back to the front-end application through the target plug-in.
3. The method according to claim 1, characterized in that If the target call mode is the pre-signed call mode, calling the target storage service through the encapsulation API in the target plug-in to obtain the target pre-signed URL includes: If the target call mode is the pre-signed call mode, and the target call request is a write data request, calling the target storage service through the encapsulation API in the target plug-in to obtain a first pre-signed URL; The method further comprises: Uploading the target upload file to the target storage service using the first pre-signed URL through the front-end application; Receiving, through the front-end application, a first check value issued by the target storage service, where the first check value is generated after the target storage service completes a write operation on the target uploaded file; Performing a file integrity check based on the first check value by the front-end application; When the file integrity check passes, the target plug-in is notified through the front-end application that the task status of the write data request is completed.
4. The method according to claim 1, characterized in that: If the target call mode is the pre-signed call mode, calling the target storage service through the encapsulation API in the target plug-in to obtain the target pre-signed URL includes: If the target call mode is the pre-signed call mode, and the target call request is a read data request, calling the target storage service through the encapsulation API in the target plug-in to obtain a second pre-signed URL; The method further comprises: The target download file is obtained from the target storage service using the second pre-signed URL through the front-end application.
5. The method according to claim 1, characterized in that If the target call mode is the pre-signed call mode, calling the target storage service through the encapsulation API in the target plug-in to obtain the target pre-signed URL includes: If the target call mode is the pre-signed call mode, and the target call request is a multi-slice upload request, the target storage service is called through the encapsulation API in the target plug-in to obtain multiple third pre-signed URLs, wherein the file to be uploaded is divided into different multi-slice files, and different multi-slice files correspond to different third pre-signed URLs; The method further comprises: Uploading the plurality of segment files to the target storage service by using the plurality of third pre-signed URLs through the front-end application; If the upload operation completion information fed back by the target storage service is received, a segment upload completion request is sent to the target plug-in through the front-end application; The target storage service is controlled by the target plug-in to merge the plurality of slice files.
6. The method according to claim 5, characterized in that The step of controlling the target storage service to merge the plurality of slice files by the target plug-in includes: Calling the target storage service to merge the plurality of the shard files through a merge interface in the target plug-in, wherein the merge interface is encapsulated in the encapsulation API; Receive, through the target plug-in, a second checksum corresponding to each of the shard files fed back by the target storage service; Performing a file integrity check on the segment file based on the second check value by the target plug-in; When the file integrity check passes, the task status of the segment upload request is updated to completed through the target plug-in.
7. An object storage service calling device, characterized in that: The device is applied to an electronic device, a target plug-in is running in the electronic device, and multiple front-end applications in the electronic device all call various object storage services through the same target plug-in. The target plug-in includes a business control layer, a business middle platform and an encapsulation API. The device includes: A first sending module is used to send a target call request to the business control layer in the target plug-in through the front-end application if the front-end application has a call demand for the target storage service; The first verification module is used to receive the target call request through the business control layer in the target plug-in, and verify the target call request to verify whether the front-end application has the authority to call the target storage service to obtain a verification result; call the business middle station through the business control layer to record the task status corresponding to the target call request; allocate resource information or object storage information to the target call request through the business middle station, and feed back the resource information or the object storage information to the business control layer. If the target call request is a write data request, the business middle station allocates the resource information to the target call request; if the target call request is a read data request, the business middle station allocates the object storage information to the target call request; A calling module, for sending the target calling request carrying the resource information or the object storage information to the encapsulation API through the business control layer if the verification result indicates that the front-end application is allowed to call the target storage service; calling the target storage service through the encapsulation API in the target plug-in to perform the target calling operation indicated by the target calling request, wherein the encapsulation API encapsulates calling interfaces of multiple object storage services; wherein, in the case that the front-end application has calling authority for multiple object storage services, the target plug-in selects the object storage service with the smallest current task load as the target storage service according to the current task load of multiple object storage services, so as to call the target storage service through the encapsulation API to perform the target calling operation; after the execution of the target calling request is completed, sending a completion notification to the business control layer through the front-end application; and calling the business middle station through the business control layer to update the task status of the target calling request to completed; The calling module is also used to: determine a target calling mode corresponding to the target calling request, where the target calling mode is a direct calling mode or a pre-signed calling mode, and the target calling mode is determined by the current workload of the target plug-in; if the target calling mode is the direct calling mode, directly perform the target calling operation by calling the target storage service through the encapsulation API in the target plug-in; if the target calling mode is the pre-signed calling mode, obtain the target pre-signed URL by calling the target storage service through the encapsulation API in the target plug-in; and feed back the target pre-signed URL to the front-end application through the target plug-in, and the front-end application calls the target storage service using the target pre-signed URL to perform the target calling operation.
8. An electronic device comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to execute the object storage service calling method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the object storage service calling method according to any one of claims 1-6.
Citation Information
Patent Citations
Mirror image file transmission method and apparatus in cloud platform
CN107483573A
Interface calling method and device, computer equipment and storage medium
CN112988409A