WO2013075563A1 - File sharing system, method for achieving file sharing, and file index service device - Google Patents

File sharing system, method for achieving file sharing, and file index service device Download PDF

Info

Publication number
WO2013075563A1
WO2013075563A1 PCT/CN2012/083232 CN2012083232W WO2013075563A1 WO 2013075563 A1 WO2013075563 A1 WO 2013075563A1 CN 2012083232 W CN2012083232 W CN 2012083232W WO 2013075563 A1 WO2013075563 A1 WO 2013075563A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
block
copy
client
count value
Prior art date
Application number
PCT/CN2012/083232
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 WO2013075563A1 publication Critical patent/WO2013075563A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Definitions

  • the present invention relates to the field of information technology, and in particular, to a file sharing system, a method for implementing file sharing, and a file indexing service device. Background technique
  • Virtualization technology is to divide physical resources into multiple logical partitions through virtualized software. Each partition is isolated from each other and become independent virtual machines. These virtual machines serve different users by sharing the same physical server.
  • each user corresponds to one virtual machine, and the number of virtual machines may reach hundreds of thousands or even millions. Since each virtual machine has its own operating system and applications, many of these operating systems and applications are duplicated. If each virtual machine has its own operating system and applications installed, it will take up a lot of storage space. This results in a serious waste of storage resources. Summary of the invention
  • a primary object of the present invention is to provide a method and apparatus for file sharing that ensures that multiple clients have both a separate file system and the same file.
  • the invention provides a method for implementing file sharing, comprising the following steps:
  • the file sharing storage device stores a file block, and the file block can be accessed by at least two clients; the file cable service device establishes a file system of the client, and sets a file block corresponding to the file block that the client can access in the file system of the client.
  • File index
  • the reading the corresponding file block according to the file index is:
  • the corresponding file block name is read from the file index database according to the file index, and the corresponding file block is read from the file share storage device according to the file block name.
  • the method for implementing file sharing further includes:
  • the file indexing service device sets a reference count value of each file block, and the reference count value is a number of clients sharing the same file block;
  • the corresponding file index in the file system of the client is deleted, and the correspondence between the file and the corresponding file block name in the file file database is deleted;
  • the file sharing storage device When the reference count value is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the method for implementing file sharing further includes:
  • the file indexing service device creates a corresponding copy file index in the file system of the client according to the file copy request sent by the client;
  • the reference count value of the copy file block is counted, the reference count value of the copy file block is counted as "1", and the copy file block is sent to the file sharing storage device.
  • the method for implementing file sharing further includes:
  • the file indexing service device reads the corresponding file index in the file system of the client according to the file modification request sent by the client;
  • the method further includes:
  • the file indexing service device decrements the reference count value of the file block by "1"
  • the file sharing storage device When the reference count value is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the method for implementing file sharing after updating a file block name corresponding to the file index to a copy name of a file block name in a file index database, the method further includes: the file indexing service device determining whether the file exists The reference count value of the file block copy;
  • the present invention also provides another method for implementing file sharing, the method comprising: Receiving a file read request from the client;
  • the invention further provides a file sharing system, comprising:
  • a file sharing storage device configured to store a file block, where the file block can be accessed by at least two clients;
  • a file indexing service device configured to establish a file system of each client, and set a file index corresponding to the file block that the client can access in the file system of the client; establish a correspondence between each file index and the corresponding file block, and The corresponding relationship is stored in a preset file index database;
  • the file indexing service device includes:
  • a first reading module configured to: when receiving a file read request sent by the client, read a corresponding file index from a file system of the client;
  • the second reading module is configured to read the corresponding file block according to the file index, and send the file data in the corresponding file block to the client.
  • the second reading module is further configured to: read a corresponding file block name from the file index database according to the file index, and read the corresponding file block from the file sharing storage device according to the file block name.
  • the file indexing service device further includes:
  • a reference count value setting module configured to set a reference count value of each file block, where the reference count value is a number of clients sharing the same file block;
  • Deleting a sub-module configured to delete a corresponding file index in the file system of the client according to the file deletion request sent by the client, and the file identifier and the corresponding file in the file I database Correspondence of file block names;
  • the first reference counting module is configured to reduce the reference count value of the corresponding file block by "1";
  • a first determining module configured to determine whether the reference count value is zero
  • the first deletion request module is configured to request to delete the file sharing storage device when the reference count value is zero!
  • the file block corresponding to the count value is used to cause the file sharing storage device to delete the file block.
  • the file indexing service device further includes:
  • a file index creation module configured to create a corresponding copy file index in the file system of the client according to the file copy request sent by the client;
  • a file block name determining module configured to calculate a copy file block sent by the client, and determine the copy file block name
  • Correspondence relationship building module used to build and file in the file!
  • the correspondence between the copy file index and the copy file block name is stored in the database;
  • a second judging module configured to determine whether a reference count value of the copy file block exists
  • a second reference counting module configured to add a reference count value of the copy file block when the reference count value of the copy file block exists 1"; and when the reference count value of the copy file block does not exist, the reference count value of the copy file block is counted, and the reference count value of the copy file block is counted as "1";
  • a file block sending module configured to send the copy file block to the file sharing storage device.
  • the file indexing service device further includes:
  • a file block name copy creating module configured to read a corresponding file index in the file system of the client according to the file modification request sent by the client; and read the corresponding file block in the file index database according to the file file Name, and create a copy of the file block name;
  • a file modification request sending module configured to send a modification request to the file sharing storage device, so that the file sharing storage device creates a corresponding file block copy according to the modification request; Request to modify the copy of the file block;
  • a file block name update module configured to calculate a modified copy of the file block, determine a copy name of the file block name, and update the file block name corresponding to the file file I to a file block in the file file I database The name of the copy.
  • the file indexing service device further includes:
  • a third reference counting module configured to: after creating a copy of the file name, reduce the reference count value of the file block by "1";
  • a second deletion requesting module configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the file sharing system the file indexing service device further includes: a third determining module, configured to determine whether there is a reference count value of the file block copy; the third reference counting module is further configured to exist when When the reference count value of the corresponding file block copy is, the reference count value of the file block copy is added to "1", and the file deletion storage module is requested to delete the file block copy by the second deletion request module; and when there is no corresponding When the reference count value of the file block copy is counted, the reference count value of the file block copy is counted, and the reference count value of the file block copy is counted as "1".
  • a third determining module configured to determine whether there is a reference count value of the file block copy
  • the third reference counting module is further configured to exist when When the reference count value of the corresponding file block copy is, the reference count value of the file block copy is added to "1", and the file deletion storage module is requested to delete the file block copy by the second deletion request module; and when there is no corresponding
  • the present invention also provides another file sharing system, the system comprising:
  • a file sharing storage device configured to store a file block, where the file block can be accessed by at least two clients;
  • a file indexing service device configured to receive a file read request sent by the client
  • the present invention further provides a file indexing service device, including a first reading module, configured to: when receiving a file read request sent by a client, read a corresponding file index from a file system of the client; The second reading module is configured to read the file data in the corresponding file block from the file sharing storage device according to the file block name, and send the corresponding file block name. To the client.
  • the present invention also provides another file indexing service device, and the file arching service device includes:
  • a request receiving unit configured to receive a file read request sent by the client
  • a request processing unit configured to determine, according to the received file read request, a file index corresponding to the client, where the file index has a corresponding relationship with a file block that the client can access;
  • a file block corresponding to the file file is read, and file data in the file block is sent to the client.
  • the file sharing system and the file sharing method thereof and the file indexing service device provided by the present invention have a file system of each client, and the file system includes a file index corresponding to the client-accessible file block; There is a file index corresponding to the corresponding file block name; when a client needs to read the file, the corresponding file index is read in the file system of the client according to the request of the client, and the corresponding file index is searched for.
  • File block name and then read the corresponding file block from the file sharing storage device according to the file block name, and send it to the corresponding client, that is, each client has an independent file system, and multiple Clients share the same file block.
  • the file indexing service device deletes, copies or modifies the file blocks that can be accessed according to the request of a certain client, it does not have any influence on the file blocks accessible by other clients, and can be implemented for each client. Access to the file block for personalization.
  • FIG. 1 is a flow chart of an embodiment of a method for file sharing according to the present invention.
  • FIG. 2 is another flow chart of an embodiment of a method for file sharing according to the present invention.
  • FIG. 3 is another flow chart of an embodiment of a method for file sharing according to the present invention.
  • FIG. 4 is another flow chart of an embodiment of a method for file sharing according to the present invention.
  • FIG. 5 is a schematic structural diagram of an embodiment of a file sharing system according to the present invention.
  • FIG. 6 is a schematic structural diagram of a file indexing service device of the present invention.
  • FIG. 7 is a schematic structural diagram of a file reading processing module of the present invention.
  • FIG. 8 is another schematic structural diagram of a file indexing service device of the present invention.
  • FIG. 9 is a schematic structural diagram of a file deletion processing module of the present invention.
  • FIG. 10 is another schematic structural diagram of a file indexing service device of the present invention.
  • FIG. 11 is a schematic structural diagram of a file copy processing module of the present invention.
  • FIG. 12 is another schematic structural diagram of a file indexing service device of the present invention.
  • FIG. 13 is a schematic structural diagram of a file modification processing module of the present invention.
  • FIG. 14 is another schematic structural diagram of a file modification processing module of the present invention.
  • FIG. 15 is a block diagram showing another structure of the file modification processing module of the present invention. detailed description
  • an embodiment of a method for implementing file sharing according to the present invention includes: Step S101: A file sharing storage device stores a file block, where the file block can be accessed by at least two clients;
  • Step S102 The file indexing service device establishes a file system of each client, and sets a file index corresponding to the file block that the client can access in the file system of the client;
  • Step S103 establishing a correspondence between each file index and a corresponding file block, and Correspondence is stored to the default file! In the database;
  • Step S104 When receiving a file read request sent by the client, reading a corresponding file index from the file system of the client;
  • Step S105 Read a corresponding file block according to the file index, and send the file data in the corresponding file block to the client.
  • step S105 is specifically processed as follows: The corresponding file block name is read from the file index database according to the file index, and the corresponding file block is read from the file sharing storage device according to the file block name.
  • each client can only access its own file system, that is, only the file block corresponding to the file file in the file system of the file sharing storage device can be read.
  • the file index in the file association and the file block name in the file block name are named as the names of the corresponding file blocks in the file share storage device.
  • the file index is the file index in the file system of different clients.
  • a file index can be associated with one or more file block names.
  • the file block name may be a hash value of the content of the corresponding file block, such as an MD5 value, that is, the file block is named with the MD5 value of the file block content.
  • the file read request sent by the client includes a path, a file name, and a storage location of the file to be read.
  • reading the corresponding file index from the file system of the client is: generating a file index according to the path, the file name, and the storage location in the file read request, and according to the file index The generated file index reads the corresponding file index from the client's file system.
  • Step S201 A file sharing storage device sets a reference count value of each file block, where the reference The count value is the number of clients sharing the same file block.
  • Step S202 The file indexing service device deletes a corresponding file index in the file system of the client and a correspondence between the file index and the corresponding file block name in the file system according to the file deletion request sent by the client.
  • Step S203 reducing the reference count value of the corresponding file block by "1"
  • Step S204 determining whether the reference count value is zero
  • Step S205 When the reference count value is zero, request to the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the reference count value of the file block represents the number of clients sharing the file block.
  • the file sharing storage device stores a file block A, wherein the clients a, b, c, and d can access the file block A, that is, the client &, b, c, and d can share the file block A, then the file The reference count value of block A is "4".
  • the file deletion request includes a path, a file name, and a storage location of the file to be deleted.
  • Deleting the file index corresponding to the file system of the client according to the file deletion request sent by the client includes: generating a file index of the file to be deleted according to the file path, the storage location, and the file name in the file deletion request, and the file from the client Find and delete the corresponding file index in the system.
  • a certain client needs to delete a file block that can be accessed by the client, and only needs to delete the file index in the file system of the client, and establish the corresponding file index and file block name, which will correspond to
  • the reference count value of the file block is reduced by "1”, and the corresponding file block in the file sharing storage device does not need to be deleted, so the other clients are not affected. Only when the reference count value of the corresponding file block is "0", the file sharing storage device is requested to delete the corresponding file block, indicating that no corresponding file block is shared by the client.
  • Step S301 The file indexing service device creates a corresponding copy file index in the file system of the client according to the file copy request sent by the client.
  • Step S302 Perform calculation on a copy file block sent by the client, and determine the copy file block name
  • Step S303 establishing and storing, in the file index database, a correspondence between the copy file index and the copy file block name;
  • Step S304 determining whether there is a reference count value of the copied file block
  • Step S305 When there is a reference count value of the copy file block, add a reference count value of the copy file block to "1";
  • Step S306 when the reference count value of the copy file block does not exist, the reference count value of the copy file block is counted, the reference count value of the copy file block is counted as "1", and the copy file block is sent to File sharing storage device.
  • the file copy request includes a path, a file name, and a storage location of the file to be copied.
  • the generating, according to the file copy request sent by the client, the corresponding copy file index in the file system of the client includes: generating a file index of the file to be copied according to the file path, the storage location, and the file name in the file copy request, and at the client Create a corresponding copy file index in the file system of the end.
  • step S304 further includes the following processing: discarding the copy file block sent by the client.
  • a client is copying a file block that can be accessed, firstly creating a file index of the file to be copied, and determining whether there is a copy file block sent by the client in the file sharing storage device, and if it exists, only need to establish Copy the file index and copy the file block name correspondence, and add the reference count value of the corresponding file block to "1". It is not necessary to send the copy file block sent by the client to the file sharing storage device. Only if there is no corresponding file block in the file sharing storage device, the copy file block sent by the client needs to be sent to the file sharing storage device.
  • the method for implementing file sharing in the file sharing system further includes: Step S401: The file indexing service device reads a file index corresponding to the file system of the client according to the file modification request sent by the client;
  • Step S402 Read a corresponding file block name in the file index database according to the file index, and create a copy of the file block name;
  • Step S403 Send a modification request to the file sharing storage device, so that the file sharing storage device creates a corresponding file block copy according to the modification request, and modifies the file block copy according to the modification request.
  • Step S404 Perform calculation on the modified file block copy, and determine a copy name and a copy name of the file block name.
  • the file modification request includes a path, a file name, and a storage location of the file to be modified.
  • the reading, according to the file modification request sent by the client, the corresponding file index in the file system of the client includes: generating a file index of the file to be modified according to the file path, the storage location, and the file name in the file modification request, and reading the file index The corresponding file index in the client's file system.
  • the file indexing service device reduces the reference count value of the file block by "1"; when the reference count value is When the time is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the file indexing service device determines whether there is a reference count value of the file block copy; when there is a reference count value of the corresponding file block copy; The reference count value of the file block copy is "1", and the file block copy is deleted from the file sharing storage device; when the corresponding file block copy does not exist The reference count value is counted by the reference count value of the file block copy, and the reference count value of the file block copy is counted as "1".
  • a client needs to modify a file block that can be accessed.
  • the file sharing storage device stores the same file block as the file block copy
  • the file sharing storage device is requested to delete the file block copy.
  • the reference count value of the file block is increased by "1”
  • the file block name corresponding to the file index is updated to the copy name of the file block name, so that the file sharing storage device does not have two file blocks with the same content.
  • the file storage service device is configured with a file system of each client, and the file system includes a file index corresponding to the client-accessible file block; and the file cable bow I and the corresponding file block name are established.
  • a client needs to read a file, it only needs to read the corresponding file index in the client's file system according to the client's request, find the file block name corresponding to the file index, and then from the file according to the file block name.
  • the corresponding file block is read in the shared storage device and sent to the corresponding client, that is, each client has an independent file system, and multiple clients share the same file block.
  • the file indexing service device deletes, copies or modifies the file blocks that can be accessed according to the request of a certain client, it does not have any influence on the file blocks accessible by other clients, and can be implemented for each client. Access to the file block for personalization.
  • Step 501 Receive a file read request sent by a client
  • Step 502 Determine, according to the received file read request, a file index corresponding to the client, where the file index has a corresponding relationship with a file block that the client can access;
  • Step 503 Read a file block corresponding to the file index.
  • Step 504 Send file data in the file block to the client.
  • a file indexing service device 100 and a file sharing storage device 200 are presented.
  • the file sharing storage device 200 configured to store a file block, where the file block can be accessed by at least two clients.
  • the file indexing service device 100 is configured to establish a file system of each client, set a file index corresponding to the file block that the client can access in the file system of the client, and establish a correspondence between each file index and the corresponding file block. And storing the corresponding relationship in a preset file index database.
  • the file indexing service device 100 includes a file reading processing module 110, and the file reading processing module 110 includes a first reading module 111 and a second reading module 112.
  • the first reading module 111 is configured to use the first reading module, configured to: when receiving the file reading request sent by the client, read the corresponding file index from the file system of the client; Block 112, configured to read a corresponding file block according to the file, and send the file data in the corresponding file block to the client.
  • the second reading module 112 is further configured to: read a corresponding file block name from the file index database according to the file index, and read from the file sharing storage device according to the file block name. Take the corresponding file block.
  • each client can only access its own file system, that is, it can only read the file block corresponding to the file file in the file system of the file sharing storage device.
  • the file index in the file association and the file block name in the file block name are named as the names of the corresponding file blocks in the file share storage device.
  • the file index is the file index in the file system of different clients.
  • a file index can be associated with one or more file block names.
  • the file block name may be a hash value of the content of the corresponding file block, such as an MD5 value, that is, the file block is named with the MD5 value of the file block content.
  • the file read request sent by the client includes a path, a file name, and a storage location of the file to be read
  • the first reading module 111 is specifically configured to read the path and file according to the file.
  • Name and storage location generate file index, and based on the generated file Index, reading the corresponding file index from the file system of the client.
  • the file indexing service device 100 further includes a file deletion processing module 120, where the file deletion processing module 120 includes: a reference count value setting module 121, and a deletion.
  • the reference count value setting module 121 is configured to use a reference count value of each file block, and the reference count value is a number of clients sharing the same file block.
  • the deleting sub-module 122 is configured to delete a corresponding file index in the file system of the client and a correspondence between the file index and the corresponding file block name in the file I database according to the file deletion request sent by the client.
  • the first reference counting module 123 is configured to reduce the reference count value of the corresponding file block in the index data by "1".
  • the first determining module 124 is configured to determine whether the reference count value is zero.
  • the first deletion request module 125 is configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the reference count value of the file block represents the number of clients sharing the file block.
  • a file sharing storage device stores a file block ⁇ , wherein clients a, b, c, and d can access the file block A, that is, the client &, b, c, and d can share the file block A, then the file The reference count value of block A is "4".
  • the file deletion request includes a path, a file name, and a storage location of the file to be deleted.
  • the deleting sub-module 122 is further configured to generate a file index of the file to be deleted according to the file path, the storage location, and the file name in the file deletion request, and find and delete the corresponding file index from the file system of the client.
  • a certain client needs to delete a file block that can be accessed by the client, and only needs to delete the file index in the file system of the client, and establish the corresponding file index and file block name, which will correspond to
  • the reference count value of the file block is reduced by "1”, and the corresponding file block in the file sharing storage device does not need to be deleted, so the other clients are not affected. Only when corresponding If the reference count value of the file block is "0", the file sharing storage device is requested to delete the corresponding file block, indicating that no corresponding file block is shared by the client.
  • the file indexing service device 100 further includes a file copy processing module 130, where the file copy processing module 130 includes: a file index creating module 131, and a file block.
  • the file index creation module 131 is configured to create a corresponding copy file index in the file system of the client according to the file copy request sent by the client.
  • the file block name determining module 132 is configured to calculate a copy file block sent by the client, and determine the copy file block name.
  • the corresponding relationship establishing module 133 is configured to establish and store a correspondence between the copy file index and the copy file block name in the file index database.
  • the second determining module 134 is configured to determine whether a reference count value of the copy file block exists.
  • a second reference counting module 135, configured to: when the reference count value of the copy file block exists, add a reference count value of the copy file block to "1"; and when there is no reference count value of the copy file block, The reference count value of the copy file block is counted, and the reference count value of the copy file block is counted as "1".
  • the file block sending module 136 is configured to send the copy file block to the file sharing storage device.
  • the file copy request includes a path, a file name, and a storage location of the file to be copied.
  • the file index creation module 131 is further configured to generate a file index of the file to be copied according to the file path, the storage location, and the file name in the file deletion request, and create a corresponding copy file index in the file system of the client.
  • the second reference counting module 135 is further configured to discard the copy file block sent by the client.
  • a certain client is copying a file block that can be accessed, firstly creating a file index of the file to be copied, and determining whether there is a copy file block sent by the client in the file sharing storage device, and if it exists, only need to be established. Copy the correspondence between the file index and the copy file block name, Add the reference count value of the corresponding file block to "1", and do not need to send the copy file block sent by the client to the file sharing storage device. Only if there is no corresponding file block in the file sharing storage device, the copy file block sent by the client needs to be sent to the file sharing storage device.
  • the file indexing service device 100 further includes: a file modification processing module 140, where the file modification processing module 140 includes: a file block name copy creation module 141.
  • a file block name copy creating module 141 configured to: read a file index corresponding to the file system of the client according to the file modification request sent by the client; and read the corresponding file block name in the file index database according to the file index And create a copy of the file block name.
  • the file modification request sending module 142 is configured to send a modification request to the file sharing storage device, so that the file sharing storage device creates a corresponding file block copy according to the modification request; and the file block copy is modified according to the modification request.
  • a file block name update module 143 configured to calculate a modified copy of the file block, and determine a copy name of the file block name, which is further in the file index database, in the file sharing system 1000 embodiment, the file modification request It includes the path, file name, and storage location of the file to be modified.
  • the file block name copy creation module 141 is further configured to generate a file index of the file to be modified according to the file path, the storage location, and the file name in the file modification request, and read a corresponding file index in the file system of the client.
  • the file modification processing module 140 further includes: a third reference counting module 144 and a second deletion requesting module 145.
  • the third reference counting module 144 is further configured to reduce the reference count value of the file block by "1" after creating a copy of the file name.
  • the second deletion request module 145 is configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
  • the file repairing The modification processing module 140 further includes a third determination module 146.
  • the third determining module, 146 is configured to determine whether there is a reference count value of the file block copy.
  • the third reference counting module 144 is further configured to: when there is a reference count value of the corresponding file block copy, add a reference count value of the file block copy to "1", and share the file with the second deletion request module 145.
  • the storage device requests to delete the file block copy; and when there is no reference count value of the corresponding file block copy, counting the reference count value of the file block copy, the reference count value of the file block copy is counted as "1" .
  • a client needs to modify a file block that can be accessed.
  • the file sharing storage device stores the same file block as the file block copy
  • the file sharing storage device is requested to delete the file block copy. Adding the reference count value of the file block to " ⁇ , updating the file block name corresponding to the file file I to the copy name of the file block name, ensuring that the file sharing storage device does not have the same content.
  • File block
  • the file system of each client is established by the file indexing service device 100, and the file system includes a file index corresponding to the client-accessible file block; and a file index corresponding to the corresponding file block name is established.
  • a client needs to read a file, it only needs to read the corresponding file index in the client's file system according to the client's request, find the file block name corresponding to the file index, and then from the file according to the file block name.
  • the shared storage device 200 reads the corresponding file block and sends it to the corresponding client, that is, each client has an independent file system, and multiple clients share the same file block.
  • the file indexing service device 100 deletes, copies or modifies the file blocks that can be accessed according to the request of a certain client, it does not have any influence on the file blocks accessible by other clients, and can be implemented as each client. Accessible file blocks for personalization.
  • a file sharing storage device configured to store a file block, where the file block can be accessed by at least two clients;
  • a file indexing service device configured to receive a file read request sent by the client; Determining, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access; a block, and the file in the file block Data is sent to the client.
  • the file indexing service device in the embodiment is the file indexing service device 100 in the file sharing system 1000, and another file index provided by the present invention is provided.
  • Examples of service devices include:
  • a request receiving unit configured to receive a file read request sent by the client
  • a request processing unit configured to determine, according to the received file read request, a file index corresponding to the client, where the file index has a corresponding relationship with a file block that the client can access;
  • a file block corresponding to the file file is read, and file data in the file block is sent to the client.

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)

