WO2018000618A1 - Object file appending and truncation method and server - Google Patents

Object file appending and truncation method and server Download PDF

Info

Publication number
WO2018000618A1
WO2018000618A1 PCT/CN2016/099970 CN2016099970W WO2018000618A1 WO 2018000618 A1 WO2018000618 A1 WO 2018000618A1 CN 2016099970 W CN2016099970 W CN 2016099970W WO 2018000618 A1 WO2018000618 A1 WO 2018000618A1
Authority
WO
WIPO (PCT)
Prior art keywords
object file
length
truncation
user equipment
additional
Prior art date
Application number
PCT/CN2016/099970
Other languages
French (fr)
Chinese (zh)
Inventor
吴兴义
Original Assignee
乐视控股(北京)有限公司
乐视云计算有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视控股(北京)有限公司, 乐视云计算有限公司 filed Critical 乐视控股(北京)有限公司
Publication of WO2018000618A1 publication Critical patent/WO2018000618A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Definitions

  • the present application relates to the field of communications technologies, and in particular, to an object file addition, a truncation method, and a server.
  • Object storage is different from the storage structure of file storage.
  • Traditional file storage stores files through the structure of the directory tree.
  • object storage is not stored in a directory-hierarchical structure. Instead, each object is placed in the same storage pool to form a flat and identical hierarchy. Each element of each level has a unique identifier in the storage system through which the user device accesses the storage pool or object. Because the flat data organization structure discards nested folders, it avoids the burden of maintaining a large directory tree. In the era of big data and the Internet, there are millions of files and objects stored, and the number of visits per unit of time and concurrent access has reached an unprecedented magnitude. In this case, traditional file storage is used.
  • Object storage is provided with a large amount of storage space, and the Hyper Text Transfer Protocol (HTTP) interface also simplifies the developer's development process. Therefore, object storage has received a lot of attention and has been rapidly developed.
  • HTTP Hyper Text Transfer Protocol
  • the inventor has found that in the object storage, if an object file is to be appended or truncated, the appended object file or the truncated object file can only be re-uploaded to the server.
  • the user stores the log or processes the big data, it needs to perform an append or truncation operation to the object file every hour on average. If the object file is re-transmitted every time the file is appended or truncated by the prior art. Over time, the public network bandwidth will be seriously wasted, affecting the processing efficiency of the server.
  • the average or hourly object file needs to be retransmitted every hour, resulting in low utilization of the public network bandwidth.
  • the present invention provides a method for adding and truncating an object file, and a server for solving the problem that the utilization rate of the public network bandwidth is low and the processing efficiency of the server storing the object file is low, and the utilization rate of the public network bandwidth is improved.
  • an embodiment of the present application provides a method for adding an object file, including:
  • the returned response is a response that can be added to the determined object file, receiving an additional request for the object file sent by the user equipment, wherein the additional request includes the additional content and the added starting position;
  • the object file is added based on the additional content and the added start position, and the added object file is obtained.
  • the embodiment of the present application provides a method for truncating an object file, including:
  • truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
  • the object file is truncated according to the truncation length to obtain a truncated object file.
  • an embodiment of the present application provides a server, including: at least one processor; and a memory; wherein the memory stores an instruction executable by the at least one processor, The instructions are executed by the at least one processor to enable the at least one processor to perform an append method of any of the above object files of the present application.
  • an embodiment of the present application provides a server, including: at least one processor; and a memory; wherein the memory stores an instruction executable by the at least one processor, the instruction being the at least one The processor executes to enable the at least one processor to perform the truncation method of any of the above object files of the present application.
  • the method for adding and cutting an object file and the server determine the position to add the additional content to the object file or determine the truncation by adding the initial start position in the request or the truncation length in the truncation request.
  • the truncation area of the object file realizes the appending operation and the truncation operation on the object side on the server side, thereby avoiding the appending operation or truncation operation on the object file on the user equipment side, and then uploading the object file after the addition or truncation to the server again.
  • the operation of the object file on the server side reduces the bandwidth occupied by the object file upload after the addition or truncation, and improves the utilization of the public network bandwidth.
  • FIG. 1 is a flowchart of a method for adding an object file according to an embodiment of the present application
  • FIG. 2 is a flowchart of a method for adding an object file according to an embodiment of the present application
  • FIG. 3 is a flowchart of a method for adding an object file according to an embodiment of the present application
  • FIG. 4 is a flowchart of a method for truncating an object file according to an embodiment of the present application
  • FIG. 5 is a flowchart of a method for truncating an object file according to an embodiment of the present application
  • FIG. 6 is a flowchart of a method for truncating an object file according to an embodiment of the present application
  • FIG. 7 is a schematic structural diagram of an apparatus for adding an object file according to an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a device for cutting an object file according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a server according to an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a server according to an embodiment of the present application.
  • the embodiment of the present invention provides an object file addition, a truncation method, and a server, which are used to solve the problem that the utilization rate of the public network bandwidth is low and the processing efficiency of the server storing the object file is low, and the utilization of the public network bandwidth is improved. rate.
  • an embodiment of the present application provides a method for adding an object file, including:
  • S101 Receive a reservation request sent by a user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
  • S102 Determine an object file corresponding to the identifier according to the identifier of the object file that needs to be added, and return a response to whether the determined object file can be added to the user equipment;
  • the returned response is a response that can be added to the specified object file, receiving an additional request for the target file sent by the user equipment, where the additional request includes the additional content and the added starting position;
  • step S102 includes:
  • the identifier of the object file to be added according to the need, and the preset data is queried.
  • the library determines an object file that needs to be appended, and queries the database again according to the determined object file to determine whether the object file is provided with a mutex.
  • the mapping includes a mapping relationship between the identifier of the object file and the object file, and a mapping relationship between the object file and the object file, and the mapping relationship is a one-to-one mapping.
  • the receiving user equipment before the receiving user equipment sends the additional request, it is detected whether the object file that needs to be the additional operation is set with the mutual exclusion lock by the other user equipment, thereby avoiding that the object file is set by the other user equipment with the mutual exclusion lock.
  • the resulting add operation fails, which improves the efficiency of the append operation.
  • the response that the object file can be appended includes an offset position of the object file, wherein the user equipment generates an additional start position and an added termination position according to the offset position of the object file.
  • the additional starting position is an offset position of the object file.
  • the user equipment receives a response that can be added by the object file sent by the server, and determines an additional start position and an added termination position according to the offset position of the object file in the response, and adds the determined An initial request, an added termination position, and additional content are generated to generate an additional request.
  • the additional range that is, the appended starting position and the appended ending position, according to the offset position sent by the server, the length of the object file recorded in the server is prevented from being inconsistent with the length of the object file recorded in the user equipment, resulting in The addition fails, which improves the efficiency of the append operation.
  • the reservation request includes a length of the additional content
  • the method further includes:
  • the method further includes:
  • step S104 Sending the length of the additional content to the user equipment if the length of the additional content does not match the agreed additional length A response to re-apply the offset position is sent; if they are consistent, step S104 is performed.
  • the server takes up the additional content, thereby improving the server's additional operation. Speed, which increases operational efficiency.
  • step S201 If the object file determined in step S201 is not provided with a mutex, the method further includes:
  • the problem that multiple user devices simultaneously add or truncate the same object file is prevented, so that only one user device operates the object file at the same time. , other users are prohibited from appending or truncating the object file.
  • the method further includes:
  • the mutual exclusion lock set on the object file is removed, and at this time, other user equipments may perform an addition or a truncation operation on the object file.
  • the user equipment sends a reservation request for adding an object file to the server, where the reservation request includes a length of the additional content.
  • the server determines, according to the received reservation request, whether the object file is in an appendable state. If the object file is in an appendable state, performing the following steps; otherwise, returning a response that the object file cannot be added;
  • the server sets a mutex lock on the object file, where the mutex lock is used to prohibit a user equipment other than the user equipment from appending or truncating an object file for setting a mutex lock.
  • the server sets a length of the additional content in the reservation request to a predetermined additional length
  • the server returns a response including an offset position of the object file.
  • the user equipment analyzes the response returned by the server; if the received response is a response that the object file cannot be added, then proceeds to step S301;
  • the received response is a response including the offset position of the object file
  • determine an additional start position and an end position according to the offset position of the object file generate and send an additional request to the server.
  • the additional request includes an added start location, a termination location, and the additional content
  • the server obtains additional content according to the received additional request, determines a length of the added content according to the added content, and determines whether the length of the determined additional content is equal to the agreed additional length;
  • step S310 The user equipment receives the response sent by the server, and if the received response is a response including the length of the appended object file, the user equipment updates the length parameter of the object file; if the received response is If the response to the failure of the additional content is written, step S301 is re-executed.
  • step S303, step S304, and step S305 is not limited.
  • step S307 determining an additional starting position according to the offset position of the object file, including:
  • the offset position of the object file and the length of the additional content are added to the header of the RANG of the HTTP request.
  • step S307 before step S308, the method further includes:
  • the server determines whether the user equipment that sends the additional request has the right to modify the object file, that is, whether the object of the mutex of the object file is the user equipment.
  • step S301 the portion before step S301 is supplemented. That is, the user equipment sends a request for uploading the object file to the server; the server writes the object file received in the request to the server, and records the length of the object file.
  • the server writes the object file in the request to the server, including: the server writes the object file in the request to the disk according to the number of copies rule.
  • the length of the object file saved by the server is L0
  • the length of the additional content is L1
  • the length of the additional content in the reservation request sent by the user equipment to the server is L1
  • the server In the returned response the offset position is L0
  • the added start position is L0
  • the added termination position is L0+L1
  • the interval of the additional position determined by the user equipment is [L0, L0+L1]
  • the server returns The length of the object file appended in the response is L0+L1.
  • an embodiment of the present application provides a method for truncating an object file, including:
  • S401 Receive a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
  • step S403 includes:
  • step S502 includes the following three cases:
  • Case 1 If the truncation length is less than the length of the object file, the content of the object file is cleared from the position of the end of the object file until the length of the object file is equal to the truncation length. Obtain the truncated object file;
  • Case 2 if the truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
  • Case 3 If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated Object file.
  • the method further includes:
  • the object file is provided with a mutex lock, returning a non-trunable response of the object file, wherein the mutex lock is used to prohibit user equipment addition other than the user equipment that sets the mutex lock Or truncate the object file that sets the mutex.
  • the user equipment sends a reservation request including a truncation length to the server.
  • step S602 the server determines whether the length of the truncation is equal to the length of the object file corresponding to the reservation request; if yes, step S605 is performed; otherwise, step S603 is performed;
  • the server returns a response including an offset position of the object file to the user equipment.
  • the user equipment determines the truncation length according to the returned offset position of the object file, and re-executes step S601;
  • the user equipment sends a truncation request including a truncation length to the server.
  • step S606 the server determines whether the received object file corresponding to the truncation request is in a truncated state; if yes, step S607 is performed; otherwise, step S609 is performed;
  • the server returns a response including a length of the truncated object file.
  • step S502 the first case in step S502, that is, if L2 is smaller than L0+L1, the content of the object file of the truncated section, that is, [L2, L0+L1] is cleared, and the truncated object file is obtained; If it is equal to L0+L1, it is determined that the truncated object file is the object file before truncation; in case three, if L2 is greater than L0+L1, the object file is in the truncation interval, that is, [L0+L1, L2] fills in the blank content and gets the truncated object file.
  • the blank content of the padding is a null character, that is, “0”.
  • an embodiment of the present application provides an apparatus for adding an object file, including:
  • the first receiving module 701 is configured to receive a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
  • the response module 702 is configured to determine an object file corresponding to the identifier according to the identifier of the object file that needs to be added, and return a response to whether the determined object file can be added to the user equipment;
  • the second receiving module 703 is configured to receive an additional request for the target file sent by the user equipment, if the returned response is a response that can be added to the specified object file, wherein the additional request includes additional content and an additional request Starting position
  • the adding module 704 is configured to add the target file based on the additional content and the added starting position, and obtain the added target file.
  • the response module 702 is specifically configured to:
  • mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock
  • the response that the object file can be appended includes: an offset position of the object file, wherein the user equipment generates an additional starting position according to the offset position of the object file.
  • the reservation request includes a length of the additional content
  • the response module 702 is further configured to:
  • the appending module 704 is further configured to:
  • the response module 702 is further configured to:
  • the appending module 704 is further configured to:
  • an embodiment of the present application provides a device for cutting an object file, including:
  • the receiving module 801 is configured to receive a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
  • the determining module 802 is configured to determine an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
  • the truncation module 803 is configured to truncate the object file according to the truncation length to obtain a truncated object file.
  • the truncation module 803 is specifically configured to:
  • the content of the object file is cleared from the position at the end of the object file until the length of the object file is equal to the truncation length, and the truncation is obtained.
  • truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
  • the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained.
  • the truncation module 803 is further configured to:
  • the object file is provided with a mutex lock, returning an uninterruptible response of the object file, wherein the mutex is used to prohibit user equipment other than the user equipment that sets the mutex from appending or truncating the setting mutual
  • the object file that is slammed If the object file is provided with a mutex lock, returning an uninterruptible response of the object file, wherein the mutex is used to prohibit user equipment other than the user equipment that sets the mutex from appending or truncating the setting mutual The object file that is slammed.
  • an embodiment of the present application provides a server, including: at least one processor 901; and a memory 902.
  • the processor 901 includes: a first receiving module 701, a response module 702, a second receiving module 703, and An additional module 704; wherein
  • the first receiving module 701 is configured to receive a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
  • the response module 702 is configured to determine an object file corresponding to the identifier according to the identifier of the object file that needs to be added, and return a response to whether the determined object file can be added to the user equipment;
  • the second receiving module 703 is configured to receive an additional request for the target file sent by the user equipment, if the returned response is a response that can be added to the specified object file, wherein the additional request includes additional content and an additional request Starting position
  • the adding module 704 is configured to add the target file based on the additional content and the added starting position, and obtain the added target file.
  • the response module 702 is specifically configured to:
  • mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock
  • the response that the object file can be appended includes: an offset position of the object file, wherein the user equipment generates an additional starting position according to the offset position of the object file.
  • the reservation request includes a length of the additional content
  • the response module 702 is further configured to:
  • the appending module 704 is further configured to:
  • the response module 702 is further configured to:
  • the appending module 704 is further configured to:
  • an embodiment of the present application provides a server, including: at least one processor 1001; and a memory 1002.
  • the processor 1001 includes: a receiving module 801, a determining module 802, and a truncating module 803.
  • the receiving module 801 is configured to receive a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
  • the determining module 802 is configured to determine an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
  • the truncation module 803 is configured to truncate the object file according to the truncation length to obtain a truncated object file.
  • the truncation module 803 is specifically configured to:
  • the content of the object file is cleared from the position at the end of the object file until the length of the object file is equal to the truncation length, and the truncation is obtained.
  • truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
  • the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained.
  • the truncation module 803 is further configured to:
  • the mutex is used to prohibit the user equipment other than the user equipment that sets the mutex from appending or truncating the object file for setting the mutex.
  • the server provided by the embodiment of the present application may be an object storage cluster.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present application discloses an object file appending and truncation method and a server, used to prevent repeated uploading of an object file obtained by means of appending or truncation at a user equipment, so as to reduce the bandwidth occupied by an upload request and increase utilization efficiency of public network bandwidth. The method comprises: receiving a reservation request issued from a user equipment, wherein the reservation request includes an identifier of an object file requiring an appending operation; determining an object file corresponding to the identifier on the basis of the identifier of the object file to requiring the appending operation, and returning a response indicating whether the determined object file can undergo the appending operation; if the response returned indicates that the object file can undergo appending, receiving an appending request that the user equipment issues for the object file, wherein the appending request includes appending content and an appending start position; and performing appending on the object file according to the appending content and the appending start position to obtain an appended object file.

