Summary of the invention
Embodiment of the present invention is mainly solving the technical problems that provide a kind of network node based on distributed hashtable
Processing method, device, network node, distributed hashtable network and storage medium, be able to solve nodal point separation in the prior art
The problem of from not being associated between real network delay, network addressing speed and communication efficiency can be improved.
In a first aspect, the embodiment of the present application provides a kind of network node treatment method based on distributed hashtable, institute
Method is stated for first network node, the described method comprises the following steps:
Obtain the node ID of the first network node;
Obtain the location information of the first network node;
According to the positional information and the node ID generates the first node ID comprising node location information.
In some embodiments, the method also includes:
The second node ID in the second network node comprising node location information is obtained, second network node is at least
One;
It is that second network node distributes priority level according to the first node ID and second node ID.
In some embodiments, the priority level includes at least the first priority and the second priority, and described first is excellent
First grade is higher than second priority level.
In some embodiments, the method also includes:
Obtain the file ID of file;
The second network node in the first priority of the first network node is obtained, and obtains the first network section
The nodal distance of point and the second network node each in the first priority;
The file is stored in the smallest second network node of distance in the nodal distance.
In some embodiments, the method also includes:
Obtain the file ID of file;
By the node of each second network node in the first priority of first network node described in the file ID matches
ID;
If the file ID is matched with the node ID of the second network node in first priority, from matched
The file is read in two network nodes, if each second network node in the file ID and first priority
Node ID mismatches, then continues to match each second net in the second priority of the first network node for the file ID
The node ID of network node.
In some embodiments, the location information for obtaining the first network node ID, comprising:
Obtain at least one of address longitude and latitude, countries and regions and the operator where the network node.
In some embodiments, it is described according to the positional information and the node ID generate include node location information
First node ID, comprising:
The node ID is extended, increases the X for indicating the location information newly on the basis of original node ID
Position, X is natural number.
Second aspect, the network node processing unit based on distributed hashtable that the embodiment of the present application also provides a kind of,
Described device is used for first network node, comprising:
First obtains module, for obtaining the node ID of the first network node;
Second obtains module, for obtaining the location information of the first network node;
Generation module includes the first of node location information for generating according to the location information and the node ID very much
Node ID.
The third aspect, the embodiment of the present application also provides a kind of network nodes, comprising:
At least one processor;And
The memory being connect at least one described processor communication;Wherein,
The memory is stored with the instruction that can be executed by least one described processor, and described instruction is by described at least one
A processor executes, so that at least one described processor is able to carry out above-mentioned method.
Fourth aspect, the embodiment of the present application also provides a kind of networks based on distributed hashtable, including at least one
Network node described above.
5th aspect, the embodiment of the present application also provides a kind of non-volatile computer readable storage medium storing program for executing, the calculating
Machine readable storage medium storing program for executing is stored with computer executable instructions, when the computer executable instructions are executed by processor, makes
The processor executes above-mentioned method.
Network node treatment method and device provided by the embodiments of the present application based on distributed hashtable, by obtaining the
The node ID and location information of one network node generate the first node ID comprising node location information, thus can solve node
The problem of not being associated between distance and real network delay, can improve network addressing speed and communication efficiency.
Specific embodiment
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application
In attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is
Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall in the protection scope of this application.
Network provided by the present application based on distributed hashtable, as shown in Figure 1, including first network node 20, multiple
Second network node 30 communicates to connect between the arbitrary node in first net node 20 and multiple second network nodes 30, in Fig. 1
It is only exemplary and shows the second network node A, the second network node B, the second network node C, in real network environment
It further include more second network nodes.It should be noted that first network node and the second network node are only to facilitate say
Bright the application and define, be relative concept.It is first network node, the second network section that any node in network, which can also be defined,
Point, without adhering rigidly to definition in this present embodiment.
Specifically, obtaining the node ID of first network node and the location information of first network node, believed according to position
Breath and node ID generate the first node ID comprising node location information, thus solve nodal distance and real network delay
Between the problem of not being associated with.
As shown in Fig. 2, the embodiment of the present application provides a kind of network node treatment method based on distributed hashtable, use
In first network node, comprising the following steps:
Step 202, the node ID of first network node is obtained.
Wherein, node ID is the identity of node, each node has and an only unique node ID is right therewith
It answers.There are numerous nodes, one in only numerous network nodes that the present embodiment obtains saves network in distributed hashtable
Point ID.
Step 204, the location information of first network node is obtained.
Location information includes physical location, countries and regions and the fortune of address longitude and latitude where node, certain coded format
Seek at least one in quotient.After the node ID for obtaining first network node, the location information of first network node is then obtained.
Step 206, the first node ID comprising node location information is generated according to location information and node ID.
First node ID is generated according to the node ID of first network node and the location information of first network node, raw
At first node ID contain the location information of node.
The above-mentioned network node treatment method based on distributed hashtable, by obtain first network node node ID and
Location information generates the first node ID comprising node location information, and solving does not have between nodal distance and real network delay
The problem of association, improves network addressing speed and communication efficiency.
As shown in figure 3, in one embodiment based on the network node treatment method of distributed hashtable further include:
Step 302, the second node ID in the second network node comprising node location information is obtained, the second network node is
At least one.
It step 304, is that the second network node distributes priority according to first node ID and second node ID.
Second node ID is obtained according to the node ID of the second network node and the location information of the second network node, the
Two network nodes have it is multiple, the node ID for the location information that each different network node includes be it is different, in this implementation
In example, the second network node is at least one.The priority of second network node is determined by first node ID and second node ID
Fixed, the location information as where each node ID contains node, it is possible to according to node ID as division second
The foundation of network node priority.
In one embodiment based on the network node treatment method of distributed hashtable further include: priority level is at least wrapped
The first priority and the second priority are included, the first priority is higher than the second priority.In the present embodiment, priority is for weighing
Measure a key factor of network delay, it is however generally that, priority is higher, and network delay is smaller.Priority is according to first segment
What point ID and second node ID was determined.For example, priority is divided based on actual geographical location, then setting with city
It is set to the first priority, same province is the second priority with state, divides according to national size and actual conditions, is that third is preferential with continent
Grade, and so on, can have many uncertain factors due to transnational, the division of priority determine according to the actual situation be
Can, different grades can be divided to priority, without sticking to the present embodiment.The present embodiment by the second network node into
The division of row major grade solves the problems, such as not to be associated between nodal distance and real network delay, net thus can be improved
Network addressing speed and communication efficiency.
As shown in figure 4, in one embodiment based on the network node treatment method of distributed hashtable further include:
Step 402, the file ID of file is obtained.
File ID is obtained by algorithm, each file has by calculating and only one file ID.
Step 404, the second network node in the first priority of first network node is obtained, and obtains first network section
The nodal distance of point and the second network node each in the first priority.
Step 406, file is stored in the smallest second network node of distance in nodal distance.
When carrying out file storage, need to know the node of the second network node in the first priority of first network node
Distance, file storage can select nearest node to be stored according to nodal distance.Specifically, first having to obtain first network section
Point the first priority in the second network node, then by operation obtain first network node with it is each in the first priority
The nodal distance of second network node, according to nodal distance determine file storage position, by file be stored in nodal distance in away from
From the smallest second network node.It should be noted that the second network node can have it is multiple, be elected in distance it is the smallest by the
When two network nodes refuse the storage of file, then the second network node for selecting distance second close node stored as a file,
And so on, it stores until by file to the second network node.By obtaining the file ID and calculate node distance of file, most
File is stored into nodal distance in the smallest second network node afterwards, is solved between nodal distance and real network delay
The problem of not being associated with further improves network addressing speed and communication efficiency.
As shown in figure 5, in one embodiment based on the network node treatment method of distributed hashtable further include:
Step 502, the file ID of file is obtained.
Step 504, by the node of each second network node in the first priority of file ID matches first network node
ID。
File ID is obtained by algorithm, each file has by calculating and only one file ID.File is read
When, since file ID is known, elder generation's each second net in the first priority of first network node according to file ID
The node ID of network node carries out file search.
Step 506, if file ID is matched with the node ID of the second network node in the first priority, from the second network
File is read in node, if the node ID of file ID and each second network node in the first priority mismatches,
File ID is continued to the node ID of each second network node in the second priority of matching first network node.
Specifically, file read when, file ID be it is known, with the second network node in file ID and the first priority
Node ID matched, if node ID of the file ID just with the second network node in the first priority matches,
Can file directly be read from the second network node.If the node of each second network node in file ID and the first priority
ID is uniformly matched, and is also meaned that, file not associated therewith in the first priority, then continues file ID to match the first net
The node ID of each second network node in second priority of network node.If each in file ID and the second priority
The node ID of two network nodes mismatches, then carries out each second network in the third priority of matching first network node
The node ID of node, by this present embodiment, priority is up to three-level, so when the third for being matched to first network node is excellent
When the node ID of each second network node in first grade, it can all be matched to corresponding node ID.In some other embodiment,
Priority can be multistage, divide according to the actual situation, without sticking to the present embodiment.
In one embodiment based on the network node treatment method of distributed hashtable further include: obtain network node institute
At least one of address longitude and latitude, countries and regions and operator.
At least one of address longitude and latitude, countries and regions and operator can be believed as the position of network node ID
Breath.
In one embodiment based on the network node treatment method of distributed hashtable further include: expand node ID
Exhibition, increases the position X for indicating location information newly, X is natural number on the basis of original node ID.
Specifically, node ID is increased newly on the basis of original node ID, such as node ID is 64, then for node
ID is extended, and highest 16 for indicating physical location, the country ground of address longitude and latitude where node, certain coded format
Area and operator etc..
Correspondingly, the embodiment of the present application also provides a kind of network node processing unit based on distributed hashtable, is used
In first network node, as shown in Figure 6, comprising: the first acquisition module 602, the second acquisition module 604, generation module 606,
In:
First obtains module 602, for obtaining the node ID of first network node.
Second obtains module 604, for obtaining the location information of first network node.
Generation module 606 includes node location for being generated according to the location information and node ID of first network node
The first node ID of information.
Network node processing unit provided by the embodiments of the present application based on distributed hashtable, by obtaining first network
The node ID and location information of node generate the first node ID comprising node location information, solve nodal distance and practical net
The problem of not being associated between network delay, improves network addressing speed and communication efficiency.
In one embodiment, the network node processing unit based on distributed hashtable further include distribution module 608,
With module 610, expansion module 612, memory module 614, read module 616.Distribution module 608 be used for according to first node ID and
Second node ID is that the second network node distributes priority level.Matching module 610 is used for file ID matches first network node
The first priority in each second network node node ID;If each second network in file ID and the first priority
The node ID of node mismatches, then continues file ID to match each second network in the second priority of first network node
The node ID of node.Expansion module 612 increases X newly for being extended to node ID on the basis of original node ID, and X is
Natural number.Memory module 614 is used to file being stored in the smallest second network node of distance in nodal distance.Read module 616
If being matched for file ID with the node ID of the second network node in the first priority, from matched second network node
Read file.
In one embodiment, the first acquisition module 602 can also obtain in the second network node believes comprising node location
The second node ID of breath, the second network node are at least one;Obtain the file ID of file;Obtain the first of first network node
The second network node in priority, and obtain the node of each second network node in first network node and the first priority
Distance;Obtain at least one of address longitude and latitude, countries and regions and the operator where network node.
It should be noted that the embodiment of the present application can be performed in the above-mentioned network node processing unit based on distributed hashtable
The provided network node treatment method based on distributed hashtable has the corresponding functional module of execution method and beneficial to effect
Fruit.The technical detail of detailed description not in the network node processing device embodiment based on distributed hashtable, reference can be made to this
Apply for the network node treatment method based on distributed hashtable provided by embodiment.
Fig. 7 is the hardware structural diagram of network node 10 provided by the embodiments of the present application, as shown in fig. 7, the network section
Putting 10 includes:
One or more processors 11 and memory 12, in Fig. 7 by taking a processor 11 as an example.
Processor 11 can be connected with memory 12 by bus or other modes, to be connected as by bus in Fig. 7
Example.
Memory 12 is used as a kind of non-volatile computer readable storage medium storing program for executing, can be used for storing non-volatile software journey
Sequence, non-volatile computer executable program and module, such as the network based on distributed hashtable in the embodiment of the present application
Corresponding program instruction/the module of Node Processing Method is (for example, attached shown in fig. 6 first obtains the acquisition module of module 602, second
604 and generation module 606).
Non-volatile software program, instruction and module of the processor 11 by operation storage in memory 12, thus
Execute network node various function application and data processing, i.e., realization above method embodiment based on distributed hashtable
Network node treatment method.
Memory 12 may include storing program area and storage data area, wherein storing program area can storage program area,
Application program required at least one function;Storage data area can be stored according at the network node based on distributed hashtable
Reason device uses created data etc..In addition, memory 12 may include high-speed random access memory, can also include
Nonvolatile memory, for example, at least a disk memory, flush memory device or other non-volatile solid state memory parts.
In some embodiments, it includes the memory remotely located relative to processor 11, these remote memories that memory 12 is optional
Network connection to the network node processing unit based on distributed hashtable can be passed through.The example of above-mentioned network includes but unlimited
In internet, intranet, local area network, mobile radio communication and combinations thereof.
One or more of modules are stored in the memory 12, when by one or more of processors 11
When execution, the network node treatment method based on distributed hashtable in above-mentioned any means embodiment is executed, for example, executing
Method and step 202 in Fig. 2 described above is to step 206, method and step 302 in Fig. 3 to step 304, the method in Fig. 4
Step 402 is to step 406, method and step 502 in Fig. 5 to step 506;Realize the function of the module 602 to 616 in Fig. 6.
The embodiment of the present application provides a kind of non-volatile computer readable storage medium storing program for executing, the computer-readable storage medium
Matter is stored with computer executable instructions, which is executed by one or more processors, such as in Fig. 7
One processor 11, may make said one or multiple processors can be performed in above-mentioned any means embodiment based on distribution
The network node treatment method of Hash table, for example, executing method and step 202 in Fig. 2 described above to step 206, in Fig. 3
Method and step 302 to step 304, method and step 402 in Fig. 4 to step 406, method and step 502 in Fig. 5 to step
506;Realize the function of the module 602 to 616 in Fig. 6.
The apparatus embodiments described above are merely exemplary, wherein described, unit can as illustrated by the separation member
It is physically separated with being or may not be, component shown as a unit may or may not be physics list
Member, it can it is in one place, or may be distributed over multiple network units.It can be selected according to the actual needs
In some or all of the modules achieve the purpose of the solution of this embodiment.
Through the above description of the embodiments, those of ordinary skill in the art can be understood that each embodiment
The mode of general hardware platform can be added to realize by software, naturally it is also possible to pass through hardware.Those of ordinary skill in the art can
With understand all or part of the process realized in above-described embodiment method be can be instructed by computer program it is relevant hard
Part is completed, and the program can be stored in a computer-readable storage medium, the program is when being executed, it may include as above
State the process of the embodiment of each method.Wherein, the storage medium can be magnetic disk, CD, read-only memory (Read-
Only Memory, ROM) or random access memory (RandomAcces sMemory, RAM) etc..
Finally, it should be noted that above embodiments are only to illustrate the technical solution of the application, rather than its limitations;At this
It under the thinking of application, can also be combined between the technical characteristic in above embodiments or different embodiment, step can be with
It is realized with random order, and there are many other variations of the different aspect of the application as described above, for simplicity, they do not have
Have and is provided in details;Although the application is described in detail with reference to the foregoing embodiments, the ordinary skill people of this field
Member is it is understood that it is still possible to modify the technical solutions described in the foregoing embodiments, or to part of skill
Art feature is equivalently replaced;And these are modified or replaceed, each reality of the application that it does not separate the essence of the corresponding technical solution
Apply the range of a technical solution.