Abstract

Disclosed are a file sharing system, a method for achieving file sharing, and a file index service device. The method comprises: a file-sharing storage device storing a file block which at least could be accessed by two clients; a file index service device establishing a file system for each client where a file index corresponding to the file block that the client could access is set; establishing a correlation between each file index and a file block name, storing the correlation in a file index database; reading a corresponding file index from the file system of the client upon receiving a file reading request sent by the client; reading a corresponding file block according to the file index and sending the file data in the corresponding file block to the client. The system, the method for achieving file sharing, and the file index service device in the present invention ensure that each client has an independent file system, and achieve sharing the same file block among a plurality of clients.

Description

文件共享系统及实现文件共享的方法、 文件索引服务设备 技术领域  File sharing system and method for implementing file sharing, file indexing service device
本发明涉及信息技术领域, 尤其是涉及一种文件共享系统及实现文件 共享的方法、 文件索引服务设备。 背景技术  The present invention relates to the field of information technology, and in particular, to a file sharing system, a method for implementing file sharing, and a file indexing service device. Background technique
现有技术中, 数据中心已大量采用虚拟化技术为用户提供虚拟机服务。 虚拟化技术是在物理的服务器上, 通过虚拟化软件将物理资源分割为多个 逻辑分区, 每个分区相互隔离而成为独立的虚拟机, 这些虚拟机通过共享 同一台物理服务器为不同用户服务。  In the prior art, the data center has largely adopted virtualization technology to provide virtual machine services to users. Virtualization technology is to divide physical resources into multiple logical partitions through virtualized software. Each partition is isolated from each other and become independent virtual machines. These virtual machines serve different users by sharing the same physical server.
在虚拟机数量较大的环境下, 比如在桌面虚拟化环境中, 每个用户对 应一台虚拟机, 虚拟机的个数可能达到数十万甚至上百万台。 由于每台虚 拟机都有自己的操作系统和应用程序, 这些操作系统和应用程序有很多内 容是重复的, 如果每台虚拟机都独立安装操作系统和应用程序的话, 则会 占用大量存储空间, 从而造成存储资源严重的浪费。 发明内容  In an environment with a large number of virtual machines, for example, in a desktop virtualization environment, each user corresponds to one virtual machine, and the number of virtual machines may reach hundreds of thousands or even millions. Since each virtual machine has its own operating system and applications, many of these operating systems and applications are duplicated. If each virtual machine has its own operating system and applications installed, it will take up a lot of storage space. This results in a serious waste of storage resources. Summary of the invention
本发明的主要目的在于提供一种文件共享的方法和装置, 保证多个客 户端既有独立的文件系统, 又能共享相同的文件。  SUMMARY OF THE INVENTION A primary object of the present invention is to provide a method and apparatus for file sharing that ensures that multiple clients have both a separate file system and the same file.
本发明提出一种实现文件共享的方法, 包括以下步驟:  The invention provides a method for implementing file sharing, comprising the following steps:
文件共享存储设备存储文件块, 所述文件块至少能被两个客户端访问; 文件索弓 I服务设备建立客户端的文件系统, 在客户端的文件系统中设 置该客户端能够访问的文件块对应的文件索引;  The file sharing storage device stores a file block, and the file block can be accessed by at least two clients; the file cable service device establishes a file system of the client, and sets a file block corresponding to the file block that the client can access in the file system of the client. File index
建立每个文件索引与对应的文件块的对应关系, 并将所述对应关系存 储至预设的文件索引数据库中; Establishing a correspondence between each file index and a corresponding file block, and storing the corresponding relationship Stored in a preset file index database;
在接收到客户端发送的文件读取请求时, 从该客户端的文件系统中读 取对应的文件索引;  When receiving a file read request sent by the client, reading a corresponding file index from the file system of the client;
根据文件索引读取对应的文件块, 并将所述对应文件块中的文件数据 发送给客户端。  Reading a corresponding file block according to the file index, and sending the file data in the corresponding file block to the client.
优选地, 所述根据文件索引读取对应的文件块, 为:  Preferably, the reading the corresponding file block according to the file index is:
根据文件索引从文件索引数据库中读取对应的文件块名, 并根据该文 件块名从文件共享存储设备中读取对应的文件块。  The corresponding file block name is read from the file index database according to the file index, and the corresponding file block is read from the file share storage device according to the file block name.
优选地, 所述的实现文件共享的方法, 所述方法还包括:  Preferably, the method for implementing file sharing, the method further includes:
文件索引服务设备设置各文件块的引用计数值, 所述引用计数值为共 享同一文件块的客户端个数;  The file indexing service device sets a reference count value of each file block, and the reference count value is a number of clients sharing the same file block;
相应的, 根据客户端发送的文件删除请求, 删除该客户端的文件系统 中对应的文件索引, 以及文件索弓 I数据库中所述文件索弓 I和对应文件块名 的对应关系;  Correspondingly, according to the file deletion request sent by the client, the corresponding file index in the file system of the client is deleted, and the correspondence between the file and the corresponding file block name in the file file database is deleted;
将对应的文件块的引用计数值减 "1" ;  Decrease the reference count value of the corresponding file block by "1";
判断所述引用计数值是否为零;  Determining whether the reference count value is zero;
当所述引用计数值为零时, 向文件共享存储设备请求删除所述引用计 数值对应的文件块, 以使文件共享存储设备删除所述文件块。  When the reference count value is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
优选地, 所述的实现文件共享的方法, 所述方法还包括:  Preferably, the method for implementing file sharing, the method further includes:
文件索引服务设备根据客户端发送的文件拷贝请求, 在该客户端的文 件系统中创建对应的拷贝文件索引;  The file indexing service device creates a corresponding copy file index in the file system of the client according to the file copy request sent by the client;
对客户端发送的拷贝文件块进行计算, 确定该拷贝文件块名; 建立并在文件索引数据库中存储拷贝文件索引和拷贝文件块名的对应 关系;  Calculating a copy file block sent by the client, determining the copy file block name; establishing and storing a correspondence relationship between the copy file index and the copy file block name in the file index database;
判断是否存在该拷贝文件块的引用计数值; 若是, 则将该拷贝文件块的引用计数值加 "1" ; Determining whether there is a reference count value of the copy file block; If yes, add the reference count value of the copy file block to "1";
若否, 则对该拷贝文件块的引用计数值进行计数, 将该拷贝文件块的 引用计数值计数为 "1" , 并将拷贝文件块发送至文件共享存储设备中。  If not, the reference count value of the copy file block is counted, the reference count value of the copy file block is counted as "1", and the copy file block is sent to the file sharing storage device.
优选地, 所述的实现文件共享的方法, 还包括:  Preferably, the method for implementing file sharing further includes:
文件索引服务设备根据客户端发送的文件修改请求, 读取该客户端的 文件系统中对应的文件索引;  The file indexing service device reads the corresponding file index in the file system of the client according to the file modification request sent by the client;
根据所述文件索引在文件索引数据库中读取对应的文件块名, 并创建 该文件块名的副本;  Reading a corresponding file block name in the file index database according to the file index, and creating a copy of the file block name;
向文件共享存储设备发送修改请求, 以使文件共享存储设备根据修改 请求建立对应的文件块副本, 并根据修改请求对文件块副本进行修改; 对修改后的文件块副本进行计算, 确定文件块名的副本名, 在文件索 优选地, 所述实现文件共享的方法, 在创建该文件名的副本之后, 所 述方法还包括:  Sending a modification request to the file sharing storage device, so that the file sharing storage device establishes a corresponding file block copy according to the modification request, and modifying the file block copy according to the modification request; performing calculation on the modified file block copy to determine the file block name The copy name, in the file, preferably, the method for implementing file sharing, after the copy of the file name is created, the method further includes:
文件索引服务设备将所述文件块的引用计数值减 "1";  The file indexing service device decrements the reference count value of the file block by "1";
当所述引用计数值为零时, 则向文件共享存储设备请求删除所述引用 计数值对应的文件块, 以使文件共享存储设备删除所述文件块。  When the reference count value is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
优选地, 所述实现文件共享的方法, 在文件索引数据库中将与所述文 件索引对应的文件块名更新为文件块名的副本名之后, 所述方法还包括: 文件索引服务设备判断是否存在文件块副本的引用计数值;  Preferably, the method for implementing file sharing, after updating a file block name corresponding to the file index to a copy name of a file block name in a file index database, the method further includes: the file indexing service device determining whether the file exists The reference count value of the file block copy;
若是, 则将该文件块副本的引用计数值加 " 1" , 并向文件共享存储设 备删除所述文件块副本;  If yes, the reference count value of the file block copy is incremented by "1", and the file block copy is deleted from the file sharing storage device;
若否, 则对该文件块副本的引用计数值进行计数, 该文件块副本的引 用计数值计数为 "1"。  If not, the reference count value of the file block copy is counted, and the reference count value of the file block copy is counted as "1".
本发明还提供了另一种实现文件共享的方法, 所述方法包括: 接收客户端发来的文件读取请求; The present invention also provides another method for implementing file sharing, the method comprising: Receiving a file read request from the client;
根据收到的所述文件读取请求, 确定所述客户端对应的文件索引, 所 述文件索引与客户端能够访问的文件块之间具有对应关系;  And determining, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access;
读取与所述文件索引相对应的文件块;  Reading a file block corresponding to the file index;
将所述文件块中的文件数据发送给所述客户端。  Transmitting file data in the file block to the client.
本发明另提出一种文件共享系统, 包括:  The invention further provides a file sharing system, comprising:
文件共享存储设备, 用于存储文件块, 所述文件块至少能被两个客户 端访问;  a file sharing storage device, configured to store a file block, where the file block can be accessed by at least two clients;
文件索引服务设备, 用于建立每个客户端的文件系统, 在客户端的文 件系统中设置该客户端能够访问的文件块对应的文件索引; 建立每个文件 索引与对应的文件块的对应关系, 并将所述对应关系存储至预设的文件索 引数据库中;  a file indexing service device, configured to establish a file system of each client, and set a file index corresponding to the file block that the client can access in the file system of the client; establish a correspondence between each file index and the corresponding file block, and The corresponding relationship is stored in a preset file index database;
所述文件索引服务设备包括:  The file indexing service device includes:
第一读取模块, 用于接收到客户端发送的文件读取请求时, 从该客户 端的文件系统中读取对应的文件索引;  a first reading module, configured to: when receiving a file read request sent by the client, read a corresponding file index from a file system of the client;
第二读取模块, 用于根据文件索引读取对应的文件块, 并将所述对应 文件块中的文件数据发送给客户端。  The second reading module is configured to read the corresponding file block according to the file index, and send the file data in the corresponding file block to the client.
优选地, 所述第二读取模块, 具体还用于根据文件索引从文件索引数 据库中读取对应的文件块名, 并根据该文件块名从文件共享存储设备中读 取对应的文件块。  Preferably, the second reading module is further configured to: read a corresponding file block name from the file index database according to the file index, and read the corresponding file block from the file sharing storage device according to the file block name.
优选地, 所述文件索引服务设备还包括:  Preferably, the file indexing service device further includes:
引用计数值设置模块, 用于设置各文件块的引用计数值, 所述引用计 数值为共享同一文件块的客户端个数;  a reference count value setting module, configured to set a reference count value of each file block, where the reference count value is a number of clients sharing the same file block;
删除子模块, 用于根据客户端发送的文件删除请求, 删除该客户端的 文件系统中对应的文件索引、 以及文件索 I数据库中所述文件索 I和对应 文件块名的对应关系; Deleting a sub-module, configured to delete a corresponding file index in the file system of the client according to the file deletion request sent by the client, and the file identifier and the corresponding file in the file I database Correspondence of file block names;
第一引用计数模块, 用于对应的文件块的引用计数值减 "1" ;  The first reference counting module is configured to reduce the reference count value of the corresponding file block by "1";
第一判断模块, 用于判断引用计数值是否为零;  a first determining module, configured to determine whether the reference count value is zero;
第一删除请求模块, 用于当引用计数值为零时, 向文件共享存储设备 请求删除所述 !用计数值对应的文件块, 以使文件共享存储设备删除所述 文件块。  The first deletion request module is configured to request to delete the file sharing storage device when the reference count value is zero! The file block corresponding to the count value is used to cause the file sharing storage device to delete the file block.
优选地, 所述文件索引服务设备还包括:  Preferably, the file indexing service device further includes:
文件索引创建模块, 用于根据客户端发送的文件拷贝请求, 在该客户 端的文件系统中创建对应的拷贝文件索引;  a file index creation module, configured to create a corresponding copy file index in the file system of the client according to the file copy request sent by the client;
文件块名确定模块, 用于对客户端发送的拷贝文件块进行计算, 确定 该拷贝文件块名;  a file block name determining module, configured to calculate a copy file block sent by the client, and determine the copy file block name;
对应关系建立模块, 用于建立并在文件索弓!数据库中存储拷贝文件索 引和拷贝文件块名的对应关系;  Correspondence relationship building module, used to build and file in the file! The correspondence between the copy file index and the copy file block name is stored in the database;
第二判断模块, 用于判断是否存在该拷贝文件块的引用计数值; 第二引用计数模块, 用于当存在该拷贝文件块的引用计数值时, 将该 拷贝文件块的引用计数值加 "1" ; 以及当不存在该拷贝文件块的引用计数 值时, 对该拷贝文件块的引用计数值进行计数, 将该拷贝文件块的引用计 数值计数为 "1";  a second judging module, configured to determine whether a reference count value of the copy file block exists; and a second reference counting module, configured to add a reference count value of the copy file block when the reference count value of the copy file block exists 1"; and when the reference count value of the copy file block does not exist, the reference count value of the copy file block is counted, and the reference count value of the copy file block is counted as "1";
文件块发送模块, 用于将拷贝文件块发送至文件共享存储设备中。 优选地, 所述文件索引服务设备还包括:  A file block sending module, configured to send the copy file block to the file sharing storage device. Preferably, the file indexing service device further includes:
文件块名副本创建模块, 用于根据客户端发送的文件修改请求, 读取 该客户端的文件系统中对应的文件索引; 以及根据所述文件索弓 I在文件索 引数据库中读取对应的文件块名, 并创建该文件块名的副本;  a file block name copy creating module, configured to read a corresponding file index in the file system of the client according to the file modification request sent by the client; and read the corresponding file block in the file index database according to the file file Name, and create a copy of the file block name;
文件修改请求发送模块, 用于向文件共享存储设备发送修改请求, 以 使文件共享存储设备根据修改请求建立对应的文件块副本; 并根据修改请 求对文件块副本进行修改; a file modification request sending module, configured to send a modification request to the file sharing storage device, so that the file sharing storage device creates a corresponding file block copy according to the modification request; Request to modify the copy of the file block;
文件块名更新模块, 用于对修改后的文件块副本进行计算, 确定文件 块名的副本名, 在文件索弓 I数据库中将与所述文件索弓 I对应的文件块名更 新为文件块名的副本名。  a file block name update module, configured to calculate a modified copy of the file block, determine a copy name of the file block name, and update the file block name corresponding to the file file I to a file block in the file file I database The name of the copy.
优选地, 所述文件索引服务设备还包括:  Preferably, the file indexing service device further includes:
第三引用计数模块, 用于在创建文件名的副本之后, 将所述文件块的 引用计数值减 "1";  a third reference counting module, configured to: after creating a copy of the file name, reduce the reference count value of the file block by "1";
第二删除请求模块, 用于当引用计数值为零, 则向文件共享存储设备 请求删除所述引用计数值对应的文件块, 以使文件共享存储设备删除所述 文件块。  And a second deletion requesting module, configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
优选地, 所述的文件共享系统, 所述文件索引服务设备还包括: 第三判断模块, 用于判断是否存在文件块副本的引用计数值; 所述第三引用计数模块, 还用于当存在对应的文件块副本的引用计数 值时, 将该文件块副本的引用计数值加 " 1" , 并通过第二删除请求模块向 文件共享存储设备请求删除所述文件块副本; 以及当不存在对应的文件块 副本的引用计数值时, 对该文件块副本的引用计数值进行计数, 将该文件 块副本的引用计数值计数为 "1"。  Preferably, the file sharing system, the file indexing service device further includes: a third determining module, configured to determine whether there is a reference count value of the file block copy; the third reference counting module is further configured to exist when When the reference count value of the corresponding file block copy is, the reference count value of the file block copy is added to "1", and the file deletion storage module is requested to delete the file block copy by the second deletion request module; and when there is no corresponding When the reference count value of the file block copy is counted, the reference count value of the file block copy is counted, and the reference count value of the file block copy is counted as "1".
本发明还提供了另一种文件共享系统, 所述系统包括:  The present invention also provides another file sharing system, the system comprising:
文件共享存储设备, 用于存储文件块, 所述文件块至少能被两个客户 端访问;  a file sharing storage device, configured to store a file block, where the file block can be accessed by at least two clients;
文件索引服务设备, 用于接收客户端发来的文件读取请求;  a file indexing service device, configured to receive a file read request sent by the client;
根据收到的所述文件读取请求, 确定所述客户端对应的文件索引, 所 述文件索引与客户端能够访问的文件块之间具有对应关系; 块, 并将所述文件块中的文件数据发送给所述客户端。 本发明另提出一种文件索引服务设备, 包括第一读取模块, 用于接收 到客户端发送的文件读取请求时, 从该客户端的文件系统中读取对应的文 件索引; 根据所述文件索弓 I从文件索弓 I数据库中读取对应的文件块名; 第二读取模块, 用于根据所述文件块名从文件共享存储设备中读取对 应文件块中的文件数据, 并发送给客户端。 Determining, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access; a block, and the file in the file block Data is sent to the client. The present invention further provides a file indexing service device, including a first reading module, configured to: when receiving a file read request sent by a client, read a corresponding file index from a file system of the client; The second reading module is configured to read the file data in the corresponding file block from the file sharing storage device according to the file block name, and send the corresponding file block name. To the client.
本发明还提供了另一种文件索引服务设备, 所述文件索弓 I服务设备包 括:  The present invention also provides another file indexing service device, and the file arching service device includes:
请求接收单元, 用于接收客户端发来的文件读取请求;  a request receiving unit, configured to receive a file read request sent by the client;
请求处理单元, 用于根据收到的所述文件读取请求, 确定所述客户端 对应的文件索引, 所述文件索引与客户端能够访问的文件块之间具有对应 关系;  a request processing unit, configured to determine, according to the received file read request, a file index corresponding to the client, where the file index has a corresponding relationship with a file block that the client can access;
读取与所述文件索弓 I相对应的文件块, 并将所述文件块中的文件数据 发送给所述客户端。  A file block corresponding to the file file is read, and file data in the file block is sent to the client.
本发明所提供的文件共享系统及其文件共享的方法、 文件索引服务设 备, 文件索引服务设备建立有每个客户端的文件系统, 该文件系统中包含 对应客户端可访问文件块的文件索引; 建立有文件索引与对应文件块名对 应关系; 当某一客户端需要读取文件, 只需根据该客户端的请求在该客户 端的文件系统中读取对应的文件索引, 查找与该文件索弓 I对应的文件块名 , 然后根据文件块名从文件共享存储设备中读取对应的文件块, 并发送给对 应的客户端即可, 即保证了每个客户端具有独立的文件系统, 实现了多个 客户端共享同一文件块。 同时文件索引服务设备根据某一客户端的请求, 对其可访问的文件块进行删除、 拷贝或修改时, 不会对其他客户端可访问 的文件块产生任何影响, 可实现为每个客户端可访问的文件块进行个性设 置。 附图说明 The file sharing system and the file sharing method thereof and the file indexing service device provided by the present invention have a file system of each client, and the file system includes a file index corresponding to the client-accessible file block; There is a file index corresponding to the corresponding file block name; when a client needs to read the file, the corresponding file index is read in the file system of the client according to the request of the client, and the corresponding file index is searched for. File block name, and then read the corresponding file block from the file sharing storage device according to the file block name, and send it to the corresponding client, that is, each client has an independent file system, and multiple Clients share the same file block. At the same time, when the file indexing service device deletes, copies or modifies the file blocks that can be accessed according to the request of a certain client, it does not have any influence on the file blocks accessible by other clients, and can be implemented for each client. Access to the file block for personalization. DRAWINGS
图 1是本发明的文件共享的方法一实施例的流程图;  1 is a flow chart of an embodiment of a method for file sharing according to the present invention;
图 2是本发明的文件共享的方法实施例的另一流程图;  2 is another flow chart of an embodiment of a method for file sharing according to the present invention;
图 3是本发明的文件共享的方法实施例的另一流程图;  3 is another flow chart of an embodiment of a method for file sharing according to the present invention;
图 4是本发明的文件共享的方法实施例的另一流程图;  4 is another flow chart of an embodiment of a method for file sharing according to the present invention;
图 5是本发明的文件共享系统一实施例的结构示意图;  FIG. 5 is a schematic structural diagram of an embodiment of a file sharing system according to the present invention; FIG.
图 6是本发明的文件索引服务设备的结构示意图;  6 is a schematic structural diagram of a file indexing service device of the present invention;
图 7是本发明的文件读取处理模块的结构示意图;  7 is a schematic structural diagram of a file reading processing module of the present invention;
图 8是本发明的文件索引服务设备的另一结构示意图;  8 is another schematic structural diagram of a file indexing service device of the present invention;
图 9是本发明的文件删除处理模块的结构示意图;  9 is a schematic structural diagram of a file deletion processing module of the present invention;
图 10是本发明的文件索引服务设备的另一结构示意图;  10 is another schematic structural diagram of a file indexing service device of the present invention;
图 11是本发明的文件拷贝处理模块的结构示意图;  11 is a schematic structural diagram of a file copy processing module of the present invention;
图 12是本发明的文件索引服务设备的另一结构示意图;  12 is another schematic structural diagram of a file indexing service device of the present invention;
图 13是本发明文件修改处理模块的结构示意图;  13 is a schematic structural diagram of a file modification processing module of the present invention;
图 14是本发明的文件修改处理模块的另一结构示意图;  14 is another schematic structural diagram of a file modification processing module of the present invention;
图 15是本发明的文件修改处理模块的另一结构示意图。 具体实施方式  Figure 15 is a block diagram showing another structure of the file modification processing module of the present invention. detailed description
应当理解, 此处所描述的具体实施例仅仅用以解释本发明, 并不用于 限定本发明。  It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
参见图 1 , 提出本发明的一种实现文件共享的方法一实施例, 包括: 步驟 S101、 文件共享存储设备存储文件块, 所述文件块至少能被两个 客户端访问;  Referring to FIG. 1 , an embodiment of a method for implementing file sharing according to the present invention includes: Step S101: A file sharing storage device stores a file block, where the file block can be accessed by at least two clients;
步驟 S102、 文件索引服务设备建立每个客户端的文件系统, 在客户端 的文件系统中设置该客户端能够访问的文件块对应的文件索引;  Step S102: The file indexing service device establishes a file system of each client, and sets a file index corresponding to the file block that the client can access in the file system of the client;
步驟 S103、 建立每个文件索引与对应的文件块的对应关系, 并将所述 对应关系存储至预设的文件索弓!数据库中; Step S103, establishing a correspondence between each file index and a corresponding file block, and Correspondence is stored to the default file! In the database;
步驟 S104、 在接收到客户端发送的文件读取请求时, 从该客户端的文 件系统中读取对应的文件索引;  Step S104: When receiving a file read request sent by the client, reading a corresponding file index from the file system of the client;
步驟 S105、 根据文件索引读取对应的文件块, 并将所述对应文件块中 的文件数据发送给客户端。  Step S105: Read a corresponding file block according to the file index, and send the file data in the corresponding file block to the client.
进一步地, 上述实施例中, 步驟 S105具体处理如下: 根据文件索引从 文件索引数据库中读取对应的文件块名, 并根据该文件块名从文件共享存 储设备中读取对应的文件块。  Further, in the foregoing embodiment, step S105 is specifically processed as follows: The corresponding file block name is read from the file index database according to the file index, and the corresponding file block is read from the file sharing storage device according to the file block name.
上述文件共享方法实施例中, 所述文件共享存储设备中相同内容的文 件块只存储一份。  In the foregoing file sharing method embodiment, only one copy of the file block of the same content in the file sharing storage device is stored.
上述文件共享方法实施例中, 每个客户端只能访问到自己的文件系统, 即只能读取文件共享存储设备中的与自身的文件系统中文件索弓 I对应的文 件块。  In the foregoing file sharing method embodiment, each client can only access its own file system, that is, only the file block corresponding to the file file in the file system of the file sharing storage device can be read.
所述建立对应关系的文件索引和文件块名中的文件块名为文件共享存 储设备中对应文件块的名称。 而文件索引则为不同客户端的文件系统中的 文件索引。 其中, 一个文件索引可以与一个或多个文件块名建立对应关系。 文件块名可以是对应文件块的内容的散列值, 如 MD5值, 即以文件块内容 的 MD5值对文件块命名。  The file index in the file association and the file block name in the file block name are named as the names of the corresponding file blocks in the file share storage device. The file index is the file index in the file system of different clients. Wherein, a file index can be associated with one or more file block names. The file block name may be a hash value of the content of the corresponding file block, such as an MD5 value, that is, the file block is named with the MD5 value of the file block content.
进一步地, 上述实现文件共享的方法实施例中, 所述客户端发送的文 件读取请求包括待读取文件的路径、 文件名和存储位置。 所述在接收到客 户端发送的文件读取请求时, 从该客户端的文件系统中读取对应的文件索 引具体为: 根据文件读取请求中路径、 文件名和存储位置生成文件索引, 并根据该生成的文件索引, 从该客户端的文件系统中读取对应的文件索引。  Further, in the foregoing method for implementing file sharing, the file read request sent by the client includes a path, a file name, and a storage location of the file to be read. When receiving the file read request sent by the client, reading the corresponding file index from the file system of the client is: generating a file index according to the path, the file name, and the storage location in the file read request, and according to the file index The generated file index reads the corresponding file index from the client's file system.
进一步地, 参见图 2, 上述实现文件共享的方法实施例中, 还包括: 步驟 S201、 文件共享存储设备设置各文件块的引用计数值, 所述引用 计数值为共享同一文件块的客户端个数。 Further, referring to FIG. 2, in the foregoing method for implementing file sharing, the method further includes: Step S201: A file sharing storage device sets a reference count value of each file block, where the reference The count value is the number of clients sharing the same file block.
步驟 S202、 文件索引服务设备根据客户端发送的文件删除请求, 删除 该客户端的文件系统中对应的文件索引、 以及文件索弓 I数据库中所述文件 索引和对应文件块名的对应关系;  Step S202: The file indexing service device deletes a corresponding file index in the file system of the client and a correspondence between the file index and the corresponding file block name in the file system according to the file deletion request sent by the client.
步驟 S203、 将对应文件块的引用计数值减 "1" ;  Step S203, reducing the reference count value of the corresponding file block by "1";
步驟 S204、 判断所述引用计数值是否为零;  Step S204, determining whether the reference count value is zero;
步驟 S205、 当引用计数值为零时, 向文件共享存储设备请求删除所述 引用计数值对应的文件块, 以使文件共享存储设备删除所述文件块。  Step S205: When the reference count value is zero, request to the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
上述实施中, 所述文件块的引用计数值代表共享该文件块的客户端个 数。 例如, 文件共享存储设备中存储有文件块 A, 其中, 客户端 a、 b、 c 和 d都可访问该文件块 A, 即客户端&、 b、 c和 d可共享文件块 A, 则文件 块 A的引用计数值为 "4"。  In the above implementation, the reference count value of the file block represents the number of clients sharing the file block. For example, the file sharing storage device stores a file block A, wherein the clients a, b, c, and d can access the file block A, that is, the client &, b, c, and d can share the file block A, then the file The reference count value of block A is "4".
进一步地, 上述文件共享的方法实施例中, 所述文件删除请求中包括 有待删除文件的路径、 文件名和存储位置。 所述根据客户端发送的文件删 除请求, 删除该客户端的文件系统中对应的文件索引包括: 根据文件删除 请求中的文件路径、 存储位置和文件名生成待删除文件的文件索引, 从客 户端的文件系统中查找并删除对应的文件索引。  Further, in the foregoing method for sharing a file, the file deletion request includes a path, a file name, and a storage location of the file to be deleted. Deleting the file index corresponding to the file system of the client according to the file deletion request sent by the client includes: generating a file index of the file to be deleted according to the file path, the storage location, and the file name in the file deletion request, and the file from the client Find and delete the corresponding file index in the system.
从上述实施例可以看出, 某一客户端需删除其可访问的文件块, 只需 删除该客户端的文件系统中的文件索引, 以及建立对应关系的所述文件索 引与文件块名, 将对应的文件块的引用计数值减 "1" 即可, 无需删除文件 共享存储设备中对应的文件块, 因此不会影响其他客户端。 只有当对应的 文件块的引用计数值为 "0" , 则请求文件共享存储设备删除对应的文件块, 此时表明已无客户端共享对应的文件块。  It can be seen from the foregoing embodiment that a certain client needs to delete a file block that can be accessed by the client, and only needs to delete the file index in the file system of the client, and establish the corresponding file index and file block name, which will correspond to The reference count value of the file block is reduced by "1", and the corresponding file block in the file sharing storage device does not need to be deleted, so the other clients are not affected. Only when the reference count value of the corresponding file block is "0", the file sharing storage device is requested to delete the corresponding file block, indicating that no corresponding file block is shared by the client.
进一步地,参见图 3 ,上述文件共享系统实现文件共享的方法实施例中, 还包括: 步驟 S301、 文件索引服务设备根据客户端发送的文件拷贝请求, 在该 客户端的文件系统中创建对应的拷贝文件索引; Further, referring to FIG. 3, in the foregoing method for implementing file sharing in the file sharing system, the method further includes: Step S301: The file indexing service device creates a corresponding copy file index in the file system of the client according to the file copy request sent by the client.
步驟 S302、 对客户端发送的拷贝文件块进行计算, 确定该拷贝文件块 名;  Step S302: Perform calculation on a copy file block sent by the client, and determine the copy file block name;
步驟 S303、 建立并在文件索引数据库中存储拷贝文件索引和拷贝文件 块名的对应关系;  Step S303, establishing and storing, in the file index database, a correspondence between the copy file index and the copy file block name;
步驟 S304、 判断是否存在拷贝文件块的引用计数值;  Step S304, determining whether there is a reference count value of the copied file block;
步驟 S305、 当存在该拷贝文件块的引用计数值, 则将该拷贝文件块的 引用计数值加 " 1" ;  Step S305: When there is a reference count value of the copy file block, add a reference count value of the copy file block to "1";
步驟 S306、 当不存在该拷贝文件块的引用计数值, 则对该拷贝文件块 的引用计数值进行计数, 将该拷贝文件块的引用计数值计数为 " 1 " , 并将 拷贝文件块发送至文件共享存储设备中。  Step S306, when the reference count value of the copy file block does not exist, the reference count value of the copy file block is counted, the reference count value of the copy file block is counted as "1", and the copy file block is sent to File sharing storage device.
进一步地, 上述文件共享的方法实施例中, 所述文件拷贝请求中包括 有待拷贝文件的路径、 文件名和存储位置。 所述根据客户端发送的文件拷 贝请求, 在客户端的文件系统中创建对应的拷贝文件索引包括: 根据文件 拷贝请求中的文件路径、 存储位置和文件名生成待拷贝文件的文件索引, 并在客户端的文件系统中创建对应的拷贝文件索引。  Further, in the foregoing method for sharing a file, the file copy request includes a path, a file name, and a storage location of the file to be copied. The generating, according to the file copy request sent by the client, the corresponding copy file index in the file system of the client includes: generating a file index of the file to be copied according to the file path, the storage location, and the file name in the file copy request, and at the client Create a corresponding copy file index in the file system of the end.
上述实施例中, 所述步驟 S304之后还包括如下处理: 丟弃客户端发送 的拷贝文件块。  In the above embodiment, the step S304 further includes the following processing: discarding the copy file block sent by the client.
由上述方法实施例可知, 某一客户端在拷贝其可访问的文件块, 首先 创建待拷贝文件的文件索引, 判断文件共享存储设备中是否存在客户端发 送的拷贝文件块, 若存在只需建立拷贝文件索引和拷贝文件块名的对应关 系, 并将对应的文件块的引用计数值加 " 1 " 即可, 无需将客户端发送的拷 贝文件块发送至文件共享存储设备中。 只有当文件共享存储设备中没有对 应的文件块, 则需将客户端发送的拷贝文件块发送至文件共享存储设备中。 参见图 4, 上述文件共享系统实现文件共享的方法实施例中, 还包括: 步驟 S401、 文件索引服务设备根据客户端发送的文件修改请求, 读取 该客户端的文件系统中对应的文件索引; It can be seen from the foregoing method embodiment that a client is copying a file block that can be accessed, firstly creating a file index of the file to be copied, and determining whether there is a copy file block sent by the client in the file sharing storage device, and if it exists, only need to establish Copy the file index and copy the file block name correspondence, and add the reference count value of the corresponding file block to "1". It is not necessary to send the copy file block sent by the client to the file sharing storage device. Only if there is no corresponding file block in the file sharing storage device, the copy file block sent by the client needs to be sent to the file sharing storage device. Referring to FIG. 4, the method for implementing file sharing in the file sharing system further includes: Step S401: The file indexing service device reads a file index corresponding to the file system of the client according to the file modification request sent by the client;
步驟 S402、 根据所述文件索引在文件索引数据库中读取对应的文件块 名, 并创建该文件块名的副本;  Step S402: Read a corresponding file block name in the file index database according to the file index, and create a copy of the file block name;
步驟 S403、 向文件共享存储设备发送修改请求, 以使文件共享存储设 备根据修改请求建立对应的文件块副本, 并根据修改请求对文件块副本进 行修改;  Step S403: Send a modification request to the file sharing storage device, so that the file sharing storage device creates a corresponding file block copy according to the modification request, and modifies the file block copy according to the modification request.
步驟 S404、对修改后的文件块副本进行计算,确定文件块名的副本名, 副本名。  Step S404: Perform calculation on the modified file block copy, and determine a copy name and a copy name of the file block name.
进一步地, 上述文件共享的方法实施例中, 所述文件修改请求中包括 有待修改文件的路径、 文件名和存储位置。 所述根据客户端发送的文件修 改请求, 读取该客户端的文件系统中对应的文件索引包括: 根据文件修改 请求中的文件路径、 存储位置和文件名生成待修改文件的文件索引, 读取 该客户端的文件系统中对应的文件索引。  Further, in the foregoing method for sharing a file, the file modification request includes a path, a file name, and a storage location of the file to be modified. The reading, according to the file modification request sent by the client, the corresponding file index in the file system of the client includes: generating a file index of the file to be modified according to the file path, the storage location, and the file name in the file modification request, and reading the file index The corresponding file index in the client's file system.
进一步地, 上述文件共享的方法实施例中, 在创建该文件名的副本之 后还包括如下处理: 文件索引服务设备将所述文件块的引用计数值减 "1" ; 当所述引用计数值为零时, 则向文件共享存储设备请求删除所述述引用计 数值对应的文件块, 以使文件共享存储设备删除所述文件块。  Further, in the method embodiment of the foregoing file sharing, after the copy of the file name is created, the following processing is further included: the file indexing service device reduces the reference count value of the file block by "1"; when the reference count value is When the time is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
进一步地, 上述文件共享的方法实施例中, 在文件索引数据库中将与 理: 文件索引服务设备判断是否存在文件块副本的引用计数值; 当存在对 应的文件块副本的引用计数值; 则将该文件块副本的引用计数值加 " 1" , 并向文件共享存储设备删除所述文件块副本; 当不存在对应的文件块副本 的引用计数值, 则对该文件块副本的引用计数值进行计数, 将该文件块副 本的引用计数值计数为 " 1"。 Further, in the foregoing method for sharing a file, in the file index database, the file indexing service device determines whether there is a reference count value of the file block copy; when there is a reference count value of the corresponding file block copy; The reference count value of the file block copy is "1", and the file block copy is deleted from the file sharing storage device; when the corresponding file block copy does not exist The reference count value is counted by the reference count value of the file block copy, and the reference count value of the file block copy is counted as "1".
由上述实施例可知, 某一客户端需修改其可访问的文件块, 当文件共 享存储设备中存内容与文件块副本相同的文件块, 则请求文件共享存储设 备删除所述文件块副本, 将所述文件块的引用计数值加 " 1" , 将与文件索 引建立对应关系的文件块名更新为文件块名的副本名即可, 保证文件共享 存储设备不存在内容相同的两个文件块。  It can be seen from the above embodiment that a client needs to modify a file block that can be accessed. When the file sharing storage device stores the same file block as the file block copy, the file sharing storage device is requested to delete the file block copy. The reference count value of the file block is increased by "1", and the file block name corresponding to the file index is updated to the copy name of the file block name, so that the file sharing storage device does not have two file blocks with the same content.
上述方法实施例中, 文件索弓 I服务设备建立有每个客户端的文件系统 , 该文件系统中包含对应客户端可访问文件块的文件索引; 建立有文件索弓 I 与对应文件块名对应关系; 当某一客户端需要读取文件, 只需根据该客户 端的请求在该客户端的文件系统中读取对应的文件索引, 查找与该文件索 引对应的文件块名, 然后根据文件块名从文件共享存储设备中读取对应的 文件块, 并发送给对应的客户端即可, 即保证了每个客户端具有独立的文 件系统, 实现了多个客户端共享同一文件块。 同时文件索引服务设备根据 某一客户端的请求, 对其可访问的文件块进行删除、 拷贝或修改时, 不会 对其他客户端可访问的文件块产生任何影响, 可实现为每个客户端可访问 的文件块进行个性设置。  In the foregoing method embodiment, the file storage service device is configured with a file system of each client, and the file system includes a file index corresponding to the client-accessible file block; and the file cable bow I and the corresponding file block name are established. When a client needs to read a file, it only needs to read the corresponding file index in the client's file system according to the client's request, find the file block name corresponding to the file index, and then from the file according to the file block name. The corresponding file block is read in the shared storage device and sent to the corresponding client, that is, each client has an independent file system, and multiple clients share the same file block. At the same time, when the file indexing service device deletes, copies or modifies the file blocks that can be accessed according to the request of a certain client, it does not have any influence on the file blocks accessible by other clients, and can be implemented for each client. Access to the file block for personalization.
本发明提供的另一种实现文件共享的方法的实施例包括以下步驟: 步驟 501、 接收客户端发来的文件读取请求;  Another embodiment of the method for implementing file sharing provided by the present invention includes the following steps: Step 501: Receive a file read request sent by a client;
步驟 502、根据收到的所述文件读取请求,确定所述客户端对应的文件 索引, 所述文件索引与客户端能够访问的文件块之间具有对应关系;  Step 502: Determine, according to the received file read request, a file index corresponding to the client, where the file index has a corresponding relationship with a file block that the client can access;
步驟 503、 读取与所述文件索引相对应的文件块;  Step 503: Read a file block corresponding to the file index.
步驟 504、 将所述文件块中的文件数据发送给所述客户端。  Step 504: Send file data in the file block to the client.
参见图 5、 图 6和图 7, 提出本发明的文件共享系统 1000—实施例, 文件索引服务设备 100和文件共享存储设备 200。 其中, 文件共享存储设备 200, 用于存储文件块, 所述文件块至少能被两个客户端访问。 文件索引服 务设备 100, 用于建立每个客户端的文件系统, 在客户端的文件系统中设置 该客户端能够访问的文件块对应的文件索引; 以及建立每个文件索引与对 应的文件块的对应关系, 并将所述对应关系存储至预设的文件索引数据库 中。 所述文件索引服务设备 100包括文件读取处理模块 110, 该文件读取处 理模块 110包括第一读取模块 111和第二读取模块 112。 其中, 第一读取模 块 111 用于第一读取模块, 用于接收到客户端发送的文件读取请求时, 从 该客户端的文件系统中读取对应的文件索引; 第二读耳 4莫块 112, 用于根据 文件索弓 I读取对应的文件块, 并将所述对应文件块中的文件数据发送给客 户端。 Referring to Figures 5, 6, and 7, a file sharing system 1000 - an embodiment of the present invention, a file indexing service device 100 and a file sharing storage device 200 are presented. Wherein, the file sharing storage device 200, configured to store a file block, where the file block can be accessed by at least two clients. The file indexing service device 100 is configured to establish a file system of each client, set a file index corresponding to the file block that the client can access in the file system of the client, and establish a correspondence between each file index and the corresponding file block. And storing the corresponding relationship in a preset file index database. The file indexing service device 100 includes a file reading processing module 110, and the file reading processing module 110 includes a first reading module 111 and a second reading module 112. The first reading module 111 is configured to use the first reading module, configured to: when receiving the file reading request sent by the client, read the corresponding file index from the file system of the client; Block 112, configured to read a corresponding file block according to the file, and send the file data in the corresponding file block to the client.
进一步地, 上述实施例中, 所述第二读取模块 112, 具体还用于根据文 件索引从文件索引数据库中读取对应的文件块名, 并根据该文件块名从文 件共享存储设备中读取对应的文件块。  Further, in the foregoing embodiment, the second reading module 112 is further configured to: read a corresponding file block name from the file index database according to the file index, and read from the file sharing storage device according to the file block name. Take the corresponding file block.
上述文件共享系统 1000实施例中, 所述文件共享存储设备中相同内容 的文件块只存储一份。  In the above embodiment of the file sharing system 1000, only one copy of the file block of the same content in the file sharing storage device is stored.
上述实施例中, 每个客户端只能访问到自己的文件系统, 即只能读取 文件共享存储设备中的与自身的文件系统中文件索弓 I对应的文件块。  In the above embodiment, each client can only access its own file system, that is, it can only read the file block corresponding to the file file in the file system of the file sharing storage device.
所述建立对应关系的文件索引和文件块名中的文件块名为文件共享存 储设备中对应文件块的名称。 而文件索引则为不同客户端的文件系统中的 文件索引。 其中, 一个文件索引可以与一个或多个文件块名建立对应关系。 文件块名可以是对应文件块的内容的散列值, 如 MD5值, 即以文件块内容 的 MD5值对文件块命名。  The file index in the file association and the file block name in the file block name are named as the names of the corresponding file blocks in the file share storage device. The file index is the file index in the file system of different clients. Wherein, a file index can be associated with one or more file block names. The file block name may be a hash value of the content of the corresponding file block, such as an MD5 value, that is, the file block is named with the MD5 value of the file block content.
进一步地, 上述实施例中, 所述客户端发送的文件读取请求包括待读 取文件的路径、 文件名和存储位置, 第一读取模块 111 , 具体用于根据文件 读取请求中路径、 文件名和存储位置生成文件索引, 并根据该生成的文件 索引, 从所述客户端的文件系统中读取对应的文件索引。 Further, in the above embodiment, the file read request sent by the client includes a path, a file name, and a storage location of the file to be read, and the first reading module 111 is specifically configured to read the path and file according to the file. Name and storage location generate file index, and based on the generated file Index, reading the corresponding file index from the file system of the client.
进一步地, 参见图 8和图 9, 上述文件共享系统 1000实施例中, 所述 文件索引服务设备 100还包括文件删除处理模块 120,该文件删除处理模块 120包括: 引用计数值设置模块 121、 删除子模块 122、 第一引用计数模块 123、第一判断模块 124、第一删除请求模块 125。引用计数值设置模块 121 , 用于各文件块的引用计数值, 所述引用计数值为共享同一文件块的客户端 个数。 删除子模块 122, 用于根据客户端发送的文件删除请求, 删除该客户 端的文件系统中对应的文件索引、 以及文件索 I数据库中所述文件索引和 对应文件块名的对应关系。 第一引用计数模块 123 , 用于将索引数据中对应 的文件块的引用计数值减 "1"。 第一判断模块 124, 用于判断引用计数值是 否为零。 第一删除请求模块 125 , 用于当引用计数值为零时, 则向文件共享 存储设备请求删除引用计数值对应的文件块, 以使文件共享存储设备删除 所述文件块。  Further, referring to FIG. 8 and FIG. 9 , in the foregoing file sharing system 1000, the file indexing service device 100 further includes a file deletion processing module 120, where the file deletion processing module 120 includes: a reference count value setting module 121, and a deletion. The sub-module 122, the first reference counting module 123, the first judging module 124, and the first deletion requesting module 125. The reference count value setting module 121 is configured to use a reference count value of each file block, and the reference count value is a number of clients sharing the same file block. The deleting sub-module 122 is configured to delete a corresponding file index in the file system of the client and a correspondence between the file index and the corresponding file block name in the file I database according to the file deletion request sent by the client. The first reference counting module 123 is configured to reduce the reference count value of the corresponding file block in the index data by "1". The first determining module 124 is configured to determine whether the reference count value is zero. The first deletion request module 125 is configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
上述实施中, 所述文件块的引用计数值代表共享该文件块的客户端个 数。 例如, 文件共享存储设备中存储有文件块 Α, 其中, 客户端 a、 b、 c 和 d都可访问该文件块 A, 即客户端&、 b、 c和 d可共享文件块 A, 则文件 块 A的引用计数值为 "4"。  In the above implementation, the reference count value of the file block represents the number of clients sharing the file block. For example, a file sharing storage device stores a file block Α, wherein clients a, b, c, and d can access the file block A, that is, the client &, b, c, and d can share the file block A, then the file The reference count value of block A is "4".
进一步地, 上述文件共享系统 1000实施例中, 所述文件删除请求中包 括有待删除文件的路径、 文件名和存储位置。 所述删除子模块 122, 还用于 根据文件删除请求中的文件路径、 存储位置和文件名生成待删除文件的文 件索引, 从客户端的文件系统中查找并删除对应的文件索引。  Further, in the above embodiment of the file sharing system 1000, the file deletion request includes a path, a file name, and a storage location of the file to be deleted. The deleting sub-module 122 is further configured to generate a file index of the file to be deleted according to the file path, the storage location, and the file name in the file deletion request, and find and delete the corresponding file index from the file system of the client.
从上述实施例可以看出, 某一客户端需删除其可访问的文件块, 只需 删除该客户端的文件系统中的文件索引, 以及建立对应关系的所述文件索 引与文件块名, 将对应的文件块的引用计数值减 "1" 即可, 无需删除文件 共享存储设备中对应的文件块, 因此不会影响其他客户端。 只有当对应的 文件块的引用计数值为 "0" , 则请求文件共享存储设备删除对应的文件块, 此时表明已无客户端共享对应的文件块。 It can be seen from the foregoing embodiment that a certain client needs to delete a file block that can be accessed by the client, and only needs to delete the file index in the file system of the client, and establish the corresponding file index and file block name, which will correspond to The reference count value of the file block is reduced by "1", and the corresponding file block in the file sharing storage device does not need to be deleted, so the other clients are not affected. Only when corresponding If the reference count value of the file block is "0", the file sharing storage device is requested to delete the corresponding file block, indicating that no corresponding file block is shared by the client.
进一步地, 参见图 10和图 11 , 上述文件共享系统 1000实施例中, 所 述文件索引服务设备 100还包括文件拷贝处理模块 130,该文件拷贝处理模 块 130包括: 文件索引创建模块 131、 文件块名确定模块 132、 对应关系建 立模块 133、 第二判断模块 134、 第二引用计数模块 135、 文件块发送模块 136。 其中, 文件索引创建模块 131 , 用于根据客户端发送的文件拷贝请求, 在该客户端的文件系统中创建对应的拷贝文件索引。 文件块名确定模块 132, 用于对客户端发送的拷贝文件块进行计算, 确定该拷贝文件块名。 对 应关系建立模块 133 ,用于建立并在文件索引数据库中存储拷贝文件索引和 拷贝文件块名的对应关系。 第二判断模块 134, 用于判断是否存在该拷贝文 件块的引用计数值。 第二引用计数模块 135 , 用于当存在该拷贝文件块的引 用计数值时, 将该拷贝文件块的引用计数值加 " 1 " ; 以及当不存在该拷贝 文件块的引用计数值时, 对该拷贝文件块的引用计数值进行计数, 将该拷 贝文件块的引用计数值计数为 " 1"。 文件块发送模块 136, 用于将拷贝文件 块发送至文件共享存储设备中。  Further, referring to FIG. 10 and FIG. 11 , in the foregoing file sharing system 1000, the file indexing service device 100 further includes a file copy processing module 130, where the file copy processing module 130 includes: a file index creating module 131, and a file block. The name determining module 132, the correspondence establishing module 133, the second determining module 134, the second reference counting module 135, and the file block sending module 136. The file index creation module 131 is configured to create a corresponding copy file index in the file system of the client according to the file copy request sent by the client. The file block name determining module 132 is configured to calculate a copy file block sent by the client, and determine the copy file block name. The corresponding relationship establishing module 133 is configured to establish and store a correspondence between the copy file index and the copy file block name in the file index database. The second determining module 134 is configured to determine whether a reference count value of the copy file block exists. a second reference counting module 135, configured to: when the reference count value of the copy file block exists, add a reference count value of the copy file block to "1"; and when there is no reference count value of the copy file block, The reference count value of the copy file block is counted, and the reference count value of the copy file block is counted as "1". The file block sending module 136 is configured to send the copy file block to the file sharing storage device.
进一步地, 上述文件共享系统 1000实施例中, 所述文件拷贝请求中包 括有待拷贝文件的路径、 文件名和存储位置。 所述文件索引创建模块 131 , 还用于根据文件删除请求中的文件路径、 存储位置和文件名生成待拷贝文 件的文件索引, 并在客户端的文件系统中创建对应的拷贝文件索引。  Further, in the above embodiment of the file sharing system 1000, the file copy request includes a path, a file name, and a storage location of the file to be copied. The file index creation module 131 is further configured to generate a file index of the file to be copied according to the file path, the storage location, and the file name in the file deletion request, and create a corresponding copy file index in the file system of the client.
上述实施例中, 第二引用计数模块 135还用于丟弃客户端发送的拷贝 文件块。  In the above embodiment, the second reference counting module 135 is further configured to discard the copy file block sent by the client.
由上述实施例可知, 某一客户端在拷贝其可访问的文件块, 首先创建 待拷贝文件的文件索引, 判断文件共享存储设备中是否存在客户端发送的 拷贝文件块, 若存在只需在建立拷贝文件索引和拷贝文件块名的对应关系, 并将对应的文件块的引用计数值加 "1" 即可, 无需将客户端发送的拷贝文 件块发送至文件共享存储设备中。 只有当文件共享存储设备中没有对应的 文件块, 则需将客户端发送的拷贝文件块发送至文件共享存储设备中。 It can be seen from the above embodiment that a certain client is copying a file block that can be accessed, firstly creating a file index of the file to be copied, and determining whether there is a copy file block sent by the client in the file sharing storage device, and if it exists, only need to be established. Copy the correspondence between the file index and the copy file block name, Add the reference count value of the corresponding file block to "1", and do not need to send the copy file block sent by the client to the file sharing storage device. Only if there is no corresponding file block in the file sharing storage device, the copy file block sent by the client needs to be sent to the file sharing storage device.
进一步地, 参见图 12和图 13 , 上述文件共享系统 1000实施例中, 所 述文件索引服务设备 100还包括: 文件修改处理模块 140, 该文件修改处理 模块 140包括: 文件块名副本创建模块 141、 文件修改请求发送模块 142、 文件块名更新模块 143。 文件块名副本创建模块 141 , 用于根据客户端发送 的文件修改请求, 读取该客户端的文件系统中对应的文件索引; 以及根据 所述文件索引在文件索引数据库中读取对应的文件块名, 并创建该文件块 名的副本。文件修改请求发送模块 142, 用于向文件共享存储设备发送修改 请求, 以使文件共享存储设备根据修改请求建立对应的文件块副本; 并根 据修改请求对文件块副本进行修改。文件块名更新模块 143 , 用于对修改后 的文件块副本进行计算, 确定文件块名的副本名, 在文件索引数据库中将 进一步地, 上述文件共享系统 1000实施例中, 所述文件修改请求中包 括有待修改文件的路径、 文件名和存储位置。 所述文件块名副本创建模块 141 , 还用于根据文件修改请求中的文件路径、 存储位置和文件名生成待修 改文件的文件索引, 读取该客户端的文件系统中对应的文件索引。  Further, referring to FIG. 12 and FIG. 13 , in the foregoing file sharing system 1000, the file indexing service device 100 further includes: a file modification processing module 140, where the file modification processing module 140 includes: a file block name copy creation module 141. The file modification request sending module 142 and the file block name updating module 143. a file block name copy creating module 141, configured to: read a file index corresponding to the file system of the client according to the file modification request sent by the client; and read the corresponding file block name in the file index database according to the file index And create a copy of the file block name. The file modification request sending module 142 is configured to send a modification request to the file sharing storage device, so that the file sharing storage device creates a corresponding file block copy according to the modification request; and the file block copy is modified according to the modification request. a file block name update module 143, configured to calculate a modified copy of the file block, and determine a copy name of the file block name, which is further in the file index database, in the file sharing system 1000 embodiment, the file modification request It includes the path, file name, and storage location of the file to be modified. The file block name copy creation module 141 is further configured to generate a file index of the file to be modified according to the file path, the storage location, and the file name in the file modification request, and read a corresponding file index in the file system of the client.
进一步地, 参见图 14, 上述文件共享系统 1000实施例中, 所述文件修 改处理模块 140还包括: 第三引用计数模块 144、 第二删除请求模块 145。 第三引用计数模块 144,还用于在创建文件名的副本之后, 将所述文件块的 引用计数值减 "1"。 第二删除请求模块 145 , 用于当引用计数值为零时, 则 向文件共享存储设备请求删除所述引用计数值对应的文件块, 以使文件共 享存储设备删除所述文件块。  Further, referring to FIG. 14, in the embodiment of the file sharing system 1000, the file modification processing module 140 further includes: a third reference counting module 144 and a second deletion requesting module 145. The third reference counting module 144 is further configured to reduce the reference count value of the file block by "1" after creating a copy of the file name. The second deletion request module 145 is configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
进一步地, 参见图 15 , 上述文件共享系统 1000实施例中, 所述文件修 改处理模块 140还包括第三判断模块 146。 其中, 第三判断模块, 146用于 判断是否存在文件块副本的引用计数值。 所述第三引用计数模块 144,还用 于当存在对应的文件块副本的引用计数值时, 将该文件块副本的引用计数 值加 "1" , 并通过第二删除请求模块 145 向文件共享存储设备请求删除所 述文件块副本; 以及当不存在对应的文件块副本的引用计数值时, 对该文 件块副本的引用计数值进行计数, 该文件块副本的引用计数值计数为 " 1"。 Further, referring to FIG. 15, in the foregoing file sharing system 1000, the file repairing The modification processing module 140 further includes a third determination module 146. The third determining module, 146 is configured to determine whether there is a reference count value of the file block copy. The third reference counting module 144 is further configured to: when there is a reference count value of the corresponding file block copy, add a reference count value of the file block copy to "1", and share the file with the second deletion request module 145. The storage device requests to delete the file block copy; and when there is no reference count value of the corresponding file block copy, counting the reference count value of the file block copy, the reference count value of the file block copy is counted as "1" .
由上述装置 100 实施例可知, 某一客户端需修改其可访问的文件块, 当文件共享存储设备中存内容与文件块副本相同的文件块, 则请求文件共 享存储设备删除所述文件块副本, 将所述文件块的引用计数值加 " Γ , 将 与文件索弓 I建立对应关系的文件块名更新为文件块名的副本名即可, 保证 文件共享存储设备不存在内容相同的两个文件块。  It can be seen from the foregoing apparatus 100 that a client needs to modify a file block that can be accessed. When the file sharing storage device stores the same file block as the file block copy, the file sharing storage device is requested to delete the file block copy. Adding the reference count value of the file block to " Γ , updating the file block name corresponding to the file file I to the copy name of the file block name, ensuring that the file sharing storage device does not have the same content. File block.
上述系统 1000实施例中, 通过文件索引服务设备 100建立有每个客户 端的文件系统, 该文件系统中包含对应客户端可访问文件块的文件索引; 并建立有文件索引与对应文件块名对应关系; 当某一客户端需要读取文件 , 只需根据该客户端的请求在该客户端的文件系统中读取对应的文件索引, 查找与该文件索引对应的文件块名, 然后根据文件块名从文件共享存储设 备 200 中读取对应的文件块, 并发送给对应的客户端即可, 即保证了每个 客户端具有独立的文件系统, 实现了多个客户端共享同一文件块。 同时文 件索引服务设备 100根据某一客户端的请求, 对其可访问的文件块进行删 除、 拷贝或修改时, 不会对其他客户端可访问的文件块产生任何影响, 可 实现为每个客户端可访问的文件块进行个性设置。  In the embodiment of the system 1000, the file system of each client is established by the file indexing service device 100, and the file system includes a file index corresponding to the client-accessible file block; and a file index corresponding to the corresponding file block name is established. When a client needs to read a file, it only needs to read the corresponding file index in the client's file system according to the client's request, find the file block name corresponding to the file index, and then from the file according to the file block name. The shared storage device 200 reads the corresponding file block and sends it to the corresponding client, that is, each client has an independent file system, and multiple clients share the same file block. At the same time, when the file indexing service device 100 deletes, copies or modifies the file blocks that can be accessed according to the request of a certain client, it does not have any influence on the file blocks accessible by other clients, and can be implemented as each client. Accessible file blocks for personalization.
本发明提供的另一种文件共享系统的实施例包括:  Another embodiment of the file sharing system provided by the present invention includes:
文件共享存储设备, 用于存储文件块, 所述文件块至少能被两个客户 端访问;  a file sharing storage device, configured to store a file block, where the file block can be accessed by at least two clients;
文件索引服务设备, 用于接收客户端发来的文件读取请求; 根据收到的所述文件读取请求, 确定所述客户端对应的文件索引, 所 述文件索引与客户端能够访问的文件块之间具有对应关系; 块, 并将所述文件块中的文件数据发送给所述客户端。 a file indexing service device, configured to receive a file read request sent by the client; Determining, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access; a block, and the file in the file block Data is sent to the client.
提出本发明的一种文件索弓 I服务设备一实施例, 其中本实施例中的文 件索引服务设备即为上述文件共享系统 1000中的文件索引服务设备 100, 本发明提供的另一种文件索引服务设备的实施例包括:  An embodiment of the file arching service device of the present invention is provided. The file indexing service device in the embodiment is the file indexing service device 100 in the file sharing system 1000, and another file index provided by the present invention is provided. Examples of service devices include:
请求接收单元, 用于接收客户端发来的文件读取请求;  a request receiving unit, configured to receive a file read request sent by the client;
请求处理单元, 用于根据收到的所述文件读取请求, 确定所述客户端 对应的文件索引, 所述文件索引与客户端能够访问的文件块之间具有对应 关系;  a request processing unit, configured to determine, according to the received file read request, a file index corresponding to the client, where the file index has a corresponding relationship with a file block that the client can access;
读取与所述文件索弓 I相对应的文件块, 并将所述文件块中的文件数据 发送给所述客户端。  A file block corresponding to the file file is read, and file data in the file block is sent to the client.
应当理解的是, 以上仅为本发明的优选实施例, 不能因此限制本发明 的专利范围, 凡是利用本发明说明书及附图内容所作的等效结构或等效流 程变换, 或直接或间接运用在其他相关的技术领域, 均同理包括在本发明 的专利保护范围内。  It should be understood that the above is only a preferred embodiment of the present invention, and thus the scope of the invention is not limited thereby, and the equivalent structure or equivalent process transformations made by the description of the invention and the drawings are used directly or indirectly. Other related technical fields are equally included in the scope of patent protection of the present invention.