Description

对象文件的追加、截断方法及服务器Object file addition, truncation method, and server
本申请要求在2016年06月30日提交中国专利局、申请号为201610506560.3、发明名称为“对象文件的追加、截断方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on June 30, 2016, the Chinese Patent Application No. 201610506560.3, the title of the invention is "addition, cut-off method and device of the object file", the entire contents of which are incorporated herein by reference. In the application.
技术领域Technical field
本申请涉及通信技术领域,尤其涉及一种对象文件的追加、截断方法及服务器。The present application relates to the field of communications technologies, and in particular, to an object file addition, a truncation method, and a server.
背景技术Background technique
对象存储与文件存储的存储结构不同。传统的文件存储是通过目录树的结构对文件进行存储,然而对象存储并不以目录分层的结构存储,而是通过将每一对象都置于同一存储池中,形成扁平且相同的层级,每一级的每个元素在存储系统中都有唯一的标识,用户设备通过此标识来访问存储池或对象。由于扁平的数据组织结构抛弃了嵌套式的文件夹,从而避免了维护庞大的目录树所导致的负担过重。在大数据和互联网时代,存储的文件以及存储的对象高达上百万个,单位时间内的访问次数以及并发访问量也达到了前所未有的量级,在这种情况下,采用传统的文件存储形式,即目录树形式将会给存储系统带来很大的开销以及负担,这将会严重的制约着处理效率,成为系统提速的瓶颈。对象存储在提供海量的存储空间的同时,超文本传输协议(HTTP,Hyper Text Transfer Protocol)接口也简化了开发者的开发流程。因此,对象存储受到了大量的关注,并得到了迅速的发展。Object storage is different from the storage structure of file storage. Traditional file storage stores files through the structure of the directory tree. However, object storage is not stored in a directory-hierarchical structure. Instead, each object is placed in the same storage pool to form a flat and identical hierarchy. Each element of each level has a unique identifier in the storage system through which the user device accesses the storage pool or object. Because the flat data organization structure discards nested folders, it avoids the burden of maintaining a large directory tree. In the era of big data and the Internet, there are millions of files and objects stored, and the number of visits per unit of time and concurrent access has reached an unprecedented magnitude. In this case, traditional file storage is used. That is, the form of the directory tree will bring great overhead and burden to the storage system, which will seriously restrict the processing efficiency and become the bottleneck of the system speed increase. Object storage is provided with a large amount of storage space, and the Hyper Text Transfer Protocol (HTTP) interface also simplifies the developer's development process. Therefore, object storage has received a lot of attention and has been rapidly developed.
然而,发明人发现在对象存储中,若要对对象文件进行追加或截断的操作,只能通过将追加后的对象文件或截断后的对象文件向服务器重新上传。当用户存储日志或者处理大数据时,平均每个小时均需要向对象文件进行一次追加或截断操作,若采用现有技术每次将追加或截断后的对象文件重传一 遍,将严重浪费公网带宽,影响服务器的处理效率。However, the inventor has found that in the object storage, if an object file is to be appended or truncated, the appended object file or the truncated object file can only be re-uploaded to the server. When the user stores the log or processes the big data, it needs to perform an append or truncation operation to the object file every hour on average. If the object file is re-transmitted every time the file is appended or truncated by the prior art. Over time, the public network bandwidth will be seriously wasted, affecting the processing efficiency of the server.
综上所述,若用户采用现有技术对日志进行存储或者对大数据进行处理,平均每小时均需将追加或截断后的对象文件重传一遍,导致公网带宽的利用率低。In summary, if the user uses the prior art to store the log or process the big data, the average or hourly object file needs to be retransmitted every hour, resulting in low utilization of the public network bandwidth.
发明内容Summary of the invention
本申请提供一种对象文件的追加、截断方法及服务器,用以解决现有技术中公网带宽的利用率低,存储对象文件的服务器的处理效率低的问题,实现提高公网带宽的利用率。The present invention provides a method for adding and truncating an object file, and a server for solving the problem that the utilization rate of the public network bandwidth is low and the processing efficiency of the server storing the object file is low, and the utilization rate of the public network bandwidth is improved.
第一方面,本申请实施例提供一种对象文件的追加方法,包括:In a first aspect, an embodiment of the present application provides a method for adding an object file, including:
接收用户设备发送的预约请求,其中,所述预约请求包括需要进行追加操作的对象文件的标识;Receiving a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
根据所述需要进行追加操作的对象文件的标识,确定该标识对应的对象文件,并向所述用户设备返回确定的对象文件是否可追加的响应;Determining, according to the identifier of the object file that needs to be added, determining an object file corresponding to the identifier, and returning, to the user equipment, a response of whether the determined object file is appendable;
若返回的响应为确定的对象文件可追加的响应,则接收用户设备发送的针对所述对象文件的追加请求,其中,所述追加请求包括追加内容以及追加的起始位置;If the returned response is a response that can be added to the determined object file, receiving an additional request for the object file sent by the user equipment, wherein the additional request includes the additional content and the added starting position;
根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加,得到追加后的对象文件。The object file is added based on the additional content and the added start position, and the added object file is obtained.
第二方面,本申请实施例提供一种对象文件的截断方法,包括:In a second aspect, the embodiment of the present application provides a method for truncating an object file, including:
接收用户设备发送的截断请求,其中,所述截断请求包括:需要进行截断操作的对象文件的标识以及截断长度;Receiving a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
根据所述需要进行截断操作的对象文件的标识,确定需要进行截断操作的对象文件;Determining an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件。The object file is truncated according to the truncation length to obtain a truncated object file.
第三方面,本申请实施例提供一种服务器,包括:至少一个处理器;以及存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令, 所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行本申请上述任一项对象文件的追加方法。In a third aspect, an embodiment of the present application provides a server, including: at least one processor; and a memory; wherein the memory stores an instruction executable by the at least one processor, The instructions are executed by the at least one processor to enable the at least one processor to perform an append method of any of the above object files of the present application.
第四方面,本申请实施例提供一种服务器,包括:至少一个处理器;以及存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行本申请上述任一项对象文件的截断方法。In a fourth aspect, an embodiment of the present application provides a server, including: at least one processor; and a memory; wherein the memory stores an instruction executable by the at least one processor, the instruction being the at least one The processor executes to enable the at least one processor to perform the truncation method of any of the above object files of the present application.
本申请实施例提供的对象文件的追加、截断方法及服务器,通过追加请求中的追加的起始位置或截断请求中的截断长度,从而确定将追加内容添加到对象文件中的位置,或确定截断对象文件的截断区域,从而实现在服务器侧对对象文件的追加操作与截断操作,避免了在用户设备侧对对象文件进行追加操作或截断操作,再将追加或截断后的对象文件重新上传服务器,在服务器侧对对象文件进行操作,减小了追加或截断后的对象文件上传所占的带宽,提高了公网带宽的利用率。The method for adding and cutting an object file and the server provided in the embodiment of the present application determine the position to add the additional content to the object file or determine the truncation by adding the initial start position in the request or the truncation length in the truncation request. The truncation area of the object file realizes the appending operation and the truncation operation on the object side on the server side, thereby avoiding the appending operation or truncation operation on the object file on the user equipment side, and then uploading the object file after the addition or truncation to the server again. The operation of the object file on the server side reduces the bandwidth occupied by the object file upload after the addition or truncation, and improves the utilization of the public network bandwidth.
附图说明DRAWINGS
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。The one or more embodiments are exemplified by the accompanying drawings in the accompanying drawings, and FIG. The figures in the drawings do not constitute a scale limitation unless otherwise stated.
图1为本申请实施例提供的对象文件的追加方法的流程图;FIG. 1 is a flowchart of a method for adding an object file according to an embodiment of the present application;
图2为本申请实施例提供的对象文件的追加方法的流程图;2 is a flowchart of a method for adding an object file according to an embodiment of the present application;
图3为本申请实施例提供的对象文件的追加方法的流程图;FIG. 3 is a flowchart of a method for adding an object file according to an embodiment of the present application;
图4为本申请实施例提供的对象文件的截断方法的流程图;4 is a flowchart of a method for truncating an object file according to an embodiment of the present application;
图5为本申请实施例提供的对象文件的截断方法的流程图;FIG. 5 is a flowchart of a method for truncating an object file according to an embodiment of the present application;
图6为本申请实施例提供的对象文件的截断方法的流程图;FIG. 6 is a flowchart of a method for truncating an object file according to an embodiment of the present application;
图7为本申请实施例提供的对象文件的追加装置的结构示意图;FIG. 7 is a schematic structural diagram of an apparatus for adding an object file according to an embodiment of the present application;
图8为本申请实施例提供的对象文件的截断装置的结构示意图;FIG. 8 is a schematic structural diagram of a device for cutting an object file according to an embodiment of the present disclosure;
图9为本申请实施例提供的服务器的结构示意图; FIG. 9 is a schematic structural diagram of a server according to an embodiment of the present application;
图10为本申请实施例提供的服务器的结构示意图。FIG. 10 is a schematic structural diagram of a server according to an embodiment of the present application.
具体实施方式detailed description
为使本申请的目的、技术方案和优点更加清楚,以下将参照本申请实施例中的附图,通过实施方式清楚、完整地描述本申请的技术方案,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。The embodiments of the present application will be clearly and completely described in the following with reference to the drawings in the embodiments of the present application. Some embodiments, but not all of the embodiments.
本申请实施例提供一种对象文件的追加、截断方法及服务器,用以解决现有技术中公网带宽的利用率低,存储对象文件的服务器的处理效率低的问题,实现提高公网带宽的利用率。The embodiment of the present invention provides an object file addition, a truncation method, and a server, which are used to solve the problem that the utilization rate of the public network bandwidth is low and the processing efficiency of the server storing the object file is low, and the utilization of the public network bandwidth is improved. rate.
参见图1,本申请实施例提供一种对象文件的追加方法,包括:Referring to FIG. 1 , an embodiment of the present application provides a method for adding an object file, including:
S101、接收用户设备发送的预约请求,其中,所述预约请求包括需要进行追加操作的对象文件的标识;S101. Receive a reservation request sent by a user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
S102、根据所述需要进行追加操作的对象文件的标识,确定该标识对应的对象文件,并向所述用户设备返回确定的对象文件是否可追加的响应;S102: Determine an object file corresponding to the identifier according to the identifier of the object file that needs to be added, and return a response to whether the determined object file can be added to the user equipment;
S103、若返回的响应为确定的对象文件可追加的响应,则接收用户设备发送的针对所述对象文件的追加请求,其中,所述追加请求包括追加内容以及追加的起始位置;S103. If the returned response is a response that can be added to the specified object file, receiving an additional request for the target file sent by the user equipment, where the additional request includes the additional content and the added starting position;
S104、根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加,得到追加后的对象文件。S104. Add the target file according to the additional content and the added starting position, and obtain the added target file.
参见图2,步骤S102中“向所述用户设备返回确定的对象文件是否可追加的响应”包括:Referring to FIG. 2, "Responding to whether the determined object file can be appended to the user equipment" in step S102 includes:
S201、判断确定的对象文件是否设置有互斥锁,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件;S201, determining whether the determined object file is set with a mutex lock, wherein the mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock;
S202、若是,则向所述用户设备返回所述对象文件不可追加的响应;否则,向所述用户设备返回所述对象文件可追加的响应。S202. If yes, return a response that the object file cannot be added to the user equipment; otherwise, return a response that the object file can be added to the user equipment.
其中,根据所述需要进行追加操作的对象文件的标识,查询预设的数据 库,确定需要进行追加操作的对象文件,根据确定的对象文件,再次查询数据库,确定该对象文件是否设置有互斥锁。其中,所述数据库中包括对象文件的标识与该对象文件的映射关系,以及对象文件与该对象文件是否设置互斥锁的映射关系,且所述映射关系均为一一映射。The identifier of the object file to be added according to the need, and the preset data is queried. The library determines an object file that needs to be appended, and queries the database again according to the determined object file to determine whether the object file is provided with a mutex. The mapping includes a mapping relationship between the identifier of the object file and the object file, and a mapping relationship between the object file and the object file, and the mapping relationship is a one-to-one mapping.
本申请实施例中,通过在接收用户设备发送追加请求之前,检测需要进行追加操作的对象文件是否被其他用户设备设置有互斥锁,避免了由于该对象文件被其他用户设备设置有互斥锁,导致的追加操作失败,从而提高了追加操作的效率。In the embodiment of the present application, before the receiving user equipment sends the additional request, it is detected whether the object file that needs to be the additional operation is set with the mutual exclusion lock by the other user equipment, thereby avoiding that the object file is set by the other user equipment with the mutual exclusion lock. The resulting add operation fails, which improves the efficiency of the append operation.
其中,所述对象文件可追加的响应包括,所述对象文件的偏移位置,其中,所述用户设备根据所述对象文件的偏移位置生成追加的起始位置以及追加的终止位置。The response that the object file can be appended includes an offset position of the object file, wherein the user equipment generates an additional start position and an added termination position according to the offset position of the object file.
具体地,所述追加的起始位置为所述对象文件的偏移位置。Specifically, the additional starting position is an offset position of the object file.
本申请实施例中,用户设备接收服务器发送的对象文件可追加的响应,并根据该响应中的对象文件的偏移位置,确定追加的起始位置以及追加的终止位置,并根据确定的追加的起始位置、追加的终止位置以及追加内容,生成追加请求。通过根据服务器发送的偏移位置,确定追加范围,即追加的起始位置以及追加的终止位置,从而避免服务器中记录的该对象文件的长度与用户设备中记录的该对象文件的长度不一致,导致的追加失败,从而提高了追加操作的效率。In the embodiment of the present application, the user equipment receives a response that can be added by the object file sent by the server, and determines an additional start position and an added termination position according to the offset position of the object file in the response, and adds the determined An initial request, an added termination position, and additional content are generated to generate an additional request. By determining the additional range, that is, the appended starting position and the appended ending position, according to the offset position sent by the server, the length of the object file recorded in the server is prevented from being inconsistent with the length of the object file recorded in the user equipment, resulting in The addition fails, which improves the efficiency of the append operation.
其中,所述预约请求包括,追加内容的长度;Wherein the reservation request includes a length of the additional content;
具体地,步骤S202中若确定的对象文件没有设置有互斥锁,该方法还包括:Specifically, if the object file determined in step S202 is not provided with a mutex, the method further includes:
设定所述预约请求中追加内容的长度为约定的追加长度;Setting a length of the additional content in the reservation request to be an agreed additional length;
在步骤S104根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加之前,该方法还包括:Before the addition of the object file based on the additional content and the added starting position in step S104, the method further includes:
判断所述追加内容的长度与约定的追加长度是否一致;Determining whether the length of the additional content matches the agreed additional length;
若所述追加内容的长度与约定的追加长度不一致,则向所述用户设备发 送重新申请偏移位置的响应;若一致,则执行步骤S104。Sending the length of the additional content to the user equipment if the length of the additional content does not match the agreed additional length A response to re-apply the offset position is sent; if they are consistent, step S104 is performed.
本申请实施例中,通过判断追加的内容的长度与约定的追加长度是否一致,确定是否进行追加,实现了在接收到预约请求时,服务器为追加的内容占位,提高了服务器进行追加操作的速度,从而提高操作效率。In the embodiment of the present application, it is determined whether or not the length of the added content matches the agreed additional length, and whether or not the addition is performed, and when the reservation request is received, the server takes up the additional content, thereby improving the server's additional operation. Speed, which increases operational efficiency.
其中,步骤S201中确定的对象文件若未设置互斥锁,该方法还包括:If the object file determined in step S201 is not provided with a mutex, the method further includes:
对所述对象文件设置互斥锁。Set a mutex lock on the object file.
本申请实施例中,通过对确定的对象文件设置互斥锁,从而防止多个用户设备同时对同一对象文件进行追加或截断操作的问题,实现在同一时间只有一用户设备对该对象文件进行操作,禁止其他用户对对象文件进行追加或截断操作。In the embodiment of the present application, by setting a mutual exclusion lock on the determined object file, the problem that multiple user devices simultaneously add or truncate the same object file is prevented, so that only one user device operates the object file at the same time. , other users are prohibited from appending or truncating the object file.
其中,在步骤S104对所述对象文件进行追加之后,该方法还包括:After the object file is added in step S104, the method further includes:
去除对所述对象文件设置的互斥锁。Remove the mutex set on the object file.
本申请实施例中,在对所述对象文件进行追加之后,去除对所述对象文件设置的互斥锁,此时其他用户设备亦可对该对象文件进行追加或截断操作。In the embodiment of the present application, after the object file is added, the mutual exclusion lock set on the object file is removed, and at this time, other user equipments may perform an addition or a truncation operation on the object file.
为便于理解,下面将结合图3,对对象文件追加的整体流程进一步进行解释说明。For ease of understanding, the overall flow of object file addition will be further explained below with reference to FIG. 3.
S301、用户设备向服务器发送用于对对象文件追加的预约请求,其中,所述预约请求包括追加内容的长度;S301. The user equipment sends a reservation request for adding an object file to the server, where the reservation request includes a length of the additional content.
S302、所述服务器根据接收到的预约请求,判断该对象文件是否为可追加状态;若所述对象文件为可追加状态,则执行下述步骤;否则,返回所述对象文件不可追加的响应;S302. The server determines, according to the received reservation request, whether the object file is in an appendable state. If the object file is in an appendable state, performing the following steps; otherwise, returning a response that the object file cannot be added;
S303、所述服务器对所述对象文件设置互斥锁,其中,所述互斥锁用于禁止除所述用户设备以外的用户设备追加或截断设置互斥锁的对象文件;S303. The server sets a mutex lock on the object file, where the mutex lock is used to prohibit a user equipment other than the user equipment from appending or truncating an object file for setting a mutex lock.
S304、所述服务器设定所述预约请求中追加内容的长度为约定追加长度;S304. The server sets a length of the additional content in the reservation request to a predetermined additional length;
S305、所述服务器返回包括所述对象文件的偏移位置的响应;S305. The server returns a response including an offset position of the object file.
S306、所述用户设备分析所述服务器返回的响应;若接收到的响应为所述对象文件不可追加的响应,则继续执行步骤S301; S306, the user equipment analyzes the response returned by the server; if the received response is a response that the object file cannot be added, then proceeds to step S301;
S307、若接收到的响应为包括所述对象文件的偏移位置的响应,则根据所述对象文件的偏移位置,确定追加的起始位置及终止位置,生成并向所述服务器发送追加请求,其中,所述追加请求包括追加的起始位置、终止位置以及所述追加内容;S307. If the received response is a response including the offset position of the object file, determine an additional start position and an end position according to the offset position of the object file, generate and send an additional request to the server. The additional request includes an added start location, a termination location, and the additional content;
S308、所述服务器根据接收到的追加请求,得到追加内容,根据所述追加内容,确定追加内容的长度,并判断确定的追加内容的长度与约定追加长度是否相等;S308. The server obtains additional content according to the received additional request, determines a length of the added content according to the added content, and determines whether the length of the determined additional content is equal to the agreed additional length;
S309、若是,则根据所述追加的起始位置及终止位置,对所述追加内容进行追加,生成追加后的对象文件,并返回包括追加后的对象文件的长度的响应,打开互斥锁;否则,所述服务器打开互斥锁,并返回写入追加内容失败的响应;S309. If yes, adding the additional content according to the added start position and the end position, generating an added target file, and returning a response including the length of the added target file, and opening the mutex; Otherwise, the server opens the mutex and returns a response to the failure to write the appended content;
S310、所述用户设备接收所述服务器发送的响应,若接收到的响应为包括追加后的对象文件的长度的响应,则所述用户设备更新该对象文件的长度参数;若接收到的响应为写入追加内容失败的响应,则重新执行步骤S301。S310. The user equipment receives the response sent by the server, and if the received response is a response including the length of the appended object file, the user equipment updates the length parameter of the object file; if the received response is If the response to the failure of the additional content is written, step S301 is re-executed.
其中,不限制步骤S303、步骤S304以及步骤S305的执行顺序。The execution order of step S303, step S304, and step S305 is not limited.
具体地,步骤S307中根据所述对象文件的偏移位置,确定追加的起始位置,包括:Specifically, in step S307, determining an additional starting position according to the offset position of the object file, including:
将所述对象文件的偏移位置以及追加内容的长度添加到HTTP请求的RANG的头里。The offset position of the object file and the length of the additional content are added to the header of the RANG of the HTTP request.
具体地,在步骤S307之后,步骤S308之前,该方法还包括:Specifically, after step S307, before step S308, the method further includes:
所述服务器确定发送追加请求的用户设备是否有权限对对象文件修改,即所述对象文件的互斥锁的对象是否为该用户设备。The server determines whether the user equipment that sends the additional request has the right to modify the object file, that is, whether the object of the mutex of the object file is the user equipment.
为保证本申请流程的完整性,补充在步骤S301之前的部分。即用户设备向所述服务器发送上传对象文件的请求;所述服务器将接收到该请求中的对象文件写入到所述服务器中,并记录所述对象文件的长度。In order to ensure the integrity of the process of the present application, the portion before step S301 is supplemented. That is, the user equipment sends a request for uploading the object file to the server; the server writes the object file received in the request to the server, and records the length of the object file.
其中,所述服务器将接收到该请求中的对象文件写入到所述服务器中,包括:所述服务器将接收到该请求中的对象文件按副本数规则写入到磁盘中。 The server writes the object file in the request to the server, including: the server writes the object file in the request to the disk according to the number of copies rule.
假设在步骤S301之前,所述服务器保存的对象文件的长度为L0,追加内容的长度为L1,那么所述用户设备发送给所述服务器的预约请求中的追加内容的长度为L1,所述服务器返回的响应中偏移位置为L0,追加的起始位置为L0,追加的终止位置为L0+L1,所述用户设备确定的追加位置的区间为[L0,L0+L1],所述服务器返回的响应中追加后的对象文件的长度为L0+L1。It is assumed that, before the step S301, the length of the object file saved by the server is L0, and the length of the additional content is L1, the length of the additional content in the reservation request sent by the user equipment to the server is L1, the server In the returned response, the offset position is L0, the added start position is L0, the added termination position is L0+L1, and the interval of the additional position determined by the user equipment is [L0, L0+L1], and the server returns The length of the object file appended in the response is L0+L1.
参见图4,本申请实施例提供一种对象文件的截断方法,包括:Referring to FIG. 4, an embodiment of the present application provides a method for truncating an object file, including:
S401、接收用户设备发送的截断请求,其中,所述截断请求包括:需要进行截断操作的对象文件的标识以及截断长度;S401. Receive a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
S402、根据所述需要进行截断操作的对象文件的标识,确定需要进行截断操作的对象文件;S402. Determine, according to the identifier of the object file that needs to perform the truncation operation, an object file that needs to perform a truncation operation;
S403、根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件。S403. Cut the object file according to the truncation length to obtain a truncated object file.
其中,参见图5,步骤S403包括:Wherein, referring to FIG. 5, step S403 includes:
S501、比较所述截断长度与所述对象文件的长度;S501. Compare the truncation length with a length of the object file.
S502、根据所述对象文件,得到截断后的对象文件。S502. Obtain a truncated object file according to the object file.
具体地,步骤S502包括以下三种情况:Specifically, step S502 includes the following three cases:
情况一:若所述截断长度小于所述对象文件的长度,则从所述对象文件结尾的位置开始,清除所述对象文件的内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件;Case 1: If the truncation length is less than the length of the object file, the content of the object file is cleared from the position of the end of the object file until the length of the object file is equal to the truncation length. Obtain the truncated object file;
情况二:若所述截断长度等于所述对象文件的长度,则确定截断后的对象文件为截断前的所述对象文件;Case 2: if the truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
情况三:若所述截断长度大于所述对象文件的长度,则从所述对象文件结尾的位置开始,填充空白内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件。Case 3: If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated Object file.
其中,在步骤S402之后,该方法还包括:After the step S402, the method further includes:
若所述对象文件设置有互斥锁,则返回所述对象文件不可截断的响应,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加 或截断设置互斥锁的对象文件。If the object file is provided with a mutex lock, returning a non-trunable response of the object file, wherein the mutex lock is used to prohibit user equipment addition other than the user equipment that sets the mutex lock Or truncate the object file that sets the mutex.
为便于理解,下面将结合图6,对对象文件截断的整体流程进一步进行解释说明。For ease of understanding, the overall flow of the object file truncation will be further explained below with reference to FIG.
S601、用户设备向服务器发送包括截断长度的预约请求;S601. The user equipment sends a reservation request including a truncation length to the server.
S602、所述服务器判断所述截断长度与所述预约请求所对应的对象文件的长度是否相等;若是,执行步骤S605;否则,执行步骤S603;S602, the server determines whether the length of the truncation is equal to the length of the object file corresponding to the reservation request; if yes, step S605 is performed; otherwise, step S603 is performed;
S603、所述服务器向所述用户设备返回包括所述对象文件的偏移位置的响应;S603. The server returns a response including an offset position of the object file to the user equipment.
S604、所述用户设备根据返回的所述对象文件的偏移位置,确定截断长度,重新执行步骤S601;S604, the user equipment determines the truncation length according to the returned offset position of the object file, and re-executes step S601;
S605、用户设备向服务器发送包括截断长度的截断请求;S605. The user equipment sends a truncation request including a truncation length to the server.
S606、所述服务器判断接收到的所述截断请求所对应的对象文件是否为可截断状态;若是,则执行步骤S607,否则,执行步骤S609;S606, the server determines whether the received object file corresponding to the truncation request is in a truncated state; if yes, step S607 is performed; otherwise, step S609 is performed;
S607、比较所述截断长度与所述对象文件的长度;若所述截断长度小于所述对象文件的长度,则从所述对象文件结尾的位置开始,清除所述对象文件的内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件;若所述截断长度等于所述对象文件的长度,则确定截断后的对象文件为截断前的所述对象文件;若所述截断长度大于所述对象文件的长度,则从所述对象文件结尾的位置开始,填充空白内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件;S607. Compare the truncation length with the length of the object file. If the truncation length is less than the length of the object file, clear the content of the object file from the position ending with the object file until the If the length of the object file is equal to the length of the truncation, the truncated object file is obtained; if the truncation length is equal to the length of the object file, it is determined that the truncated object file is the object file before truncation; If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained;
S608、所述服务器返回包括所述截断后的对象文件的长度的响应;S608. The server returns a response including a length of the truncated object file.
S609、返回所述对象文件不可截断的响应。S609. Return a response that the object file cannot be truncated.
假设所述服务器中的对象文件的长度为L0+L1,那么所述预约请求中的截断长度为L2。因此,步骤S502中的情况一,即若L2小于L0+L1,则清除所述截断区间即[L2,L0+L1]的对象文件的内容,得到截断后的对象文件;情况二,即若L2等于L0+L1,则确定所述截断后的对象文件为截断前的所述对象文件;情况三,若L2大于L0+L1,则所述对象文件在截断区间即[L0+L1, L2]填充空白内容,得到截断后的对象文件。Assuming that the length of the object file in the server is L0+L1, the truncation length in the reservation request is L2. Therefore, the first case in step S502, that is, if L2 is smaller than L0+L1, the content of the object file of the truncated section, that is, [L2, L0+L1] is cleared, and the truncated object file is obtained; If it is equal to L0+L1, it is determined that the truncated object file is the object file before truncation; in case three, if L2 is greater than L0+L1, the object file is in the truncation interval, that is, [L0+L1, L2] fills in the blank content and gets the truncated object file.
其中,所述填充的空白内容为空字符即“0”。The blank content of the padding is a null character, that is, “0”.
参见图7,本申请实施例提供一种对象文件的追加装置,包括:Referring to FIG. 7, an embodiment of the present application provides an apparatus for adding an object file, including:
第一接收模块701,配置为接收用户设备发送的预约请求,其中,所述预约请求包括需要进行追加操作的对象文件的标识;The first receiving module 701 is configured to receive a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
响应模块702,配置为根据所述需要进行追加操作的对象文件的标识,确定该标识对应的对象文件,并向所述用户设备返回确定的对象文件是否可追加的响应;The response module 702 is configured to determine an object file corresponding to the identifier according to the identifier of the object file that needs to be added, and return a response to whether the determined object file can be added to the user equipment;
第二接收模块703,配置为若返回的响应为确定的对象文件可追加的响应,则接收用户设备发送的针对所述对象文件的追加请求,其中,所述追加请求包括追加内容以及追加的起始位置;The second receiving module 703 is configured to receive an additional request for the target file sent by the user equipment, if the returned response is a response that can be added to the specified object file, wherein the additional request includes additional content and an additional request Starting position
追加模块704,配置为根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加,得到追加后的对象文件。The adding module 704 is configured to add the target file based on the additional content and the added starting position, and obtain the added target file.
具体地,向所述用户设备返回确定的对象文件是否可追加的响应,所述响应模块702具体配置为:Specifically, the user equipment is returned to the user equipment whether the determined object file is appendable. The response module 702 is specifically configured to:
判断确定的对象文件是否设置有互斥锁,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件;Determining whether the determined object file is set with a mutex lock, wherein the mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock;
若是,则向所述用户设备返回所述对象文件不可追加的响应;否则,向所述用户设备返回所述对象文件可追加的响应。If yes, return a response that the object file cannot be added to the user equipment; otherwise, return a response that the object file can be added to the user equipment.
具体地,所述对象文件可追加的响应包括:所述对象文件的偏移位置,其中,所述用户设备根据所述对象文件的偏移位置生成追加的起始位置。Specifically, the response that the object file can be appended includes: an offset position of the object file, wherein the user equipment generates an additional starting position according to the offset position of the object file.
具体地,所述预约请求包括,追加内容的长度;Specifically, the reservation request includes a length of the additional content;
若确定的对象文件未设置有互斥锁,所述响应模块702还配置为:If the determined object file is not provided with a mutex, the response module 702 is further configured to:
设定所述预约请求中追加内容的长度为约定的追加长度;Setting a length of the additional content in the reservation request to be an agreed additional length;
所述追加模块704还配置为:The appending module 704 is further configured to:
判断所述追加的起始位置所对应的长度与约定的追加长度是否一致; Determining whether the length corresponding to the added starting position is consistent with the agreed additional length;
若所述追加的起始位置所对应的长度与约定的追加长度不一致,则向所述用户设备发送重新申请偏移位置的响应。If the length corresponding to the added start position does not match the agreed additional length, a response to re-apply the offset position is sent to the user equipment.
具体地,若确定的对象文件未设置互斥锁,所述响应模块702还配置为:Specifically, if the determined object file is not set with a mutex lock, the response module 702 is further configured to:
对所述对象文件设置互斥锁。Set a mutex lock on the object file.
具体地,所述追加模块704还配置为:Specifically, the appending module 704 is further configured to:
去除对所述对象文件设置的互斥锁。Remove the mutex set on the object file.
参见图8,本申请实施例提供一种对象文件的截断装置,包括:Referring to FIG. 8, an embodiment of the present application provides a device for cutting an object file, including:
接收模块801,配置为接收用户设备发送的截断请求,其中,所述截断请求包括:需要进行截断操作的对象文件的标识以及截断长度;The receiving module 801 is configured to receive a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
确定模块802,配置为根据所述需要进行截断操作的对象文件的标识,确定需要进行截断操作的对象文件;The determining module 802 is configured to determine an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
截断模块803,配置为根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件。The truncation module 803 is configured to truncate the object file according to the truncation length to obtain a truncated object file.
具体地,所述截断模块803,具体配置为:Specifically, the truncation module 803 is specifically configured to:
比较所述截断长度与所述对象文件的长度;Comparing the truncation length with a length of the object file;
若所述截断长度小于所述对象文件的长度,则从所述对象文件结尾的位置开始,清除所述对象文件的内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件;If the truncation length is less than the length of the object file, the content of the object file is cleared from the position at the end of the object file until the length of the object file is equal to the truncation length, and the truncation is obtained. Object file
若所述截断长度等于所述对象文件的长度,则确定截断后的对象文件为截断前的所述对象文件;If the truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
若所述截断长度大于所述对象文件的长度,则从所述对象文件结尾的位置开始,填充空白内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件。If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained.
具体地,所述截断模块803,还配置为:Specifically, the truncation module 803 is further configured to:
若所述对象文件设置有互斥锁,则返回所述对象文件不可截断的响应,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件。 If the object file is provided with a mutex lock, returning an uninterruptible response of the object file, wherein the mutex is used to prohibit user equipment other than the user equipment that sets the mutex from appending or truncating the setting mutual The object file that is slammed.
参见图9,本申请实施例提供一种服务器,包括:至少一个处理器901;以及存储器902;其中,所述处理器901包括:第一接收模块701、响应模块702、第二接收模块703以及追加模块704;其中,Referring to FIG. 9 , an embodiment of the present application provides a server, including: at least one processor 901; and a memory 902. The processor 901 includes: a first receiving module 701, a response module 702, a second receiving module 703, and An additional module 704; wherein
第一接收模块701,配置为接收用户设备发送的预约请求,其中,所述预约请求包括需要进行追加操作的对象文件的标识;The first receiving module 701 is configured to receive a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
响应模块702,配置为根据所述需要进行追加操作的对象文件的标识,确定该标识对应的对象文件,并向所述用户设备返回确定的对象文件是否可追加的响应;The response module 702 is configured to determine an object file corresponding to the identifier according to the identifier of the object file that needs to be added, and return a response to whether the determined object file can be added to the user equipment;
第二接收模块703,配置为若返回的响应为确定的对象文件可追加的响应,则接收用户设备发送的针对所述对象文件的追加请求,其中,所述追加请求包括追加内容以及追加的起始位置;The second receiving module 703 is configured to receive an additional request for the target file sent by the user equipment, if the returned response is a response that can be added to the specified object file, wherein the additional request includes additional content and an additional request Starting position
追加模块704,配置为根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加,得到追加后的对象文件。The adding module 704 is configured to add the target file based on the additional content and the added starting position, and obtain the added target file.
具体地,向所述用户设备返回确定的对象文件是否可追加的响应,所述响应模块702具体配置为:Specifically, the user equipment is returned to the user equipment whether the determined object file is appendable. The response module 702 is specifically configured to:
判断确定的对象文件是否设置有互斥锁,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件;Determining whether the determined object file is set with a mutex lock, wherein the mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock;
若是,则向所述用户设备返回所述对象文件不可追加的响应;否则,向所述用户设备返回所述对象文件可追加的响应。If yes, return a response that the object file cannot be added to the user equipment; otherwise, return a response that the object file can be added to the user equipment.
具体地,所述对象文件可追加的响应包括:所述对象文件的偏移位置,其中,所述用户设备根据所述对象文件的偏移位置生成追加的起始位置。Specifically, the response that the object file can be appended includes: an offset position of the object file, wherein the user equipment generates an additional starting position according to the offset position of the object file.
具体地,所述预约请求包括,追加内容的长度;Specifically, the reservation request includes a length of the additional content;
若确定的对象文件未设置有互斥锁,所述响应模块702还配置为:If the determined object file is not provided with a mutex, the response module 702 is further configured to:
设定所述预约请求中追加内容的长度为约定的追加长度;Setting a length of the additional content in the reservation request to be an agreed additional length;
所述追加模块704还配置为:The appending module 704 is further configured to:
判断所述追加的起始位置所对应的长度与约定的追加长度是否一致; Determining whether the length corresponding to the added starting position is consistent with the agreed additional length;
若所述追加的起始位置所对应的长度与约定的追加长度不一致,则向所述用户设备发送重新申请偏移位置的响应。If the length corresponding to the added start position does not match the agreed additional length, a response to re-apply the offset position is sent to the user equipment.
具体地,若确定的对象文件未设置互斥锁,所述响应模块702还配置为:Specifically, if the determined object file is not set with a mutex lock, the response module 702 is further configured to:
对所述对象文件设置互斥锁。Set a mutex lock on the object file.
具体地,所述追加模块704还配置为:Specifically, the appending module 704 is further configured to:
去除对所述对象文件设置的互斥锁。Remove the mutex set on the object file.
参见图10,本申请实施例提供一种服务器,包括:至少一个处理器1001;以及存储器1002;其中,所述处理器1001包括:接收模块801、确定模块802以及截断模块803;其中,Referring to FIG. 10, an embodiment of the present application provides a server, including: at least one processor 1001; and a memory 1002. The processor 1001 includes: a receiving module 801, a determining module 802, and a truncating module 803.
接收模块801,配置为接收用户设备发送的截断请求,其中,所述截断请求包括:需要进行截断操作的对象文件的标识以及截断长度;The receiving module 801 is configured to receive a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
确定模块802,配置为根据所述需要进行截断操作的对象文件的标识,确定需要进行截断操作的对象文件;The determining module 802 is configured to determine an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
截断模块803,配置为根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件。The truncation module 803 is configured to truncate the object file according to the truncation length to obtain a truncated object file.
具体地,所述截断模块803,具体配置为:Specifically, the truncation module 803 is specifically configured to:
比较所述截断长度与所述对象文件的长度;Comparing the truncation length with a length of the object file;
若所述截断长度小于所述对象文件的长度,则从所述对象文件结尾的位置开始,清除所述对象文件的内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件;If the truncation length is less than the length of the object file, the content of the object file is cleared from the position at the end of the object file until the length of the object file is equal to the truncation length, and the truncation is obtained. Object file
若所述截断长度等于所述对象文件的长度,则确定截断后的对象文件为截断前的所述对象文件;If the truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
若所述截断长度大于所述对象文件的长度,则从所述对象文件结尾的位置开始,填充空白内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件。If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained.
具体地,所述截断模块803,还配置为:Specifically, the truncation module 803 is further configured to:
若所述对象文件设置有互斥锁,则返回所述对象文件不可截断的响应, 其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件。If the object file is set with a mutex lock, returning an uninterruptible response of the object file, The mutex is used to prohibit the user equipment other than the user equipment that sets the mutex from appending or truncating the object file for setting the mutex.
其中,本申请实施例提供的服务器可为对象存储集群。The server provided by the embodiment of the present application may be an object storage cluster.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the various embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on such understanding, the above-described technical solutions may be embodied in the form of software products in essence or in the form of software products, which may be stored in a computer readable storage medium such as ROM/RAM, magnetic Discs, optical discs, etc., include instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments or portions of the embodiments.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。 Finally, it should be noted that the above embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still The technical solutions described in the foregoing embodiments are modified, or the equivalents of the technical features are replaced by the equivalents. The modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (18)

  1. 一种对象文件的追加方法,应用于服务器,其特征在于,包括:A method for appending an object file to a server, comprising:
    接收用户设备发送的预约请求,其中,所述预约请求包括需要进行追加操作的对象文件的标识;Receiving a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
    根据所述需要进行追加操作的对象文件的标识,确定该标识对应的对象文件,并向所述用户设备返回确定的对象文件是否可追加的响应;Determining, according to the identifier of the object file that needs to be added, determining an object file corresponding to the identifier, and returning, to the user equipment, a response of whether the determined object file is appendable;
    若返回的响应为确定的对象文件可追加的响应,则接收用户设备发送的针对所述对象文件的追加请求,其中,所述追加请求包括追加内容以及追加的起始位置;If the returned response is a response that can be added to the determined object file, receiving an additional request for the object file sent by the user equipment, wherein the additional request includes the additional content and the added starting position;
    根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加,得到追加后的对象文件。The object file is added based on the additional content and the added start position, and the added object file is obtained.
  2. 根据权利要求1所述的方法,其特征在于,向所述用户设备返回确定的对象文件是否可追加的响应,包括:The method according to claim 1, wherein the returning to the user equipment whether the determined object file is appendable comprises:
    判断确定的对象文件是否设置有互斥锁,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件;Determining whether the determined object file is set with a mutex lock, wherein the mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock;
    若是,则向所述用户设备返回所述对象文件不可追加的响应;If yes, returning, to the user equipment, a response that the object file cannot be added;
    否则,向所述用户设备返回所述对象文件可追加的响应。Otherwise, a response that the object file can be appended is returned to the user device.
  3. 根据权利要求2所述的方法,其特征在于,所述对象文件可追加的响应包括:所述对象文件的偏移位置,其中,所述用户设备根据所述对象文件的偏移位置生成追加的起始位置。The method according to claim 2, wherein the object file appendable response comprises: an offset position of the object file, wherein the user equipment generates an append according to an offset position of the object file starting point.
  4. 根据权利要求2所述的方法,其特征在于,所述预约请求包括:追加内容的长度;The method according to claim 2, wherein the reservation request comprises: a length of the additional content;
    若确定的对象文件未设置有互斥锁,该方法还包括:If the determined object file is not provided with a mutex, the method further includes:
    设定所述预约请求中追加内容的长度为约定的追加长度;Setting a length of the additional content in the reservation request to be an agreed additional length;
    在根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追 加之前,该方法还包括:Chasing the object file based on the additional content and the added starting position Before adding, the method also includes:
    判断所述追加内容的长度与约定的追加长度是否一致;Determining whether the length of the additional content matches the agreed additional length;
    若所述追加内容的长度与约定的追加长度不一致,则向所述用户设备发送重新申请偏移位置的响应。If the length of the additional content does not match the agreed additional length, a response to re-apply the offset position is transmitted to the user equipment.
  5. 根据权利要求2所述的方法,其特征在于,若确定的对象文件未设置互斥锁,该方法还包括:The method according to claim 2, wherein if the determined object file is not set with a mutex, the method further comprises:
    对所述对象文件设置互斥锁。Set a mutex lock on the object file.
  6. 根据权利要求5所述的方法,其特征在于,在对所述对象文件进行追加之后,该方法还包括:The method according to claim 5, wherein after the object file is appended, the method further comprises:
    去除对所述对象文件设置的互斥锁。Remove the mutex set on the object file.
  7. 一种对象文件的截断方法,应用于服务器,其特征在于,包括:A method for truncating an object file, applied to a server, comprising:
    接收用户设备发送的截断请求,其中,所述截断请求包括:需要进行截断操作的对象文件的标识以及截断长度;Receiving a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
    根据所述需要进行截断操作的对象文件的标识,确定需要进行截断操作的对象文件;Determining an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
    根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件。The object file is truncated according to the truncation length to obtain a truncated object file.
  8. 根据权利要求7所述的方法,其特征在于,根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件,包括:The method according to claim 7, wherein the truncating object file is truncated according to the truncated length, and the truncated object file is obtained, including:
    比较所述截断长度与所述对象文件的长度;Comparing the truncation length with a length of the object file;
    若所述截断长度小于所述对象文件的长度,则从所述对象文件结尾的位置开始,清除所述对象文件的内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件;If the truncation length is less than the length of the object file, the content of the object file is cleared from the position at the end of the object file until the length of the object file is equal to the truncation length, and the truncation is obtained. Object file
    若所述截断长度等于所述对象文件的长度,则确定截断后的对象文件为截断前的所述对象文件;If the truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
    若所述截断长度大于所述对象文件的长度,则从所述对象文件结尾的位置开始,填充空白内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件。 If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained.
  9. 根据权利要求7所述的方法,其特征在于,在确定需要进行截断操作的对象文件之后,该方法还包括:The method according to claim 7, wherein after determining the object file that needs to be subjected to the truncation operation, the method further comprises:
    若所述对象文件设置有互斥锁,则返回所述对象文件不可截断的响应,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件。If the object file is provided with a mutex lock, returning an uninterruptible response of the object file, wherein the mutex is used to prohibit user equipment other than the user equipment that sets the mutex from appending or truncating the setting mutual The object file that is slammed.
  10. 一种服务器,其特征在于,包括:至少一个处理器;以及存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:A server, comprising: at least one processor; and a memory; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to Enabling the at least one processor to:
    接收用户设备发送的预约请求,其中,所述预约请求包括需要进行追加操作的对象文件的标识;Receiving a reservation request sent by the user equipment, where the reservation request includes an identifier of an object file that needs to perform an additional operation;
    根据所述需要进行追加操作的对象文件的标识,确定该标识对应的对象文件,并向所述用户设备返回确定的对象文件是否可追加的响应;Determining, according to the identifier of the object file that needs to be added, determining an object file corresponding to the identifier, and returning, to the user equipment, a response of whether the determined object file is appendable;
    若返回的响应为确定的对象文件可追加的响应,则接收用户设备发送的针对所述对象文件的追加请求,其中,所述追加请求包括追加内容以及追加的起始位置;If the returned response is a response that can be added to the determined object file, receiving an additional request for the object file sent by the user equipment, wherein the additional request includes the additional content and the added starting position;
    根据所述追加内容以及所述追加的起始位置,对所述对象文件进行追加,得到追加后的对象文件。The object file is added based on the additional content and the added start position, and the added object file is obtained.
  11. 根据权利要求10所述的服务器,其特征在于,向所述用户设备返回确定的对象文件是否可追加的响应,包括:The server according to claim 10, wherein the returning to the user equipment whether the determined object file is appendable comprises:
    判断确定的对象文件是否设置有互斥锁,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件;Determining whether the determined object file is set with a mutex lock, wherein the mutex lock is used to prohibit the user equipment other than the user equipment that sets the mutex lock from appending or truncating the object file for setting the mutex lock;
    若是,则向所述用户设备返回所述对象文件不可追加的响应;否则,向所述用户设备返回所述对象文件可追加的响应。If yes, return a response that the object file cannot be added to the user equipment; otherwise, return a response that the object file can be added to the user equipment.
  12. 根据权利要求11所述的服务器,其特征在于,所述对象文件可追加的响应包括:所述对象文件的偏移位置,其中,所述用户设备根据所述对象文件的偏移位置生成追加的起始位置。 The server according to claim 11, wherein the response that the object file can be appended includes: an offset position of the object file, wherein the user equipment generates an additional according to an offset position of the object file. starting point.
  13. 根据权利要求11所述的服务器,其特征在于,所述预约请求包括:追加内容的长度;The server according to claim 11, wherein the reservation request comprises: a length of the additional content;
    若确定的对象文件未设置有互斥锁,所述计算机可执行指令还用于:If the determined object file is not provided with a mutex, the computer executable instructions are also used to:
    设定所述预约请求中追加内容的长度为约定的追加长度;Setting a length of the additional content in the reservation request to be an agreed additional length;
    所述追加模块还用于:The additional module is also used to:
    判断所述追加内容的长度与约定的追加长度是否一致;Determining whether the length of the additional content matches the agreed additional length;
    若所述追加内容的长度与约定的追加长度不一致,则向所述用户设备发送重新申请偏移位置的响应。If the length of the additional content does not match the agreed additional length, a response to re-apply the offset position is transmitted to the user equipment.
  14. 根据权利要求11所述的服务器,其特征在于,若确定的对象文件未设置互斥锁,所述计算机可执行指令还用于:The server according to claim 11, wherein if the determined object file is not provided with a mutex, the computer executable instructions are further used to:
    对所述对象文件设置互斥锁。Set a mutex lock on the object file.
  15. 根据权利要求14所述的服务器,其特征在于,所述计算机可执行指令还用于:The server according to claim 14, wherein said computer executable instructions are further for:
    去除对所述对象文件设置的互斥锁。Remove the mutex set on the object file.
  16. 一种服务器,其特征在于,包括:至少一个处理器;以及存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:A server, comprising: at least one processor; and a memory; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to Enabling the at least one processor to:
    接收用户设备发送的截断请求,其中,所述截断请求包括:需要进行截断操作的对象文件的标识以及截断长度;Receiving a truncation request sent by the user equipment, where the truncation request includes: an identifier of an object file that needs to perform a truncation operation, and a truncation length;
    根据所述需要进行截断操作的对象文件的标识,确定需要进行截断操作的对象文件;Determining an object file that needs to perform a truncation operation according to the identifier of the object file that needs to perform the truncation operation;
    根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件。The object file is truncated according to the truncation length to obtain a truncated object file.
  17. 根据权利要求16所述的服务器,其特征在于,根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件,包括:The server according to claim 16, wherein the object file is truncated according to the truncated length, and the truncated object file is obtained, including:
    比较所述截断长度与所述对象文件的长度;Comparing the truncation length with a length of the object file;
    若所述截断长度小于所述对象文件的长度,则从所述对象文件结尾的位置开始,清除所述对象文件的内容,直到所述对象文件的长度与所述截断长 度相等为止,得到截断后的对象文件;If the truncation length is less than the length of the object file, the content of the object file is cleared from the position at the end of the object file until the length of the object file is longer than the truncation Obtain the object file after truncation until the degree is equal;
    若所述截断长度等于所述对象文件的长度,则确定截断后的对象文件为截断前的所述对象文件;If the truncation length is equal to the length of the object file, determining that the truncated object file is the object file before truncation;
    若所述截断长度大于所述对象文件的长度,则从所述对象文件结尾的位置开始,填充空白内容,直到所述对象文件的长度与所述截断长度相等为止,得到截断后的对象文件。If the truncation length is greater than the length of the object file, the blank content is filled from the end of the object file until the length of the object file is equal to the truncation length, and the truncated object file is obtained.
  18. 根据权利要求16所述的服务器,其特征在于,根据所述截断长度,对所述对象文件进行截断,得到截断后的对象文件,包括:The server according to claim 16, wherein the object file is truncated according to the truncated length, and the truncated object file is obtained, including:
    若所述对象文件设置有互斥锁,则返回所述对象文件不可截断的响应,其中,所述互斥锁用于禁止除设置该互斥锁的用户设备以外的用户设备追加或截断设置互斥锁的对象文件。 If the object file is provided with a mutex lock, returning an uninterruptible response of the object file, wherein the mutex is used to prohibit user equipment other than the user equipment that sets the mutex from appending or truncating the setting mutual The object file that is slammed.
