CN110515909B - File storage method and device, electronic equipment and computer storage medium - Google Patents

File storage method and device, electronic equipment and computer storage medium Download PDF

Info

Publication number
CN110515909B
CN110515909B CN201910810550.2A CN201910810550A CN110515909B CN 110515909 B CN110515909 B CN 110515909B CN 201910810550 A CN201910810550 A CN 201910810550A CN 110515909 B CN110515909 B CN 110515909B
Authority
CN
China
Prior art keywords
file
node
storage
stored
tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910810550.2A
Other languages
Chinese (zh)
Other versions
CN110515909A (en
Inventor
彭龙腾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Douyin Vision Beijing Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201910810550.2A priority Critical patent/CN110515909B/en
Publication of CN110515909A publication Critical patent/CN110515909A/en
Application granted granted Critical
Publication of CN110515909B publication Critical patent/CN110515909B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/13File access structures, e.g. distributed indices
    • 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/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the disclosure relates to the technical field of data storage, and discloses a file storage method, a file storage device, an electronic device and a computer-readable storage medium, wherein the file storage method comprises the following steps: acquiring a request for storing at least one file to be stored; then, according to the request, determining the node position of each file to be stored in the corresponding file tree, wherein the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree; and then, storing each file to be stored to a corresponding node position respectively. The method of the embodiment of the disclosure can organize the associated files into a file tree, thereby conveniently managing each file, not only avoiding the storage position error caused by the fact that a user cannot determine the association relationship between the files, but also quickly and accurately positioning a certain file to be searched according to the file tree, and greatly improving the query efficiency.

Description

File storage method and device, electronic equipment and computer storage medium
Technical Field
The embodiment of the disclosure relates to the technical field of data storage, in particular to a file storage method and device, electronic equipment and a computer storage medium.
Background
With the penetration of computer technology to various aspects, various industries are computerized, and many original paper files are changed into computer files. In the fields of software development, hardware development, medical treatment, internet and the like, a large number of files such as electronic documents, electronic forms, electronic book boxes and the like which need to be stored are generated every day.
At present, computer devices generally use a storage mode of directory folders to store files, for example, when an item relates to multiple files, a user needs to put each file associated with the item into a common directory folder, however, if the user cannot determine to which directory folder the file to be stored needs to be stored, an error occurs in a storage location of the file to be stored. In addition, when a user views a certain file, the user needs to find the public directory folder first, and then browse and filter all the files in the public directory folder, so as to find the certain file, which results in a great amount of time and energy waste for the user.
Disclosure of Invention
The purpose of the disclosed embodiments is to address at least one of the above-mentioned deficiencies, and it is intended to provide a summary in order to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In one aspect, a file storage method is provided, including:
acquiring a request for storing at least one file to be stored;
determining the node position of each file to be stored in the corresponding file tree according to the request, wherein the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree;
and respectively storing each file to be stored to a corresponding node position.
In one aspect, a file storage apparatus is provided, including:
the acquisition module is used for acquiring a request for storing at least one file to be stored;
the determining module is used for determining the node position of each file to be stored in the corresponding file tree according to the request, wherein the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree;
and the storage module is used for respectively storing the files to be stored to the corresponding node positions.
In one aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the file storage method is implemented.
In one aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor implements the file storage method described above.
According to the file storage method provided by the embodiment of the disclosure, the node positions of the files to be stored in the corresponding file trees are determined according to the acquired request for storing at least one file to be stored, and the files to be stored are respectively stored to the corresponding node positions, wherein the node positions are child file nodes of target parent file nodes in the file trees or root file nodes in the file trees, so that the associated files can be organized into one file tree, and therefore, the files are conveniently managed, storage position errors caused by the fact that a user cannot determine the association relationship among the files can be avoided, a certain file to be searched can be quickly and accurately positioned according to the file trees, and query efficiency is greatly improved.
Additional aspects and advantages of embodiments of the disclosure will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the disclosure.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
FIG. 1 is a schematic flow chart diagram illustrating a file storage method according to an embodiment of the present disclosure;
FIG. 2 is a file tree diagram of a file store according to an embodiment of the present disclosure;
fig. 3a, 3b, and 3c are schematic diagrams of a file tree obtained by storing root file nodes according to an embodiment of the disclosure;
FIG. 4 is a schematic diagram of a basic structure of a file storage device according to an embodiment of the present disclosure;
FIG. 5 is a detailed structural diagram of a file storage device according to an embodiment of the disclosure;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing the devices, modules or units, and are not used for limiting the devices, modules or units to be different devices, modules or units, and also for limiting the sequence or interdependence relationship of the functions executed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the embodiments of the present disclosure will be described in further detail below with reference to the accompanying drawings.
The file storage method, the file storage device, the electronic device and the computer storage medium provided by the embodiment of the disclosure aim to solve the above technical problems in the prior art.
The following describes in detail the technical solutions of the embodiments of the present disclosure and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
One embodiment of the present disclosure provides a file storage method, which is performed by a computer device, and the computer device may be a terminal or a server. The terminal may be a desktop device or a mobile terminal. The servers may be individual physical servers, clusters of physical servers, or virtual servers.
As shown in fig. 1, the method includes:
step S110, a request for storing at least one file to be stored is obtained.
Specifically, when a user stores at least one file to be stored (e.g., 1, 2, 5, etc.) through a computer device, a request for storing the at least one file to be stored may be sent to the computer device. Correspondingly, the computer equipment acquires the request for storing at least one file to be stored.
Step S120, according to the request, determining the node position of each file to be stored in the corresponding file tree, where the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree.
Specifically, after acquiring a request for storing at least one file to be stored, the computer device may determine, according to the request, a node position of each file to be stored in a file tree corresponding to each file to be stored. The node position may be a child file node of a target parent file node in the file tree, or may be a root file node in the file tree.
For example, it is determined that the file K to be stored belongs to the established file tree T1, and the node position of the file K in the file tree T1 is a child file node of the target parent file node C, i.e., the node position of the file K to be stored in the corresponding file tree is a child file node of the target parent file node. For another example, it is determined that the file K to be stored does not belong to any established file tree (e.g., the file tree T1, the file tree T2), at this time, a file tree T3 may be created, and the file K to be stored is determined to be a root file node of the file tree T3, that is, the node position of the file K to be stored in the corresponding file tree is a root file node.
Step S130, storing each file to be stored to a corresponding node position.
Specifically, after determining the node positions of the files to be stored in the file trees corresponding to the respective nodes, the computer device may store the files to be stored to the corresponding node positions, respectively.
If the file tree corresponding to the file K to be stored is the file tree T1, and the node position in the file tree T1 is determined to be the child file node of the target parent file node C, the file K to be stored is stored as the child file node of the target parent file node C, that is, the file K to be stored is mounted below the target parent file node C.
If the file tree corresponding to the file K to be stored is the file tree T3 and the node position of the file tree K to be stored in the file tree T3 is determined to be the root file node, the file K to be stored is stored as the root file node of the file tree T3. When the file tree corresponding to another file to be stored (for example, the file N) is the file tree T3 and the node position of the file tree T3 is determined to be the child file node of the target parent file node K, the file N to be stored is stored as the child file node of the root file node K, that is, the file N to be stored is mounted below the root file node K.
According to the file storage method provided by the embodiment of the disclosure, the node positions of the files to be stored in the corresponding file trees are determined according to the acquired request for storing at least one file to be stored, and the files to be stored are respectively stored to the corresponding node positions, wherein the node positions are child file nodes of target parent file nodes in the file trees or root file nodes in the file trees, so that the associated files can be organized into one file tree, and therefore, the files are conveniently managed, storage position errors caused by the fact that a user cannot determine the association relationship among the files can be avoided, a certain file to be searched can be quickly and accurately positioned according to the file trees, and query efficiency is greatly improved.
In a possible implementation manner, in the process of storing each file to be stored to a corresponding node position, it is required to detect each file to be stored first to determine whether each file to be stored has been stored or mounted. The detection process of each file to be stored is the same, and the following introduces the detection process by taking any file to be stored as an example, and specifically as follows:
in the process of storing any file to be stored to a corresponding node position, whether a storage record of a storage file with the same file name as that of the any file to be stored exists in a file storage record database is detected, and for convenience of introduction, the storage file with the same file name as that of the any file to be stored is marked as a first storage file below, wherein:
(1) if the storage record of the first storage file does not exist in the file storage record database, then: (a) any file to be stored can be stored as a root file node, that is, a file tree is newly created, and the file to be stored is stored as the root file node of the newly created file tree. In other words, when the storage record of the first storage file does not exist in the file storage record database, any file to be stored is stored as a root file node, and the first storage file is a storage file with the same file name as that of any file to be stored. (b) The file to be stored may be stored as a child file node of a corresponding target parent file node in the file tree corresponding to the file to be stored, that is, the file to be stored is mounted below the corresponding target parent file node. In other words, when the storage record of the first storage file does not exist in the file storage record database, any file to be stored is stored as a child file node of the corresponding target parent file node.
(2) If the storage record of the first storage file exists in the file storage record database, then: (c) if the parent file node of the first storage file is empty, that is, the first storage file is stored as the root file node of the file tree, the any file to be stored may be stored as the root file node of the file tree, that is, the first storage file is updated according to the any file to be stored, that is, the first storage file is replaced by the any file to be stored. (d) If the parent file node of the first storage file is not empty, that is, the first storage file has a parent file node (for example, a parent file node H), that is, the first storage file is stored as a child file node of the parent file node H, the first storage file may be updated according to the any file to be stored based on the file storage record database, that is, the first storage file is replaced with the any file to be stored.
As shown in fig. 2, the file tree formed in the above description process includes two file trees in fig. 2, where file a, file B, file D, and file C are one file tree (denoted as file tree T1), in the file tree T1, file a is a root file node, file B is a parent file node of file C, and file a is a parent file node of file B and file D; the file E, the file F, the file G, and the file H are another file (referred to as a file tree T2), and in the file tree T2, the file E is a root file node, the file F is a parent file node of the file G and the file H, and the file E is a parent file node of the file F.
In a possible implementation manner, in the process of storing any file to be stored as a child file node of a corresponding target parent file node, further detection needs to be performed on the any file to be stored to determine whether the any file to be stored is already on a storage path of the target parent file node. The specific detection process comprises the following steps:
first, path information (i.e., storage path) of a target parent file node is determined, wherein the path information includes the target parent file node, a root file node of a file tree of the target parent file node, and each file node between the target parent file node and the root file node of the file tree corresponding thereto.
Specifically, taking the file tree T1 in fig. 2 as an example, if the target parent file node is file C and any file to be stored is file K, the path information of the target parent file node C is the respective file nodes including the target parent file node (i.e., file C), the root file node of the file tree of the target parent file node (i.e., file a), and the respective file nodes between the target parent file node and the root file node of the file tree corresponding thereto (i.e., file B), i.e., the path information of the target parent file node C is file a, file B, and file C.
Secondly, after the path information of the target parent file node is determined, whether the path information comprises a file node formed according to the first storage file is detected, namely whether a storage file with the same file name as that of any file K to be stored exists in the path information is detected.
If the path information includes a file node formed according to the first storage file, that is, the path information includes a storage file having the same file name as that of the any file K to be stored, the first storage file is updated according to the any file K to be stored, that is, the first storage file is replaced by the any file K to be stored. (2) If the path information does not include a file node formed according to the first storage file, that is, the path information does not have a storage file with the same file name as that of any file K to be stored, the file K to be stored is stored as a child file node of a corresponding target parent file node (file C), that is, the file K to be stored is mounted below the corresponding target parent file node (file C).
In a possible implementation manner, when any file to be stored is a root file node of any file tree, in the process of storing any file to be stored as a child file node of a corresponding target parent file node, the process cannot be directly performed according to the storage process of any file to be stored. Because, if the storage is performed directly according to any of the above storage procedures of the files to be stored, two file trees are easy to form a ring, for example, the user U1 stores the file A in the file tree T1 as a subfile node of the file node G of the file tree T2, and the user U2 stores the file E in the file tree T2 as a subfile node of the file node C of the file tree T1, at this time, the file tree T1 and the file tree T2 form a closed loop, as shown in FIG. 3C, thereby destroying the tree structure of the file tree. Therefore, when it is detected that the user U1 stores the file a (root file node) in the file tree T1 as a child file node of a parent file node (e.g., file G) of any other file tree (e.g., the file tree T2), the following storage procedure may be performed:
first, locking the root file nodes of other file trees except the root file node (i.e. file a) of any file tree, wherein after locking the root file nodes of other file trees, the root file nodes of other file trees are not allowed to be stored as the child file nodes of any file node in any file tree, nor are the child file nodes of any file tree allowed to be stored as the child file nodes of the root file node in other file trees, so as to prevent any two file trees from forming a closed loop.
And secondly, storing the root file node of any file tree as a child file node of a corresponding target parent file node. For example, the root file node A of the file tree T1 is stored as a child file node of the parent file node G of the file tree T2, i.e., the file tree T1 is mounted below the file G of the file tree T2, as shown in FIG. 3 b. As another example, the root file node E of the file tree T2 is stored as a child file node of the parent file node C of the file tree T1, i.e., the file tree T2 is mounted below the file C of the file tree T1, as shown in FIG. 3 a.
In the process of locking root file nodes of other file trees except the root file node (namely, the file A) of any file tree, if the root file nodes of other file trees are determined to be successfully locked, corresponding prompt information of successful locking can be generated to remind a user of successful locking, and if the root file nodes of other file trees are determined to be unsuccessfully locked, prompt information of unsuccessful locking can be generated to remind the user of unsuccessful locking, wherein the prompt information of unsuccessful locking can also comprise information of the reason, the error type and the like of unsuccessful locking.
In addition, after the root file node of any file tree is stored as the child file node of the corresponding target parent file node, a new file tree is formed by the file tree where the root file node of any file tree and the target parent file node are located, as shown in fig. 3a and 3b, that is, a corresponding file tree is generated according to the file trees of any file tree and the target parent file node. Wherein, after the file tree is generated, the generated file tree can be returned to the user for viewing by the user.
Fig. 4 is a schematic structural diagram of a file storage apparatus according to another embodiment of the present disclosure, as shown in fig. 4, the apparatus 40 may include an obtaining module 41, a determining module 42, and a storing module 43, where:
an obtaining module 41, configured to obtain a request for storing at least one file to be stored;
a determining module 42, configured to determine, according to the request, node positions of the respective files to be stored in the respective corresponding file trees, where the node positions are child file nodes of target parent file nodes in the file trees or root file nodes in the file trees;
and the storage module 43 is configured to store each file to be stored to a corresponding node position.
Fig. 5 is a detailed schematic structural diagram of a file storage apparatus according to another embodiment of the disclosure, and as shown in fig. 5, the apparatus 50 may include an obtaining module 51, a determining module 52, a storing module 53, a first generating module 54, and a second generating module 55. The function of the obtaining module 51 in fig. 5 is the same as the obtaining module 41 in fig. 4, the function of the determining module 52 in fig. 5 is the same as the determining module 42 in fig. 4, and the function of the storing module 53 in fig. 5 is the same as the storing module 43 in fig. 4, which are not repeated herein. The following describes in detail the file storage apparatus shown in fig. 5:
in particular, the storage module 53 is specifically configured to perform any one of:
when the storage record of the first storage file does not exist in the file storage record database, storing any file to be stored as a root file node, wherein the first storage file is a storage file with the same file name as that of any file to be stored;
when the storage record of the first storage file does not exist in the file storage record database, any file to be stored is used as a child file node of a corresponding target parent file node for storage;
when a storage record of a first storage file exists in the file storage record database and a father file node of the first storage file is empty, storing any file to be stored as a root file node;
and when the storage record of the first storage file exists in the file storage record database and the father file node of the first storage file is not empty, updating the first storage file according to any file to be stored based on the file storage record database.
Specifically, the storage module 53 includes a path determination submodule 531, a detection submodule 532 and a first storage submodule 533, where:
the path determining submodule 531 is configured to determine path information of a target parent file node, where the path information includes the target parent file node, a root file node of a file tree of the target parent file node, and each file node between the target parent file node and the root file node of the file tree corresponding to the target parent file node;
a detection submodule 532, configured to determine whether the path information includes a file node formed according to the first storage file;
the first storage sub-module 533 is configured to, when the path information does not include a file node formed according to the first storage file, store any file to be stored as a child file node of a corresponding target parent file node.
Specifically, the storage module 53 further includes a second storage submodule 534, wherein:
the second storage sub-module 534 is configured to, when the path information includes a file node formed according to the first storage file, update the first storage file according to any file to be stored.
Specifically, when any file to be stored is a root file node of any file tree, the storage module 53 includes a locking sub-module 535 and a third storage sub-module 536, where:
a locking submodule 535, configured to lock root file nodes of other file trees except the root file node of any file tree;
and a third storage submodule 536, configured to store the root file node of any file tree as a child file node of the corresponding target parent file node.
Specifically, a first generation module 54 is also included, wherein:
and a first generating module 54, configured to generate a corresponding file tree according to any file tree and the file tree of the target parent file node.
Specifically, a second generating module 55 is further included, wherein:
a second generating module 55, configured to generate a prompt message that locking is successful when it is determined that locking is successful for all root file nodes of other file trees; or when determining that the locking of the root file nodes of other file trees fails, generating a prompt message of the locking failure.
According to the device provided by the embodiment of the disclosure, the node positions of the files to be stored in the corresponding file trees are determined according to the acquired request for storing at least one file to be stored, and the files to be stored are respectively stored to the corresponding node positions, wherein the node positions are child file nodes of target parent file nodes in the file trees or root file nodes in the file trees, so that the associated files can be organized into one file tree, and thus, the files are conveniently managed, not only can storage position errors caused by the fact that a user cannot determine the association relationship among the files be avoided, but also a certain file to be searched can be quickly and accurately positioned according to the file tree, and the query efficiency is greatly improved.
It should be noted that the present embodiment is an apparatus embodiment corresponding to the method embodiment described above, and the present embodiment can be implemented in cooperation with the method embodiment described above. The related technical details mentioned in the above method embodiments are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the above-described method item embodiments.
Referring now to FIG. 6, a block diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device comprises a memory and a processor, wherein the processor may be referred to as a processing device 601 described below, and the memory comprises at least one of a Read Only Memory (ROM)602, a Random Access Memory (RAM)603, and a storage device 608, which are described in the following, specifically as follows:
as shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be alternatively implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a request for storing at least one file to be stored; determining the node positions of the files to be stored in the corresponding file trees according to the requests; and respectively storing each file to be stored to a corresponding node position, wherein the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. For example, the obtaining module may be further described as a module that obtains at least one event processing manner corresponding to a predetermined live event when the occurrence of the predetermined live event is detected.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a file storage method including:
acquiring a request for storing at least one file to be stored;
determining the node positions of the files to be stored in the corresponding file trees according to the requests;
and respectively storing each file to be stored to a corresponding node position, wherein the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree.
In a possible implementation manner, storing any file to be stored to a corresponding node location includes any one of the following:
when the storage record of a first storage file does not exist in the file storage record database, storing any file to be stored as a root file node, wherein the first storage file is a storage file with the same file name as that of any file to be stored;
when the storage record of the first storage file does not exist in the file storage record database, any file to be stored is used as a child file node of a corresponding target parent file node for storage;
when a storage record of a first storage file exists in the file storage record database and a father file node of the first storage file is empty, storing any file to be stored as a root file node;
and when the storage record of the first storage file exists in the file storage record database and the father file node of the first storage file is not empty, updating the first storage file according to any file to be stored based on the file storage record database.
In one possible implementation manner, storing any file to be stored as a child file node of a corresponding target parent file node includes:
determining path information of a target father file node, wherein the path information comprises the target father file node, a root file node of a file tree of the target father file node and each file node between the target father file node and the root file node of the file tree corresponding to the target father file node;
determining whether a file node formed according to the first storage file is included in the path information;
and if not, storing any file to be stored as a child file node of the corresponding target parent file node.
In one possible implementation manner, the method further includes:
and if the path information comprises file nodes formed according to the first storage file, updating the first storage file according to any file to be stored.
In a possible implementation manner, when any file to be stored is a root file node of any file tree, storing any file to be stored as a child file node of a corresponding target parent file node, includes:
locking root file nodes of other file trees except the root file node of any file tree;
and storing the root file node of any file tree as a child file node of a corresponding target parent file node.
In one possible implementation manner, after storing the root file node of any file tree as a child file node of the corresponding target parent file node, the method further includes:
and generating a corresponding file tree according to any file tree and the file tree of the target parent file node.
In a possible implementation manner, after locking the root file nodes of other file trees except the root file node of any file tree, the method further includes:
when the root file nodes of other file trees are determined to be successfully locked, generating prompt information of successful locking; or,
and when determining that the locking of the root file nodes of other file trees fails, generating a prompt message of the locking failure.
According to one or more embodiments of the present disclosure, there is provided a file storage apparatus including:
the acquisition module is used for acquiring a request for storing at least one file to be stored;
the determining module is used for determining the node positions of the files to be stored in the corresponding file trees according to the request;
and the storage module is used for respectively storing each file to be stored to a corresponding node position, and the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree.
In one possible implementation, the storage module is specifically configured to perform any one of the following:
when the storage record of a first storage file does not exist in the file storage record database, storing any file to be stored as a root file node, wherein the first storage file is a storage file with the same file name as that of any file to be stored;
when the storage record of the first storage file does not exist in the file storage record database, any file to be stored is used as a child file node of a corresponding target parent file node for storage;
when a storage record of a first storage file exists in the file storage record database and a father file node of the first storage file is empty, storing any file to be stored as a root file node;
and when the storage record of the first storage file exists in the file storage record database and the father file node of the first storage file is not empty, updating the first storage file according to any file to be stored based on the file storage record database.
In a possible implementation manner, the storage module includes a path determining sub-module, a detecting sub-module and a first storage sub-module;
the path determining submodule is used for determining path information of a target father file node, wherein the path information comprises the target father file node, a root file node of a file tree of the target father file node and each file node between the target father file node and the root file node of the file tree corresponding to the target father file node;
the detection submodule is used for determining whether the path information comprises a file node formed according to the first storage file;
and the first storage submodule is used for storing any file to be stored as a child file node of a corresponding target parent file node when the path information does not include a file node formed according to the first storage file.
In a possible implementation manner, the storage module further includes a second storage submodule;
and the second storage submodule is used for updating the first storage file according to any file to be stored when the path information comprises file nodes formed according to the first storage file.
In a possible implementation manner, when any file to be stored is a root file node of any file tree, the storage module comprises a locking submodule and a third storage submodule;
the locking submodule is used for locking root file nodes of other file trees except the root file node of any file tree;
and the third storage submodule is used for storing the root file node of any file tree as a child file node of the corresponding target parent file node.
In a possible implementation manner, the system further comprises a first generation module;
and the first generation module is used for generating a corresponding file tree according to any file tree and the file tree of the target parent file node.
In a possible implementation manner, the system further comprises a second generation module;
the second generation module is used for generating a prompt message of successful locking when the root file nodes of other file trees are determined to be successfully locked; or when determining that the locking of the root file nodes of other file trees fails, generating a prompt message of the locking failure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (9)

1. A file storage method, comprising:
acquiring a request for storing at least one file to be stored;
determining the node position of each file to be stored in the corresponding file tree according to the request, wherein the node position is a child file node of a target parent file node in the file tree or a root file node in the file tree; respectively storing each file to be stored to a corresponding node position;
if any file to be stored is a root file node of any file tree;
locking root file nodes of other file trees except the root file node of any file tree;
and storing the root file node of any file tree as a child file node of a corresponding target parent file node.
2. The method according to claim 1, wherein storing any file to be stored to a corresponding node location comprises any one of:
when the storage record of a first storage file does not exist in a file storage record database, storing any file to be stored as a root file node, wherein the first storage file is a storage file with the same file name as that of any file to be stored;
when the storage record of the first storage file does not exist in a file storage record database, storing any file to be stored as a child file node of a corresponding target parent file node;
when the storage record of the first storage file exists in a file storage record database and a parent file node of the first storage file is empty, storing any file to be stored as a root file node;
and when the storage record of the first storage file exists in a file storage record database and the father file node of the first storage file is not empty, updating the first storage file according to any file to be stored based on the file storage record database.
3. The method according to claim 2, wherein storing any file to be stored as a child file node of a corresponding target parent file node comprises:
determining path information of the target parent file node, wherein the path information comprises the target parent file node, a root file node of a file tree of the target parent file node, and each file node between the target parent file node and the root file node of the file tree corresponding to the target parent file node;
determining whether a file node formed according to the first storage file is included in the path information;
and if not, storing any file to be stored as a child file node of the corresponding target parent file node.
4. The method of claim 3, further comprising:
and if the path information comprises a file node formed according to the first storage file, updating the first storage file according to any file to be stored.
5. The method of claim 1, further comprising, after storing a root file node of the any file tree as a child file node of a corresponding target parent file node:
and generating a corresponding file tree according to the file tree of any file tree and the target parent file node.
6. The method according to claim 1, further comprising, after locking the root file nodes of the other file trees except the root file node of any one of the file trees:
when the root file nodes of the other file trees are determined to be successfully locked, generating prompt information of successful locking; or,
and when determining that the locking of the root file nodes of the other file trees fails, generating a prompt message of the locking failure.
7. A file storage device, comprising:
the acquisition module is used for acquiring a request for storing at least one file to be stored;
a determining module, configured to determine, according to the request, node positions of the files to be stored in respective corresponding file trees, where the node positions are child file nodes of target parent file nodes in the file trees or root file nodes in the file trees;
the storage module is used for respectively storing each file to be stored to a corresponding node position;
if any file to be stored is a root file node of any file tree;
locking root file nodes of other file trees except the root file node of any file tree;
and storing the root file node of any file tree as a child file node of a corresponding target parent file node.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the file storage method of any one of claims 1-6 when executing the program.
9. A computer-readable storage medium, characterized in that a computer program is stored thereon, which when executed by a processor implements the file storage method of any one of claims 1 to 6.
CN201910810550.2A 2019-08-29 2019-08-29 File storage method and device, electronic equipment and computer storage medium Active CN110515909B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910810550.2A CN110515909B (en) 2019-08-29 2019-08-29 File storage method and device, electronic equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910810550.2A CN110515909B (en) 2019-08-29 2019-08-29 File storage method and device, electronic equipment and computer storage medium

Publications (2)

Publication Number Publication Date
CN110515909A CN110515909A (en) 2019-11-29
CN110515909B true CN110515909B (en) 2022-05-13

Family

ID=68629332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910810550.2A Active CN110515909B (en) 2019-08-29 2019-08-29 File storage method and device, electronic equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN110515909B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125017B (en) * 2019-12-26 2023-10-13 深圳前海环融联易信息科技服务有限公司 Data storage method and device based on tree structure and computer equipment
CN113238646B (en) * 2021-04-20 2024-04-09 北京易华录信息技术股份有限公司 Energy-saving storage method and device for optical storage cluster

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719141B (en) * 2009-12-24 2011-09-07 成都市华为赛门铁克科技有限公司 File processing method and system based on directory object
CN101799820B (en) * 2010-02-08 2013-03-20 深圳市同洲电子股份有限公司 Flash memory, file system mounted method and device, data management method and device
CN102722368B (en) * 2012-05-21 2013-09-04 北京广利核系统工程有限公司 Plug-in software designing method based on document tree and message pump
CN107783988B (en) * 2016-08-26 2021-12-03 阿里巴巴集团控股有限公司 Method and equipment for locking directory tree
CN107807787B (en) * 2016-09-08 2020-12-22 北京京东尚科信息技术有限公司 Distributed data storage method and system
CN106970958B (en) * 2017-03-17 2019-11-19 浙江大华技术股份有限公司 A kind of inquiry of stream file and storage method and device
CN108021339B (en) * 2017-11-03 2021-05-04 网宿科技股份有限公司 Method and device for reading and writing magnetic disk and computer readable storage medium
CN109271361B (en) * 2018-08-13 2020-07-24 华东计算技术研究所(中国电子科技集团公司第三十二研究所) Distributed storage method and system for massive small files

Also Published As

Publication number Publication date
CN110515909A (en) 2019-11-29

Similar Documents

Publication Publication Date Title
CN109684589B (en) Client comment data processing method and device and computer storage medium
CN112115153B (en) Data processing method, device, equipment and storage medium
CN115757400B (en) Data table processing method, device, electronic equipment and computer readable medium
CN110515909B (en) File storage method and device, electronic equipment and computer storage medium
CN111950857A (en) Index system management method and device based on service indexes and electronic equipment
CN111241137A (en) Data processing method and device, electronic equipment and storage medium
CN111124541A (en) Configuration file generation method, device, equipment and medium
CN111897827B (en) Data updating method and system for data warehouse and electronic equipment
CN110674082B (en) Method and device for removing online document, electronic equipment and computer readable medium
CN117557394A (en) Intelligent account checking method, system, equipment and storage medium
CN113220281A (en) Information generation method and device, terminal equipment and storage medium
CN111399902B (en) Client source file processing method and device, readable medium and electronic equipment
CN115034175A (en) Table data processing method, device, terminal and storage medium
CN110442403B (en) Method, device, electronic equipment and medium for calling functional component
CN115017149A (en) Data processing method and device, electronic equipment and storage medium
CN113553594A (en) Vulnerability information processing method and device, electronic equipment and readable storage medium
CN111294657A (en) Information processing method and device
CN116483808B (en) Data migration method, device, electronic equipment and computer readable medium
CN111984645B (en) Data processing method, device, medium and electronic equipment
CN112800122B (en) Data processing method and device and electronic equipment
CN118035594B (en) Method, apparatus, electronic device and computer readable medium for accessing production document
CN111400322B (en) Method, apparatus, electronic device and medium for storing data
CN117785977A (en) Metadata acquisition method, device and equipment
CN117908948A (en) Version control method, device, equipment, storage medium and product
CN118673022A (en) Data storage method, device, equipment and storage medium for dynamically creating table structure

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.