Claims

权利要求书 Claim
1、 一种实现文件共享的方法, 其特征在于, 所述方法包括:  A method for implementing file sharing, the method comprising:
文件共享存储设备存储文件块, 所述文件块至少能被两个客户端访问; 文件索引服务设备建立客户端的文件系统, 在客户端的文件系统中设 置该客户端能够访问的文件块对应的文件索引;  The file sharing storage device stores a file block, and the file block can be accessed by at least two clients; the file indexing service device establishes a file system of the client, and sets a file index corresponding to the file block that the client can access in the file system of the client. ;
建立每个文件索引与对应的文件块的对应关系, 并将所述对应关系存 储至预设的文件索引数据库中;  Establishing a correspondence between each file index and a corresponding file block, and storing the corresponding relationship in a preset file index database;
在接收到客户端发送的文件读取请求时, 从该客户端的文件系统中读 取对应的文件索引;  When receiving a file read request sent by the client, reading a corresponding file index from the file system of the client;
根据文件索引读取对应的文件块, 并将所述对应文件块中的文件数据 发送给客户端。  Reading a corresponding file block according to the file index, and sending the file data in the corresponding file block to the client.
2、 根据权利要求 1所述的实现文件共享的方法, 其特征在于, 所述根 据文件索弓 I读取对应的文件块, 为:  2. The method for implementing file sharing according to claim 1, wherein the reading the corresponding file block according to the file file is:
根据文件索引从文件索引数据库中读取对应的文件块名, 并根据该文 件块名从文件共享存储设备中读取对应的文件块。  The corresponding file block name is read from the file index database according to the file index, and the corresponding file block is read from the file share storage device according to the file block name.
3、 根据权利要求 1所述的实现文件共享的方法, 其特征在于, 所述文 件共享存储设备存储文件块之后, 所述方法还包括:  The method for implementing file sharing according to claim 1, wherein after the file sharing storage device stores the file block, the method further includes:
文件索引服务设备设置各文件块的引用计数值, 所述引用计数值为共 享同一文件块的客户端个数;  The file indexing service device sets a reference count value of each file block, and the reference count value is a number of clients sharing the same file block;
相应的, 根据客户端发送的文件删除请求, 删除该客户端的文件系统 中对应的文件索引, 以及文件索弓 I数据库中所述文件索弓 I和对应文件块名 的对应关系;  Correspondingly, according to the file deletion request sent by the client, the corresponding file index in the file system of the client is deleted, and the correspondence between the file and the corresponding file block name in the file file database is deleted;
将对应的文件块的引用计数值减 "1" ;  Decrease the reference count value of the corresponding file block by "1";
判断所述引用计数值是否为零;  Determining whether the reference count value is zero;
当所述引用计数值为零时, 向文件共享存储设备请求删除所述引用计 数值对应的文件块, 以使文件共享存储设备删除所述文件块。 When the reference count value is zero, requesting to delete the reference meter from the file sharing storage device The file block corresponding to the value, so that the file sharing storage device deletes the file block.
4、 根据权利要求 1所述的实现文件共享的方法, 其特征在于, 所述文 件共享存储设备存储文件块之后, 所述方法还包括:  The method for implementing file sharing according to claim 1, wherein after the file sharing storage device stores the file block, the method further includes:
文件索引服务设备根据客户端发送的文件拷贝请求, 在该客户端的文 件系统中创建对应的拷贝文件索引;  The file indexing service device creates a corresponding copy file index in the file system of the client according to the file copy request sent by the client;
对客户端发送的拷贝文件块进行计算, 确定该拷贝文件块名; 建立并在文件索引数据库中存储拷贝文件索引和拷贝文件块名的对应 关系;  Calculating a copy file block sent by the client, determining the copy file block name; establishing and storing a correspondence relationship between the copy file index and the copy file block name in the file index database;
判断是否存在该拷贝文件块的引用计数值;  Determining whether there is a reference count value of the copy file block;
若是, 则将该拷贝文件块的引用计数值加 " 1" ;  If yes, add the reference count value of the copy file block to "1";
若否, 则对该拷贝文件块的引用计数值进行计数, 将该拷贝文件块的 引用计数值计数为 "1" , 并将拷贝文件块发送至文件共享存储设备中。  If not, the reference count value of the copy file block is counted, the reference count value of the copy file block is counted as "1", and the copy file block is sent to the file sharing storage device.
5、 根据权利要求 1至 4任一项所述的实现文件共享的方法, 其特征在 于, 所述文件共享存储设备存储文件块之后, 所述方法还包括:  The method for implementing file sharing according to any one of claims 1 to 4, wherein after the file sharing storage device stores the file block, the method further includes:
文件索引服务设备根据客户端发送的文件修改请求, 读取该客户端的 文件系统中对应的文件索引;  The file indexing service device reads the corresponding file index in the file system of the client according to the file modification request sent by the client;
根据所述文件索引在文件索引数据库中读取对应的文件块名, 并创建 该文件块名的副本;  Reading a corresponding file block name in the file index database according to the file index, and creating a copy of the file block name;
向文件共享存储设备发送修改请求, 以使文件共享存储设备根据修改 请求建立对应的文件块副本, 并根据修改请求对文件块副本进行修改; 对修改后的文件块副本进行计算, 确定文件块名的副本名, 在文件索  Sending a modification request to the file sharing storage device, so that the file sharing storage device establishes a corresponding file block copy according to the modification request, and modifying the file block copy according to the modification request; performing calculation on the modified file block copy to determine the file block name Copy name, in the file
6、 根据权利要求 5所述的实现文件共享的方法, 其特征在于, 在创建 该文件名的副本之后, 所述方法还包括: The method for implementing file sharing according to claim 5, wherein after the copy of the file name is created, the method further includes:
文件索引服务设备将所述文件块的引用计数值减 "1"; 当所述引用计数值为零时, 则向文件共享存储设备请求删除所述引用 计数值对应的文件块, 以使文件共享存储设备删除所述文件块。 The file indexing service device decrements the reference count value of the file block by "1"; When the reference count value is zero, the file sharing storage device is requested to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file block.
7、 根据权利要求 6所述的实现文件共享的方法, 其特征在于, 在文件 之后, 所述方法还包括:  The method for implementing file sharing according to claim 6, wherein after the file, the method further comprises:
文件索引服务设备判断是否存在文件块副本的引用计数值;  The file indexing service device determines whether there is a reference count value of the file block copy;
若是, 则将该文件块副本的引用计数值加 " 1" , 并向文件共享存储设 备删除所述文件块副本;  If yes, the reference count value of the file block copy is incremented by "1", and the file block copy is deleted from the file sharing storage device;
若否, 则对该文件块副本的引用计数值进行计数, 该文件块副本的引 用计数值计数为 "1"。  If not, the reference count value of the file block copy is counted, and the reference count value of the file block copy is counted as "1".
8、 一种实现文件共享的方法, 其特征在于, 所述方法包括: 接收客户端发来的文件读取请求;  A method for implementing file sharing, the method comprising: receiving a file read request sent by a client;
根据收到的所述文件读取请求, 确定所述客户端对应的文件索引, 所 述文件索引与客户端能够访问的文件块之间具有对应关系;  And determining, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access;
读取与所述文件索弓 I相对应的文件块;  Reading a file block corresponding to the file file I;
将所述文件块中的文件数据发送给所述客户端。  Transmitting file data in the file block to the client.
9、 一种文件共享系统, 其特征在于, 所述系统包括:  9. A file sharing system, wherein the system comprises:
文件共享存储设备, 用于存储文件块, 所述文件块至少能被两个客户 端访问;  a file sharing storage device, configured to store a file block, where the file block can be accessed by at least two clients;
文件索引服务设备, 用于建立每个客户端的文件系统, 在客户端的文 件系统中设置该客户端能够访问的文件块对应的文件索引; 建立每个文件 索引与对应的文件块的对应关系, 并将所述对应关系存储至预设的文件索 引数据库中;  a file indexing service device, configured to establish a file system of each client, and set a file index corresponding to the file block that the client can access in the file system of the client; establish a correspondence between each file index and the corresponding file block, and The corresponding relationship is stored in a preset file index database;
所述文件索引服务设备包括:  The file indexing service device includes:
第一读取模块, 用于接收到客户端发送的文件读取请求时, 从该客户 端的文件系统中读取对应的文件索引; a first reading module, configured to receive a file read request sent by the client from the client Reading the corresponding file index in the file system of the terminal;
第二读取模块, 用于根据文件索引读取对应的文件块, 并将所述对应 文件块中的文件数据发送给客户端。  The second reading module is configured to read the corresponding file block according to the file index, and send the file data in the corresponding file block to the client.
10、 根据权利要求 9所述的文件共享系统, 其特征在于,  10. The file sharing system according to claim 9, wherein:
所述第二读取模块, 具体还用于根据文件索弓 I从文件索弓 I数据库中读 取对应的文件块名, 并根据该文件块名从文件共享存储设备中读取对应的 文件块。  The second reading module is further configured to read a corresponding file block name from the file file I according to the file file, and read the corresponding file block from the file sharing storage device according to the file block name. .
11、 根据权利要求 9所述的文件共享系统, 其特征在于, 所述文件索 引服务设备还包括:  The file sharing system according to claim 9, wherein the file indexing service device further comprises:
引用计数值设置模块, 用于设置各文件块的引用计数值, 所述引用计 数值为共享同一文件块的客户端个数;  a reference count value setting module, configured to set a reference count value of each file block, where the reference count value is a number of clients sharing the same file block;
删除子模块, 用于根据客户端发送的文件删除请求, 删除该客户端的 文件系统中对应的文件索引、 以及文件索弓 I数据库中所述文件索弓 I和对应 文件块名的对应关系;  Deleting a sub-module, configured to delete, according to a file deletion request sent by the client, a corresponding file index in the file system of the client, and a correspondence between the file file and the corresponding file block name in the file file database;
第一引用计数模块, 用于对应的文件块的引用计数值减 "1" ;  The first reference counting module is configured to reduce the reference count value of the corresponding file block by "1";
第一判断模块, 用于判断引用计数值是否为零;  a first determining module, configured to determine whether the reference count value is zero;
第一删除请求模块, 用于当引用计数值为零时, 向文件共享存储设备 请求删除所述 !用计数值对应的文件块, 以使文件共享存储设备删除所述 文件块。  The first deletion request module is configured to request to delete the file sharing storage device when the reference count value is zero! The file block corresponding to the count value is used to cause the file sharing storage device to delete the file block.
12、 根据权利要求 9所述的文件共享系统, 其特征在于, 所述文件索 引服务设备还包括:  The file sharing system according to claim 9, wherein the file indexing service device further comprises:
文件索引创建模块, 用于根据客户端发送的文件拷贝请求, 在该客户 端的文件系统中创建对应的拷贝文件索引;  a file index creation module, configured to create a corresponding copy file index in the file system of the client according to the file copy request sent by the client;
文件块名确定模块, 用于对客户端发送的拷贝文件块进行计算, 确定 该拷贝文件块名; 对应关系建立模块, 用于建立并在文件索弓!数据库中存储拷贝文件索 引和拷贝文件块名的对应关系; a file block name determining module, configured to calculate a copy file block sent by the client, and determine the copy file block name; Correspondence relationship building module, used to build and file in the file! The correspondence between the copy file index and the copy file block name is stored in the database;
第二判断模块, 用于判断是否存在该拷贝文件块的引用计数值; 第二引用计数模块, 用于当存在该拷贝文件块的引用计数值时, 将该 拷贝文件块的引用计数值加 " 1" ; 以及当不存在该拷贝文件块的引用计数 值时, 对该拷贝文件块的引用计数值进行计数, 将该拷贝文件块的引用计 数值计数为 " 1" ;  a second judging module, configured to determine whether a reference count value of the copy file block exists; and a second reference counting module, configured to add a reference count value of the copy file block when the reference count value of the copy file block exists 1"; and when the reference count value of the copy file block does not exist, the reference count value of the copy file block is counted, and the reference count value of the copy file block is counted as "1";
文件块发送模块, 用于将拷贝文件块发送至文件共享存储设备中。 A file block sending module, configured to send the copy file block to the file sharing storage device.
13、 根据权利要求 9至 12任一项所述的文件共享系统, 其特征在于, 所述文件索引服务设备还包括: The file sharing system according to any one of claims 9 to 12, wherein the file indexing service device further comprises:
文件块名副本创建模块, 用于根据客户端发送的文件修改请求, 读取 该客户端的文件系统中对应的文件索引; 以及根据所述文件索弓 I在文件索 引数据库中读取对应的文件块名, 并创建该文件块名的副本;  a file block name copy creating module, configured to read a corresponding file index in the file system of the client according to the file modification request sent by the client; and read the corresponding file block in the file index database according to the file file Name, and create a copy of the file block name;
文件修改请求发送模块, 用于向文件共享存储设备发送修改请求, 以 使文件共享存储设备根据修改请求建立对应的文件块副本; 并根据修改请 求对文件块副本进行修改;  a file modification request sending module, configured to send a modification request to the file sharing storage device, so that the file sharing storage device establishes a corresponding file block copy according to the modification request; and modifying the file block copy according to the modification request;
文件块名更新模块, 用于对修改后的文件块副本进行计算, 确定文件 块名的副本名, 在文件索弓 I数据库中将与所述文件索弓 I对应的文件块名更 新为文件块名的副本名。  a file block name update module, configured to calculate a modified copy of the file block, determine a copy name of the file block name, and update the file block name corresponding to the file file I to a file block in the file file I database The name of the copy.
14、 根据权利要求 13所述的文件共享系统, 其特征在于, 所述文件索 引服务设备还包括:  The file sharing system according to claim 13, wherein the file indexing service device further comprises:
第三引用计数模块, 用于在创建文件名的副本之后, 将所述文件块的 引用计数值减 " 1" ;  a third reference counting module, configured to: after creating a copy of the file name, reduce the reference count value of the file block by "1";
第二删除请求模块, 用于当引用计数值为零时, 则向文件共享存储设 备请求删除所述引用计数值对应的文件块, 以使文件共享存储设备删除所 述文件块。 a second deletion requesting module, configured to: when the reference count value is zero, request the file sharing storage device to delete the file block corresponding to the reference count value, so that the file sharing storage device deletes the file File block.
15、 根据权利要求 14所述的文件共享系统, 其特征在于, 所述文件索 引服务设备还包括:  The file sharing system according to claim 14, wherein the file indexing service device further comprises:
第三判断模块, 用于判断是否存在文件块副本的引用计数值; 所述第三引用计数模块, 还用于当存在对应的文件块副本的引用计数 值时, 将该文件块副本的引用计数值加 " 1 " , 并通过第二删除请求模块向 文件共享存储设备请求删除所述文件块副本; 以及当不存在对应的文件块 副本的引用计数值时, 对该文件块副本的引用计数值进行计数, 将该文件 块副本的引用计数值计数为 " 1"。  a third judging module, configured to determine whether there is a reference count value of the file block copy; the third reference counting module is further configured to: when there is a reference count value of the corresponding file block copy, the reference count of the file block copy Adding a value of "1", and requesting deletion of the file block copy to the file sharing storage device by the second deletion request module; and a reference count value of the file block copy when there is no reference count value of the corresponding file block copy Counting, the reference count value of the file block copy is counted as "1".
16、 一种文件共享系统, 其特征在于, 所述系统包括:  16. A file sharing system, the system comprising:
文件共享存储设备, 用于存储文件块, 所述文件块至少能被两个客户 端访问;  a file sharing storage device, configured to store a file block, where the file block can be accessed by at least two clients;
文件索引服务设备, 用于接收客户端发来的文件读取请求;  a file indexing service device, configured to receive a file read request sent by the client;
根据收到的所述文件读取请求, 确定所述客户端对应的文件索引, 所 述文件索引与客户端能够访问的文件块之间具有对应关系; 块, 并将所述文件块中的文件数据发送给所述客户端。  Determining, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access; a block, and the file in the file block Data is sent to the client.
17、 一种文件索引服务设备, 其特征在于, 所述文件索引服务设备为 权利要求 9至 15任一项所述的文件索引服务设备。  A file indexing service device, wherein the file indexing service device is the file indexing service device according to any one of claims 9 to 15.
18、 一种文件索引服务设备, 其特征在于, 所述文件索引服务设备包 括:  18. A file indexing service device, wherein the file indexing service device comprises:
请求接收单元, 用于接收客户端发来的文件读取请求;  a request receiving unit, configured to receive a file read request sent by the client;
请求处理单元, 用于根据收到的所述文件读取请求, 确定所述客户端 对应的文件索引, 所述文件索引与客户端能够访问的文件块之间具有对应 关系; 读取与所述文件索 I相对应的文件块, 并将所述文件块中的文件数据 发送给所述客户端。 a request processing unit, configured to determine, according to the received file read request, a file index corresponding to the client, where the file index has a correspondence relationship with a file block that the client can access; A file block corresponding to the file I is read, and file data in the file block is sent to the client.
PCT/CN2012/083232 2011-11-23 2012-10-19 File sharing system, method for achieving file sharing, and file index service device WO2013075563A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110375752.2 2011-11-23
CN201110375752.2A CN102419770B (en) 2011-11-23 2011-11-23 File sharing system, method for realizing file sharing, and file index service equipment