PCT/CN2016/099970 2016-06-30 2016-09-23 Object file appending and truncation method and server WO2018000618A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610506560.3 2016-06-30
CN201610506560.3A CN106202275A (en) 2016-06-30 2016-06-30 Additional, the method for cutting of obj ect file and device

Publications (1)

Publication Number Publication Date
WO2018000618A1 true WO2018000618A1 (en) 2018-01-04

Family

ID=57464241

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/099970 WO2018000618A1 (en) 2016-06-30 2016-09-23 Object file appending and truncation method and server

Country Status (2)

Country Link
CN (1) CN106202275A (en)
WO (1) WO2018000618A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109194736A (en) * 2018-08-30 2019-01-11 百度在线网络技术(北京)有限公司 Message De-weight method, device, electronic equipment, medium and unmanned vehicle

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664208B (en) * 2017-03-27 2022-02-15 珠海极海半导体有限公司 File additional writing operation method and device based on FLASH memory

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104090943A (en) * 2014-07-01 2014-10-08 中国工商银行股份有限公司 Data file processing method, device and system
US9213718B1 (en) * 2011-06-22 2015-12-15 Emc Corporation Synchronized file management across multiple disparate endpoints
CN105681367A (en) * 2014-11-17 2016-06-15 中国移动通信集团公司 Method, server and client for sharing file contents

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064843B (en) * 2011-10-20 2016-03-16 北京中搜网络技术股份有限公司 Data processing equipment and data processing method
CN104731886B (en) * 2015-03-12 2018-11-20 深圳市连用科技有限公司 A kind of processing method and system of mass small documents
CN105045631A (en) * 2015-07-30 2015-11-11 北京奇虎科技有限公司 Method and device for upgrading client-side applications
CN105608162B (en) * 2015-12-17 2019-03-19 网易(杭州)网络有限公司 Document handling method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9213718B1 (en) * 2011-06-22 2015-12-15 Emc Corporation Synchronized file management across multiple disparate endpoints
CN104090943A (en) * 2014-07-01 2014-10-08 中国工商银行股份有限公司 Data file processing method, device and system
CN105681367A (en) * 2014-11-17 2016-06-15 中国移动通信集团公司 Method, server and client for sharing file contents

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109194736A (en) * 2018-08-30 2019-01-11 百度在线网络技术(北京)有限公司 Message De-weight method, device, electronic equipment, medium and unmanned vehicle
CN109194736B (en) * 2018-08-30 2021-04-27 百度在线网络技术(北京)有限公司 Message duplicate removal method and device, electronic equipment, medium and unmanned vehicle
US11050814B2 (en) 2018-08-30 2021-06-29 Baidu Online Network Technology (Beijing) Co., Ltd. Method, device and vehicle for message deduplication

Also Published As

Publication number Publication date
CN106202275A (en) 2016-12-07

Similar Documents

Publication Publication Date Title
US10956601B2 (en) Fully managed account level blob data encryption in a distributed storage environment
US11481289B2 (en) Method and apparatus for reading and writing committed data
US10942812B2 (en) System and method for building a point-in-time snapshot of an eventually-consistent data store
US10108632B2 (en) Splitting and moving ranges in a distributed system
KR101862718B1 (en) Reducing data volume durability state for block-based storage
EP3258369B1 (en) Systems and methods for distributed storage
US20190007206A1 (en) Encrypting object index in a distributed storage environment
US10659225B2 (en) Encrypting existing live unencrypted data using age-based garbage collection
WO2017215432A1 (en) Data retracement method, device and system
CN111290826A (en) Distributed file system, computer system, and medium
US9600486B2 (en) File system directory attribute correction
US10620871B1 (en) Storage scheme for a distributed storage system
US10924275B1 (en) Creating multiple encrypted volumes from a single source
US11409711B2 (en) Barriers for dependent operations among sharded data stores
CN104641650A (en) Source reference replication in a data storage subsystem
US11221993B2 (en) Limited deduplication scope for distributed file systems
WO2015039569A1 (en) Copy storage device and copy storage method
WO2022127762A1 (en) Cloud platform and bucket management method for object storage service provided thereby
WO2014015782A1 (en) Distributed file system, file accessing method, and client
WO2016101759A1 (en) Data routing method, data management device and distributed storage system
WO2018000618A1 (en) Object file appending and truncation method and server
US10545667B1 (en) Dynamic data partitioning for stateless request routing
US20110289059A1 (en) Ordering volumes and tracks for data transfer based on usage characteristics
WO2012171363A1 (en) Method and equipment for data operation in distributed cache system
Hwang et al. Fulfilling mutual nonrepudiation for cloud storage

Legal Events

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

Ref document number: 16907014

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16907014

Country of ref document: EP

Kind code of ref document: A1