Publications (1)

Publication Number Publication Date
WO2013075563A1 true WO2013075563A1 (en) 2013-05-30

Family

ID=45944183

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/083232 WO2013075563A1 (en) 2011-11-23 2012-10-19 File sharing system, method for achieving file sharing, and file index service device

Country Status (2)

Country Link
CN (1) CN102419770B (en)
WO (1) WO2013075563A1 (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102419770B (en) * 2011-11-23 2014-12-31 中兴通讯股份有限公司 File sharing system, method for realizing file sharing, and file index service equipment
CN102904926A (en) * 2012-08-31 2013-01-30 苏州佳世达光电有限公司 Method and system for sharing and editing file
CN103823807B (en) * 2012-11-16 2018-06-15 深圳市腾讯计算机系统有限公司 A kind of method, apparatus and system for removing repeated data
CN104038526B (en) * 2013-03-08 2018-10-12 联想(北京)有限公司 Data access method and system
CN104426955B (en) * 2013-08-28 2018-05-04 北大方正集团有限公司 The processing method and cloud storage service device of shared file
CN103488768B (en) * 2013-09-27 2018-07-27 Tcl集团股份有限公司 A kind of file management method and system based on cloud computing
CN105634981B (en) * 2014-10-30 2019-08-16 阿里巴巴集团控股有限公司 Content caching and transmission method and its system
CN106445951B (en) * 2015-08-07 2022-05-17 中兴通讯股份有限公司 File transmission method and device
CN105306564A (en) * 2015-10-20 2016-02-03 浪潮集团有限公司 Database-based network disk file replication method and server
CN106446201A (en) * 2016-09-30 2017-02-22 福建中金在线信息科技有限公司 Processing method and device of social circle data
CN108573162A (en) * 2017-05-31 2018-09-25 北京金山云网络技术有限公司 data copy system, method and device
CN109213739A (en) * 2017-06-29 2019-01-15 上海共联通信信息发展有限公司 A kind of information processing method of shared file
CN107577423A (en) * 2017-08-15 2018-01-12 上海斐讯数据通信技术有限公司 A kind of method and system for optimizing memory space
CN107861781A (en) * 2017-09-29 2018-03-30 努比亚技术有限公司 A kind of file operation method and device
CN108920606B (en) * 2018-06-28 2020-10-23 腾讯大地通途(北京)科技有限公司 Map data processing method, map data processing device, terminal equipment and storage medium
CN109522286B (en) * 2018-11-22 2021-08-17 北京小米智能科技有限公司 Processing method and device of file system
CN109597798A (en) * 2018-12-04 2019-04-09 平安科技(深圳)有限公司 Network file delet method, device, computer equipment and storage medium
CN111414335B (en) * 2020-03-20 2023-07-14 深圳市凯沃尔电子有限公司 Data file searching method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079034A (en) * 2006-07-10 2007-11-28 腾讯科技(深圳)有限公司 System and method for eliminating redundancy file of file storage system
CN102419770A (en) * 2011-11-23 2012-04-18 中兴通讯股份有限公司 File sharing system, method for realizing file sharing, and file index service equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7403949B2 (en) * 2005-08-17 2008-07-22 International Business Machines Corporation Elimination of redundant objects in storage systems
WO2007047349A2 (en) * 2005-10-14 2007-04-26 Symantec Operating Corporation Technique for improving scalability and portability of a storage management system
CN101996228A (en) * 2009-08-18 2011-03-30 北京艾德斯科技有限公司 Method for sharing file data block and method for de-sharing file data block
CN102065110A (en) * 2009-11-12 2011-05-18 钟惠波 On-line updating method and system for client side software on basis of P2SP (Peer to Server and to Peer)

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079034A (en) * 2006-07-10 2007-11-28 腾讯科技(深圳)有限公司 System and method for eliminating redundancy file of file storage system
CN102419770A (en) * 2011-11-23 2012-04-18 中兴通讯股份有限公司 File sharing system, method for realizing file sharing, and file index service equipment

Also Published As

Publication number Publication date
CN102419770B (en) 2014-12-31
CN102419770A (en) 2012-04-18

Similar Documents

Publication Publication Date Title
WO2013075563A1 (en) File sharing system, method for achieving file sharing, and file index service device
US10382380B1 (en) Workload management service for first-in first-out queues for network-accessible queuing and messaging services
US8935560B2 (en) System and method of file locking in a network file system federated namespace
CN108683668B (en) Resource checking method, device, storage medium and equipment in content distribution network
WO2019075978A1 (en) Data transmission method and apparatus, computer device, and storage medium
EP2863310A1 (en) Data processing method and apparatus, and shared storage device
US9372879B1 (en) Balanced append tree data structure
US9064106B2 (en) Method and apparatus to keep consistency of ACLs among a meta data server and data servers
JP2010026814A (en) Resource migration system, resource migration method, information processor, and computer program
WO2020259146A1 (en) Resource lock management method and apparatus
US11645424B2 (en) Integrity verification in cloud key-value stores
JP2018521405A (en) Access method and apparatus
US20200159560A1 (en) Propagating ordered object changes
CN111226206A (en) Taking snapshots of blockchain data
US20150222431A1 (en) Random identifier generation for offline database
US11809377B2 (en) Global data deduplication across multiple distributed file systems
JP2005208999A (en) Virtual machine management program
CN111316256A (en) Taking snapshots of blockchain data
Patil et al. Kua: a distributed object store over named data networking
WO2019047875A1 (en) Method and device for storing and reading data
US9578120B1 (en) Messaging with key-value persistence
JP2009237979A (en) Information processing device and method, and program
CN112866406A (en) Data storage method, system, device, equipment and storage medium
WO2024001304A1 (en) Data processing method and related device
WO2023142605A1 (en) Blockchain-based data processing method and related apparatus

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: 12850967

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: 12850967

Country of ref document: EP

Kind code of ref document: A1