CN106549995B - The method, apparatus and system of information cache and push in peer-to-peer network - Google Patents

The method, apparatus and system of information cache and push in peer-to-peer network Download PDF

Info

Publication number
CN106549995B
CN106549995B CN201510603003.9A CN201510603003A CN106549995B CN 106549995 B CN106549995 B CN 106549995B CN 201510603003 A CN201510603003 A CN 201510603003A CN 106549995 B CN106549995 B CN 106549995B
Authority
CN
China
Prior art keywords
request
message
state
statement
queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510603003.9A
Other languages
Chinese (zh)
Other versions
CN106549995A (en
Inventor
吴自立
陈姝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Guangmi Huaan Technology Co Ltd
Original Assignee
Beijing Guangmi Huaan Technology Co Ltd
Filing date
Publication date
Application filed by Beijing Guangmi Huaan Technology Co Ltd filed Critical Beijing Guangmi Huaan Technology Co Ltd
Priority to CN201510603003.9A priority Critical patent/CN106549995B/en
Publication of CN106549995A publication Critical patent/CN106549995A/en
Application granted granted Critical
Publication of CN106549995B publication Critical patent/CN106549995B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The method, apparatus and system that can realize information cache and push in a peer-to-peer network are provided.Several first peer nodes generate the request for being related to information operation or listening to operation, and the transmission for specifying common key assignments and label to make requests, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier, the first peer node composition request end;Queue is listened in several second peer node storage message queues, and the content of the request according to the first peer node received, it updates stored message queue, listen to queue, reply response, push response are carried out to the first peer node, the message queue listens to queue corresponding to the specified common key assignments and label, the node that second peer node is found by peer-to-peer network by key assignments, second peer node constitute server-side.The present invention does not need configuration server, saves manpower and cost, takes full advantage of peer network resources, and prospect of the application is wide.

Description

The method, apparatus and system of information cache and push in peer-to-peer network
Technical field
The present invention relates to network communication technologies, in particular in peer-to-peer network the method, apparatus of information cache and push and System.
Background technique
In existing information advancing technique, different user on the same server into can be behind the same channel When message, state push, i.e. user message, state be sent to server, and server is again to other under same channel User pushes.The technology is the client/server structure of standard, and server-side has certain compound, needs to configure clothes It is engaged in device, the expense purchasing, safeguard etc. of server will be generated, it is also necessary to special personal management, higher cost.The technology There is also do not support message to cache.
P2P (peer-to-peer network) is each side client computer or the mode of server each other in a kind of communication network.Typical equity Network, including several nodes, each node have the function of lookup, routing etc., can directly interact with other nodes.Peer-to-peer network It is generally based on DHT (Distributed Hash Table, distributed hashtable) technology, such as Chord, CAN, Pastry etc., Carry out the node building network topology in tissue network.
In peer-to-peer network, the process of node publication resource is that the resource locally saved is specified unique rope in network Drawing --- static information (value) is published on network by key assignments (key), and finding responsible storage according to specific rule, this is quiet The node of state information, and static information is stored in publication the Resources list of the node.Node obtain resource process be by The resource locally needed indicates to search in a network and obtains resource with key assignments.When node requests a certain content, to peer-to-peer network Network initiates message, and find key value corresponding static information.The section for being responsible for storing the key assignments is routed to according to specific P2P rule Point, the node for storing the key assignments index oneself publication the Resources list and are returned to requesting node after obtaining corresponding static information.
Different from client/server structure, in peer-to-peer network, node capacity usually will not be very strong, can not be with server phase Than, therefore not can be used directly existing information advancing technique.
The first Chinese patent application 201510461312.7 of applicant is proposed based on peer-to-peer network distributed hashtable Visit protocol system and communication means.Wherein, for Visit agreement based on the peer-to-peer network for realizing distributed hashtable, this is right Specific rule employed in equal networks is kademia algorithm.Kademia algorithm can be any calculating in access network Machine finds essentially identical several target machines by specified key_id.Kademia algorithm and distributed hashtable are all public The prior art opened.
As shown in Figure 1, being in the visit protocol system based on peer-to-peer network distributed hashtable as request end or conduct The structural schematic diagram of the network node of server-side.Visit protocol system includes several network nodes, and the network node includes DHT module 10, the request module 20 being connect with DHT module 10 and/or service module 30.
Request module 20 sends the request comprising at least one access request for initiating access request, to service module 30 Packet receives the Authority Verification request packet that service module 30 is sent, and to 30 sending permission auth response packet of service module, receives service The reply response bag that module 30 is sent.
Service module 30 sends the Authority Verification request packet to request module 20, receives for receiving the request packet The Authority Verification response bag and verifying authorization, are verified the post-processing access request, and construction is replied response bag and sent To request module 20.It is described to reply the reply response that response bag includes the corresponding access request.
Preferably, service module 30 recognizes request packet progress permission using the public private key pair generated of request module 20 Card.Request module 20 generates the DHT of each network node in the visit protocol system according to the public key in the public private key pair Module 10 corresponds to the key assignments key_id of the request module 20.
Preferably, the key assignments key_id is the hashed value of the public key.
Preferably, request module 20 is also used to declare the permission of private key in the public private key pair in the request packet, Receive the public key pushed after public key is requested to service module 30 in the public private key pair.
Service module 30 is also used to check whether after receiving the statement of private key permission and possesses public key, to asking modulus if not Block 20 pushes public key request.
It preferably, include the Authority Verification information for utilizing the public key encryption in the Authority Verification request packet;
It include to be counted after the Authority Verification information is decrypted using the private key in the Authority Verification response bag Obtained permission proves information.
Preferably, the Authority Verification information is random train of the service module 30 using the public key encryption.
After the permission proves that information is decrypted the Authority Verification information using the private key for request module 20, The cryptographic Hash for the random train being calculated.
Request module 20 utilizes kademia algorithm, finds corresponding network node by specified key assignments key_id, will The request packet is sent to the service module 30 of found network node.
Service module 30 inversely sends the reply response bag according to the transmitting path of the request packet, and the reply is rung The request module 20 for being sent to and sending the request packet should be wrapped.
Preferably, the network node further includes connecting with request module 20, for handling the reply response bag Layer service logic module 40.
Preferably, request module 20 receives the reply response bag that the service module 30 of the n network node returns respectively, Response duplicate removal processing is executed by corresponding upper-layer service logic module 40 or corresponding Extended Protocol request module 50.
Preferably, the visit protocol system further includes at least one Extended Protocol request module 50, and with the extension The corresponding Extended Protocol service module 60 of agreement request module.
Extended Protocol request module 50 is connect with request module 20, calls the interface function of the request packet described Access request is added in request packet, is transferred respectively described in corresponding in the reply response bag using the call back function of the request packet The reply of access request responds, and handles the reply response.
Extended Protocol service module 60, connect with service module 40, handles the corresponding access request respectively, and Response is replied in addition in the reply response bag.
The access request includes label (tag).Tag is made of Extended Protocol name title, separator and added field, example Such as " chl.xxxx ".
Preferably, the request packet contains the packet number package_id for identifying the request packet, and the access is asked It asks containing the request number request_index for identifying the access request.The reply response bag is compiled by the packet Number package_id specifies corresponding request packet, and the reply response is specified pair by the request number request_index The access request answered.
Preferably, service module 30 further includes following any one: for sending back complex response packet to request module 20 While send push response bag;For the asking to other network nodes while sending back complex response packet to request module 20 Modulus block 20 sends push response bag;For being sent to request module 20 after sending back complex response packet to request module 20 Push response bag.
Visit agreement has following key characteristic: the access request of multiple Extended Protocols is sealed in the support of Visit agreement Packet.The form that Visit agreement can organize mass-sending is sent after request packet is specified key assignments key_id.Also it may specify target machine It directly transmits.Visit agreement can be attached to the basic information of packet, sender's letter when giving Extended Protocol to handle request/response Breath.Visit service can also be attached to whether request end has passed through the verifying for possessing key assignments key_id corresponding private key.Packet number can be used Package_id identifies Visit agreement request packet.It can be combined with packet number package_id with request number request_index Identify individual access request.
Visit agreement provides technical foundation for the realization of information cache and push technology in peer-to-peer network of the invention.
Summary of the invention
The purpose of the present invention is to provide a kind of method, apparatus that can realize information cache and push in a peer-to-peer network and System.
According to an aspect of the present invention, a kind of method of information cache and push in peer-to-peer network is provided comprising with Lower step: it request processing and response: according to the type of the request received, updates stored message queue, listen to queue, Xiang Fa Send the request end of request carry out reply response, push response, the message queue, listen to queue corresponding to a specific key assignments with One label, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier.
According to an aspect of the present invention, the device of information cache and push in a kind of peer-to-peer network is provided comprising: number According to storage unit: for storing message queue, listening to queue, the message queue listens to queue corresponding to a specific key assignments With a label, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier;Request processing and sound It answers unit: for the type according to the request received, updating stored message queue, listens to queue, to asking for transmission request End is asked to carry out reply response, push response.
According to an aspect of the present invention, a kind of method information publication in peer-to-peer network and obtained is provided comprising with Lower step: it generates request: generating the request for being related to information operation or listening to operation;It sends request: specifying common key assignments and mark Label carry out the transmission of the request of above-mentioned generation, and wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding extension of tag identifier Agreement, the permission of information operation.
According to an aspect of the present invention, device information publication in a kind of peer-to-peer network and obtained is provided comprising: it asks Seek generation unit: for generating the request for being related to information operation or listening to operation;Request transmitting unit: for specifying common key Value and label carry out the transmission of the request of above-mentioned generation, and wherein key assignments is the key that DHT is accessed in peer-to-peer network, and tag identifier is corresponding Extended Protocol.
According to an aspect of the present invention, information cache and method for pushing in a kind of peer-to-peer network are provided comprising: it is several First peer node generates the request for being related to information operation or listening to operation, and common key assignments and label is specified to make requests It sends, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier;Several second peer nodes Queue, and the type of the request according to the first peer node received are listened in storage message queue, update stored information Queue is listened in queue, carries out reply response, push response to the first peer node, the message queue is listened to queue and corresponded to The specified common key assignments and label, the node that second peer node is found by peer-to-peer network by key assignments.
According to an aspect of the present invention, information cache and supplying system in a kind of peer-to-peer network are provided comprising: it is several First peer node constitutes request end, comprising: request generation unit is related to information and operates or listen to asking for operation for generating It asks;Request transmitting unit, the transmission for specifying common key assignments and label to make requests, wherein key assignments is to visit in peer-to-peer network Ask the key of DHT, the corresponding Extended Protocol of tag identifier;Several second peer nodes, are found by peer-to-peer network by key assignments Node constitutes server-side, comprising: data storage cell, for storing message queue, listening to queue, the message queue is listened to Queue corresponds to the specified common key assignments and label;Request processing and response unit, for according to first received The type of the request of peer node updates stored message queue, listens to queue, carries out reply sound to the first peer node It answers, push response.
The beneficial effect comprise that
The method, apparatus and system of information cache and push in peer-to-peer network provided by the present invention, server-side carry out Following operation: request processing and response: according to the content of the request received, updating stored message queue, listen to queue, to The request end for sending request carries out reply response, push response.The message queue listens to queue corresponding to a specific key assignments (key_id) with a label (tag), wherein key_id is the key that DHT is accessed in peer-to-peer network, and tag identifies corresponding extension association View;
The present invention corresponds to the information (message of specific key_id and tag in server-side by message queue storage, update With state), realize the caching of message, state;Believed in server-side by the request end for listening to queue storage, more new registration is listened to Breath, accordingly in information update to the push for having registered the request end listened to and carrying out new information.It is thus achieved that peer-to-peer network The caching of middle information and push.
Relative to existing information advancing technique, technical solution of the present invention does not need configuration server, does not generate this Expense does not need special personnel to be managed yet, saves manpower.The present invention is suitable for peer-to-peer network, utilizes interconnection Online existing vast user, device resource, are the design of very economical, and take full advantage of resource, prospect of the application is wide It is wealthy.
In addition, realizing the caching and the method and system of push for supporting information the present invention is based on peer-to-peer network.So that The realization of many advanced applications is more easier (for example chat, blog, forum etc.) on peer-to-peer network.
To need caching/push data separation is message and state.It is this to distinguish so that the agreement is suitable for various differences Application scenarios.
Based on the identity authentication function that Visit agreement provides, the present invention enable the function to the access of message and state into Row control, in the access by publicity pattern, i.e., the permission of the information operation identified in label (tag), to the write-in of information with It obtains and carries out permission differentiation respectively.The design is so that each request end and server-side can reach the permission limitation of specific tag Unanimously, to make permission that also there is public credibility between strange node.
The identification information of the subsidiary message (is the request packet number of write-in message in the present invention in the response for returning to message With number of the write request in request packet).Push based on DHT framework need to multiple server-sides return response message into Row duplicate removal.The design can repeat the message returned so that receiving the request end of response by this identification information to different server-sides Data reliably carry out duplicate removal.
The temporal information of subsidiary access request is (subsidiary when being statement state in the present invention to ask in the response of the state of return Ask the end time).Push based on DHT framework needs to carry out duplicate removal to the response message that multiple server-sides return.The design so that The request end for receiving response can repeat the status data returned progress validity to different server-sides by this identification information and sentence It is disconnected.
Detailed description of the invention
Fig. 1 is in the visit protocol system based on peer-to-peer network distributed hashtable of the prior art, as request end or The structural schematic diagram of network node as server-side;
Fig. 2 is the operational flowchart of information cache and server-side in supplying system in peer-to-peer network of the present invention;
Fig. 3 is the flow chart of information cache and method for pushing in peer-to-peer network of the present invention;
Fig. 4 is the structural schematic diagram of information cache and the first peer node in supplying system in peer-to-peer network of the present invention;
Fig. 5 is the structural schematic diagram of information cache and the second peer node in supplying system in peer-to-peer network of the present invention;
Fig. 6 is the request processing and responding process of information cache and server-side in supplying system in peer-to-peer network of the present invention Figure;
Fig. 7 be in peer-to-peer network of the present invention information cache in supplying system server-side judgement request involved in operation be The no flow chart for needing permission.
Specific embodiment
The method, apparatus and system of information cache and push are assisted based on Visit in peer-to-peer network described in the present invention The expansion technique of view.It is suitable for peer-to-peer networks.
Following term is defined for convenience of explanation:
● network node: constitute the node of peer-to-peer network.With node i d mark.
● key assignments (key_id): access the key of DHT.
● a kind of DHT (distributed hashtable): algorithm of the searching node in peer-to-peer network.By specified key_id and divide Zhi Yinzin can find n node, and different nodes are almost the same using the node listing that identical key_id and n is found.It is logical It crosses kademia algorithm and has been achieved with a distributed hashtable.
● Visit agreement: the communication protocol based on DHT addressing.Visit request is sent by request end, server-side is rung It answers.
● request end: issue the functional module of Visit request.It can be present in consolidated network node with server-side.
● server-side: receiving and handles the functional module of Visit request.Consolidated network node can be present in request end In.
● Visit request packet: the Visit protocol package that request end is issued to server-side.
● Visit response bag: the Visit protocol package that server-side is issued to request end.
● hash: i.e. Hash (Hash).The hashed value of an available fixed length after one piece of data is hashed.This hair Hashing algorithm SHA256 is preferably used in bright, it is generally recognized that the algorithm is irreversible, and the hashed value obtained by different data block It will not repeat.
● access request: the access request that request end is sent to server-side.Multiple visits can be enclosed in one Visit packet Ask request.
● reply response: the corresponding reply of the access request that server-side is sent to request end.
● push response: protocol package of the server-side to request end active push.
● the object of state statement person: has been declared to server-side.There can be multiple statements according to the same request end of demand Person.
● the request end for listening to message or state listener: is had sent to server-side.
A lower channel (Channel) is re-defined herein, this is the abstract concept that the application proposes.Channel is based on one The abstract session place of the data interaction of a common key_id.Using the key_id and tag common ID in Visit agreement One channel, distinguishes each channel, mutually indepedent between each channel.Tag is used to identify some metamessages of channel, The metamessage includes the authority definition of corresponding Extended Protocol, information operation.Different request ends pass through to the same channel Access interacts, and the Visit request packet comprising access request sent in the same channel is both needed to specify this common Key_id and tag.
Data transmission in Channel is as follows: being based on kademia algorithm, the data of each channel are stored in currently Nodes id is on several nodes of key_id.Any node can send access request to Channel, be based on Visit agreement initiates the node of access request, i.e. request end, and access request can enclose to Visit request packet, and by request packet Specified key_id is sent to several nodes near key_id simultaneously, several nodes, i.e. server-side, to request packet And its interior request sealed up for safekeeping independently processing/storage, Visit response bag is sent to request end, can be enclosed in Visit response bag Reply response or push response.
According to Visit agreement, the Extended Protocol that request end can register different names to server-side is different types of to handle Access request.The Extended Protocol request module of any request end can by special interface function be passed to parameters described below come to Access request is added in request packet to construct request packet:
Tag: Extended Protocol is indicated;
Request data (request_data): access request and its related data, Visit consultation transmit request data To the Extended Protocol service module of the corresponding processing the type access request of server-side;
Reply response call back function: for handling reply response corresponding with access request;
Push response call back function: for handling push response corresponding with access request.
Send request packet: after the completion of request packet building, the specified common key_id corresponding with channel in request end is sent Request packet.
Request end can be every reply response and push response calling corresponding time after receiving the response bag from server-side Letter of transfer number, for the processing of Extended Protocol request module.
Entire request packet can be identified as and be completed in Extended Protocol request module treatment process, to avoid request packet Processing is more to reply response.
Referring to Fig.2, server-side carries out following process flow after receiving request packet according to Visit agreement:
Distribution access request: finding the corresponding processing module of the access request, i.e. Extended Protocol service module according to tag, And it is passed to thereto:
The essential information (including packet number package_id, sender, receiving time etc.) for the request that need to be responded;
Respond request body data;
Authority Verification mark;
For sending back the information creating object of complex response and push response.
Make requests processing and response, comprising:
Handle access request: Extended Protocol service module handles access request one by one.
Construct response bag: during handling access request, Extended Protocol service module can pass through incoming information Creation object adds reply response into response bag and responds with push.
It sends response bag: after the completion of server-side handles request packet, all replies response and push response being packaged respectively At response bag and send.
Refering to Fig. 3, it is shown that the process of information cache and method for pushing in peer-to-peer network of the invention, including:
Step S101, several first peer nodes generate the request for being related to information operation or listening to operation, and specified common Key_id and the transmission that makes requests of tag, wherein key_id is the key assignments that DHT is accessed in peer-to-peer network, and tag mark is corresponding Extended Protocol, first peer node constitute request end;
Step S102, several second peer nodes make requests processing and response, i.e., according to the first pair of constant pitch received The type of the request of point updates stored message queue, listens to queue, carries out reply response, push to the first peer node Response, the message queue listen to queue corresponding to the specified common key_id and tag, second peer node The node found by peer-to-peer network by key_id, second peer node constitute server-side.
The permission of the tag also identification information operation, to the operation of the information under same key_id and tag in accordance in tag The permission of mark.Second peer node, if needing corresponding permission according to tag, starts when handling request Public key acquisition process (step S103) and verifying process (step S104) with confirmation request end possess key_id corresponding private key.It is described Public key acquisition process and verifying process are that Visit agreement is supported and published content.
The present invention also provides the system of information cache in peer-to-peer network and push, including: several first pair of constant pitch Point constitutes request end;Several second peer nodes, the node found by peer-to-peer network by key_id constitute server-side.
Refering to Fig. 4, it is shown that the structure of request end.It is provided with request generation unit in Extended Protocol request module, is used for Generate the request for being related to information operation or listening to operation;Request transmitting unit, for specifying common key_id and tag to be asked The transmission asked, wherein key_id is the key assignments that DHT is accessed in peer-to-peer network, and tag identifies corresponding Extended Protocol.
Refering to Fig. 5, it is shown that the structure of server-side.It is provided with data storage cell in Extended Protocol service module, is used for Queue is listened in storage message queue, and the message queue listens to queue corresponding to the specified common key_id and tag; Request processing and response unit update stored information for the content according to the request of the first peer node received Queue is listened in queue, carries out reply response, push response to the first peer node.
According to the present invention, server-side provides two kinds of data buffer storage and Push Service, and one kind is message, and one kind is shape State.Include following data type for each tag under each key_id: message queue, status list, message listen to team Column, state listen to queue, are stored in server-side by data storage cell.Each data type is described respectively below:
● message queue.Including all not out of date message, sort according to server-side receiving time.Under including for every message State data: the packet number of request packet where the access request of the message is written;Number of the write request in request packet, that is, request Number;Message content;Server-side receives the local zone time of the message;Expired time of the message in server-side.Request packet The request number of packet number and write request together constitutes the identification information of message, can be used for request end to different server-side weights The message data returned back reliably carries out duplicate removal.
● status list.Including it is stateful be not the state of empty statement.It include following data: Shen for every bar state Bright person's mark;Additional information;The packet number of request packet where the statement status request of last time statement;Last time statement The request end time (time can be used for other request ends and carry out duplicate removal);The server-side time of last time statement;State is expired Time;The state of last time statement.
● message listens to queue.Request client information is listened to including all not out of date message.
● state listens to queue.Request client information is listened to including all not out of date states.
It includes following data: listener that message, which listens to queue, state listens to each of queue to listen to the information of request end Mark;The packet number of request packet where listener's last time listens to request;Listener's last time listens to request in request packet In number, i.e., request number;The time that listener begins listening for;Listen to the expired time;For PUSH message/condition responsive Session (session) object.
It notes, session is established by the request end for initially key_id being specified to send request, session object pair The Visit agreement request packet of the initial request should be enclosed.
Request end generates following kind of request by request generation unit, and is sent by request transmitting unit:
● write-in message: one new information of write-in.The request includes following data: message content;Message validity.
● it deletes message: deleting the message sent.The request includes following data: the access request institute of the message is written In the packet number of request packet;The request of write request is numbered.
● it reads message: reading the message cached in server-side.The request includes following data: minimum service end time.
● listen to message: registration is listened to rear server-side and can actively be pushed to request end when receiving new information.This is asked Ask comprising following data: message listens to validity period.
● statement state: the request includes following data: statement person;Additional information;State;Validity period;Request end is current Time.
● reading state: read the state declared in server-side.
● listen to state: registration is listened to rear server-side and can actively be pushed to request end in stateful variation.This is asked Ask comprising following data: state listens to validity period.
Refering to Fig. 6, after server-side receives request, the type of the request processing and response unit judgement request, and to each The request of seed type carries out different subsequent processings, and processing mode is as follows:
● after server-side receives write-in message request, which write-in message: is stored in message queue.Server-side can also incite somebody to action The message content of the message and its corresponding packet number, request are numbered, the notice of related data as server-side receiving time disappears Breath listens to all request ends of queue for storing, that is, carries out push response, and response bag is written in message relevant data and is sent to Message listens to all request ends of queue for storing.In the case where delete operation does not occur, the message is passing through message validity The complete deletion from message queue afterwards.
● it deletes message: after server-side receives deletion message request, making the following judgment and handle:
If the packet number of request packet, server-side delete all disappear where the access request of the not set write-in message of the request Breath.
If the packet number of request packet where the request is provided with the access request of write-in message, not set write request are compiled Number, then server-side deletes all message of corresponding requests packet write-in.
If the packet number and write request of request packet where the request is provided with the access request of write-in message simultaneously are numbered, Then server-side delete target message.
● it reads message: after server-side receives reading message request, returning to the sheet that server-side receives message to request end The ground time is more than or equal to all message of minimum service end time, that is, carries out reply response, and the message of all message is related Data write-in response bag is simultaneously sent to request end.
● registration message is listened to: server-side receives listen to message request after, by request end addition message listen to list.When having It is actively pushed to registered request end when new information is written.
● it removes message and listens to: validity period is listened to according to the message set in message request of listening to that server-side receives, After the message listens to validity period, which is listened in list from message and is removed by server-side.
● statement state: after server-side receives statement status request, is made the following judgment and is handled according to state:
If the state of statement is sky, and without statement person's corresponding states in original state list, then with no treatment.
If the state of statement is sky, and has statement person's corresponding states in original state list, then deleting should in original state list Statement person's corresponding states, and the state change is pushed to all request ends for having registered state and listening to, that is, push response is carried out, By the state content of the state and statement person's mark, request related data as packet number, request end time that response bag is written And it is sent to all request ends that state listens to queue for storing.
If statement state is not empty, and statement person's corresponding states is identical as statement state in original state list, then update Statement person's corresponding states data in status list.
If statement state is not empty, and statement person's corresponding states is different from statement state in original state list/be not present, Then update the new statement person's corresponding states data of the statement person's corresponding states data/creation in status list, and by the state Changing push gives all request ends for having registered state and listening to, that is, push response is carried out, by the state content of the state and statement Person's mark, request packet number, the write-in response bag of related data as the time of request end are simultaneously sent to state and listen in queue and deposit All request ends put.
● reading state: server-side receive reading state request after, to request end return status list in all items, i.e., into Row replys response, by the state content of all states and statement person's mark, requests as packet number, request end time Related data write-in response bag is simultaneously sent to request end.
● login state is listened to: server-side receives listen to status request after, by request end addition state listen to list.When having It is actively pushed to registered request end when state change.
● removal state is listened to: validity period is listened to according to the state set in status request of listening to that server-side receives, After the state listens to validity period, request end is listened in list from state and is removed by server-side.
Based on the identity authentication function that Visit agreement provides, the present invention enables the function to information --- message and shape State --- operation controlled, the write-in of information, deletion are carried out respectively with operation is obtained by disclosed tag in the access Permission is distinguished.Whether request end possesses key_id corresponding private key, and the power enjoyed is different.
It is provided with tag in Visit agreement, Extended Protocol name and added field are contained in tag.The present invention defines tag's The fixed bit of added field is set to authority mark position, for the read-write rule that data under the publicity tag are deferred to, i.e. wraps in tag Authority information is contained.
For example, authority mark position may include following 7:
● message reads private key position: reading/listen to whether message requires request end to possess key_id corresponding private key
● private key position is written in message: whether write-in message requires request end to possess key_id corresponding private key
● message deletes private key position: deleting whether message requires request end to possess key_id corresponding private key
● puncturing pattern position: being complete deletion when deleting message or only deletes message content, and reserve index information.
● state reads private key position: reading/listen to whether state requires request end to possess key_id corresponding private key
● private key position is written in state: whether statement state requires request end to possess key_id corresponding private key
● private key vetos position: whether enabling private key permission.If not enabling, any request end does not have above-mentioned private key power Limit, can not carry out the operation of relevant information, state.That is, not detecting whether request end has corresponding private key power if the position is set as 1 It limits, the operation for needing private key permission just to can be carried out specified in above-mentioned permission is illegal operation.
Operation to information in channel, the i.e. operation to information under same key_id and tag, need in accordance in tag specify Jurisdictions mandate.Such as:
1 is set to when message reads private key position, and when private key rejection position is set to 0, the request end of no private key permission can not be into Row reads message or listens to the operation of message.
It is set to 1 when message reads private key position, when private key rejection position is set to 1, any request end, which can not be read out, to disappear Cease or listen to the operation of message.
Refering to Fig. 7, according to the authority information in tag, after server-side receives request, the request processing and response unit exist After the type for judging request, judge whether operation involved in the request needs permission in advance: if not needing permission, entering Subsequent processing is handled the request of the type;Permission is such as needed, then needs whether leading checking request end possesses key_ The corresponding private key of id, possesses private key, then enters subsequent processing without private key and do not enter subsequent processing then, it is preferable that Ke Yiti Show that request end does not have the permission of the operation.
The present invention also provides a kind of computer readable medium for carrying one or more instruction sequences, when described instruction by When one or more processors execute, causes one or more of processors to execute the operation of server-side, specifically include following Step: request processing and response.It updates stored message queue, listens to queue, Xiang Fa according to the type of the request received Send the request end of request carry out reply response, push response, the message queue, listen to queue corresponding to a specific key assignments with One label, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier.Wherein, at the request The step of reason is with response is as previously described.
The present invention also provides a kind of computer readable medium for carrying one or more instruction sequences, when described instruction by When one or more processors execute, causes one or more of processors to execute the operation of request end, specifically include following Step: it generates request: generating the request for being related to information operation or listening to operation;It sends request: specifying common key assignments and label The transmission of the request of above-mentioned generation is carried out, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding extension association of tag identifier View, the permission of information operation.
Here is specific embodiments of the present invention.
Embodiment 1
One packet size be 3, key_id 10010000, tag be the message carried out on the channel of tag1 listen to -> The detailed process that message write-in -> message push -> message reading -> message is deleted:
When request end 1, which specifies key_id=10010000, tag=tag1 to send message, listens to request, according to kademia Algorithm, above-mentioned request are routed on 1,2,3 three node of node and are handled.Three nodes have just respectively constituted service End.Node 1,2,3 separately handles and listens to request: the Extended Protocol name for including by tag1 is in registered Extended Protocol Middle to find corresponding Extended Protocol service module and handled, identified Extended Protocol service module is listened in list in message Record the address of request end 1.(operation that description determines Extended Protocol service module by tag1 is omitted below, but actually Each server-side will do it the operation after receiving Visit request packet.)
Unstable due to network node, according to a kind of possible situation, node 2 is detached from network.Node 2 is detached from network and leads Node 4 is caused to enter the addressing range of kademia algorithm.
When request end 2 specifies key_id=10010000, tag=tag1 to send write-in message request, according to kademia Algorithm, above-mentioned request are routed on 1,3,4 three node of node and are handled.Node 1,3,4 separately handles write-in Request.In node 1,3, is listened to before in message and recorded the address of request end 1 in list, operation are as follows: in message queue Record the related datas such as the content of the message;The message is pushed to the address for listening to the request end 1 recorded in list.And in node 4, it is not listened in message and recorded the address of request end 1 in list, operation are as follows: the phase of the message is recorded in message queue Close data, the push without carrying out the message to request end 1.Certainly, node 4 can also listen in list its message and record Request end carries out the push of the message, only because request end 1 is not listened in list at it, because without being somebody's turn to do to request end 1 The push of message.
Later, request end 1 receives the PUSH message from node 1 and node 3, according to the identification information (request end 2 of message The request of the request packet number and write request of transmitted write-in message request is numbered), by the laggard traveling of upper layer logic duplicate removal The processing of one step.
When request end 3, which specifies key_id=10010000, tag=tag1 to send, reads message request, according to kademia Algorithm, above-mentioned request are routed on 1,3,4 three node of node and are handled.Node 1,3,4 separately handles reading Request.It is operated are as follows: all message contents recorded in message queue, which are packaged and pass through reply response, sends back request end 3. Request end 3 receives all message contents from node 1,3,4, according to the identification information (request of write-in message request of message The request of packet number and write request is numbered), by being further processed after upper layer logic duplicate removal.
When request end 4 specifies key_id=10010000, tag=tag1 to send message removal request, in request content It has been attached to the feature (packet number of request packet where the access request of the message is written of message;The request of write request is numbered). According to kademia algorithm, above-mentioned request is routed on 1,3,4 three node of node and is handled.Node 1,3,4 is independently Ground handles removal request.It is operated are as follows: feature message identical with feature in removal request is searched in message queue, if finding The message is then removed from message queue.
Illustratively, practical key_id and node i d length are very long, such as are 512 in current realization.Grouping is big It is small also can be larger.
Embodiment 2
One packet size be 3, key_id 10010000, tag be the state carried out on the channel of tag1 listen to -> State statement -> state push -> state reads -> detailed process listened to of removal state:
When request end 1 specifies key_id=10010000, tag=tag1 transmission to listen to request, calculated according to kademia Method, above-mentioned request are routed on 1,2,3 three node of node and are handled.Node 1,2,3 separately is handled to listen to and be asked It asks: listening to the address for recording request end 1 in list in state.
Unstable due to network node, according to a kind of possible situation, node 2 is detached from network.Node 2 is detached from network and leads Node 4 is caused to enter the addressing range of kademia algorithm.
When request end 2 specifies key_id=10010000, tag=tag1 to send statement status request, according to kademia Algorithm, above-mentioned request are routed on 1,3,4 three node of node and are handled.Node 1,3,4 separately handles this and asks It asks.In node 1,3, is listened to before in state and recorded the address of request end 1 in list, operation are as follows: sentenced according to state It is disconnected, as a result are as follows: statement state is not empty, and statement person's corresponding states is different from statement state in original state list.Progress after Continuous operation: statement person's corresponding states data in status list are updated, and the state change is pushed to listen in list and is recorded Request end 1.And in node 4, it had not been listened in message and had recorded the address of request end 1 in list, operation are as follows: according to state Judged, as a result are as follows: statement state is not empty, and statement person's corresponding states is different from statement state in original state list. It carries out subsequent operation: updating statement person's corresponding states data in status list.Certainly, node 4 can also listen to column to its state The request end recorded in table carries out the push of the state, only because request end 1 is not listened in list at it, because without to asking End 1 is asked to carry out the push of the state.
Request end 1 receives the push state from node 1 and node 3, according to the temporal information (request of statement status request The statement status request subsidiary request end time transmitted by end 2), by being further processed after upper layer logic duplicate removal.
Next, request end 2 specifies key_id=10010000, tag=tag1 to send reading state request.According to Kademia algorithm, above-mentioned request are routed on 1,3,4 three node of node and are handled.Node 1,3,4 is returned to request end 2 Return the data of all states in status list.Request end 2 is received to be owned in the status list that node 1,3,4 returns , temporal information (the subsidiary request of statement status request transmitted by each request end of status request is declared according to each single item Hold the time), by being further processed after upper layer logic duplicate removal.
After the state of request end 1 listens to the validity period of request, column are listened to from state in request end 1 by node 1,2,3 It is removed in table.
Embodiment 3
One packet size be 3, key_id 10010000, tag be the authentication carried out on the channel of tag1, Permission control.
Priority assignation in tag1 are as follows: message deletes private key position and is set to 1, and private key rejection position is set to 0, other positions quilt It is set to 0, that is to say, that the request end of no private key can not carry out deleting the operation of message, and whether other operations do not distinguish request end Possessing private key can carry out.After request end 1 generates public private key pair, key_id=10010000 is specified to send deleting by private key signature Except message request, according to kademia algorithm, above-mentioned request is routed on 1,2,3 three node (server-side) of node Reason.According to Visit agreement, node 1,2,3 is according to the priority assignation in tag1, it is known that deletes Message Opcode and needs checking request end Whether possess private key, public key acquisition process and verifying process can be carried out according to Visit agreement, which is cached to local It deposits, and signature is verified by public key, to confirmed that request end 1 possesses private key, there is the permission for deleting message, node 1,2,3 carry out delete message operation.Later, request end 2 specifies key_id=10010000, tag=tag1 transmission to unsign Deletion message request, since the request is unsigned, and indicate that delete operation needs to hold private key in tag, therefore the request will It is rejected, operation of the node 1,2,3 without deleting message.Hereafter, node 2 is detached from network, and node 4 enters kademia calculation The addressing range of method.Hereafter, request end 1 specifies key_id=10010000, tag=tag1 to send the deletion with private key signature and disappears Breath request.According to kademia algorithm, above-mentioned request is routed on 1,3,4 three node of node and is handled.4 basis of node Priority assignation in tag1 carries out public key acquisition process and verifying process, which is cached to local memory, and pass through public key Signature is verified, to confirmed that request end 1 possesses private key, there is the permission for deleting message, node 4 carries out deletion message Operation.Node 1,3 carries out deletion message after the public key verifications signature of local cache according to the priority assignation in tag1 Operation, that is to say, that due to local cache public key, node 1,3 do not need carry out public key acquisition process, only need to be verified Process.

Claims (22)

1. the method for information cache and push in peer-to-peer network, which is characterized in that the method is based on Visit agreement, the side Method the following steps are included:
Request processing and response: it according to the type of the request received, updates stored message queue, listen to queue, to transmission The request end of request carries out reply response, push response, and the message queue listens to queue corresponding to a specific key assignments and one Label, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier.
2. the method as described in claim 1, which is characterized in that the information is message or state, and the message queue includes Message queue and status list, listening to queue includes that message listens to queue and state listens to queue, for every under each key assignments A label stores following data:
Message queue: including all not out of date message, sorting according to receiving time, includes following data for every message: write-in The packet number of request packet where the request of the message;The request of write request is numbered;Message content;Receive the local of the message Time;The expired time of the message;
Status list: including it is stateful be not the state of empty statement, include following data for every bar state: statement person marks Know;The packet number of request packet where the statement status request of last time statement;The request end time of last time statement;Finally The local zone time once declared;State expired time;The state of last time statement;
Message listens to queue: listening to request client information including all not out of date message;
State listens to queue: request client information is listened to including all not out of date states,
It includes following data that message, which listens to queue, state listens to each of queue to listen to the information of request end: listener's mark; The packet number of request packet where listener's last time listens to request;Listener's last time listens to the request number of request;It detects The time that hearer begins listening for;Listen to the expired time;For PUSH message/condition responsive session object.
3. method according to claim 2, which is characterized in that the request is handled includes: with the step of response
Judge the type of request;
Subsequent processing is handled various types of requests as follows respectively:
Write-in message: after receiving write-in message request, which is stored in message queue, which is listened into team All request ends stored in column, in the case where delete operation does not occur by the message after message validity from message Complete deletion in queue;
It deletes message: after receiving deletion message request, being handled as follows: if the request institute of the not set write-in message of the request In the packet number of request packet, then all message are deleted;If the packet of request packet is compiled where the request is provided with the request of write-in message Number, not set write request number then deletes all message of corresponding requests packet write-in;Disappear if the request is provided with write-in simultaneously The packet number and write request of request packet where the request of breath are numbered, then delete target message;
It reads message: after receiving reading message request, the local zone time for receiving message is returned to request end more than or equal to most All message of small time;
Registration message is listened to: after receiving and listening to message request, request end addition message being listened to list, when there is new information write-in When actively to registered request end push;
It removes message to listen to: validity period being listened to according to the message set in message request of listening to received, is passing through the message After listening to validity period, which is listened in list from message and is removed;
Statement state: it after receiving statement status request, is made the following judgment and is handled according to state: if the state of statement is Sky, and without statement person's corresponding states in original state list, then with no treatment;If the state of statement is empty, and original state There is statement person's corresponding states in list, then deletes statement person's corresponding states in original state list, and the state change is pushed away Give all request ends for having registered state and listening to;If the state of statement is not empty, and the statement person is corresponding in original state list State is identical as statement state, then updates statement person's corresponding states data in status list;If the state of statement is not empty, and Statement person's corresponding states is different from statement state in original state list/it is not present, then update statement person couple in status list The statement person's corresponding states data for answering status data/creation new, and the state change is pushed to all states that have registered and is detectd The request end listened;
Reading state: after receiving reading state request, it is stateful that institute in status list is returned to request end;
Login state is listened to: after receiving and listening to status request, request end addition state being listened to list, when stateful variation Actively pushed to registered request end;
Removal state is listened to: being listened to validity period according to the state set in status request of listening to received, is being passed through the state After listening to validity period, request end is listened in list from state and is removed,
Wherein, the request that the request packet number and write request of message are incidentally written to the message that request end is sent is numbered, to asking The request end time when state qualification state for asking end to send.
4. method as claimed in claim 3, which is characterized in that the permission of the label also identification information operation, to same key The operation of information under value and label is in accordance with the permission identified in label, after carrying out judging the type step of request, according to Label judges whether operation involved in the request needs permission:
If not needing permission, enter subsequent processing;
If desired permission then starting public key acquisition process and verifies process with checking request end whether to possess key assignments corresponding in advance Private key possesses private key, then enters subsequent processing without private key and do not enter subsequent processing then.
5. the device of information cache and push in peer-to-peer network, which is characterized in that described device is based on Visit agreement and carries out message Caching and push, described device include:
Data storage cell: for storing message queue, listening to queue, the message queue listens to queue corresponding to specific One key assignments and a label, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier;
Request processing and response unit: it for the type according to the request received, updates stored message queue, listen to team Column carry out reply response, push response to the request end for sending request.
6. device as claimed in claim 5, which is characterized in that the information is message or state, and the message queue includes Message queue and status list, listening to queue includes that message listens to queue and state listens to queue, for every under each key assignments A label, data storage cell store following data:
Message queue: including all not out of date message, sorting according to receiving time, includes following data for every message: write-in The packet number of request packet where the request of the message;Number of the write request in request packet;Message content;Receive the message Local zone time;The expired time of the message;
Status list: including it is stateful be not the state of empty statement, include following data for every bar state: statement person marks Know;The packet number of request packet where the statement status request of last time statement;The request end time of last time statement;Finally The local zone time once declared;State expired time;The state of last time statement;
Message listens to queue: listening to request client information including all not out of date message;
State listens to queue: request client information is listened to including all not out of date states,
It includes following data that message, which listens to queue, state listens to each of queue to listen to the information of request end: listener's mark; The packet number of request packet where listener's last time listens to request;Listener's last time listens to the request number of request;It detects The time that hearer begins listening for;Listen to the expired time;For PUSH message/condition responsive session object.
7. device as claimed in claim 6, which is characterized in that the request, which is handled with response unit, includes:
Request type judging unit judges the type of request;
Subsequent processing units comprising the following processing unit that various types of requests are handled:
Message writing unit: for which being stored in message queue, which is disappeared after receiving write-in message request Breath listens to all request ends of queue for storing, and the message is being passed through message validity in the case where delete operation does not occur The complete deletion from message queue afterwards;
Message deletes unit: for being handled as follows: if the not set write-in message of the request after receiving deletion message request Request where request packet packet number, then delete all message;If the request is provided with request where the request of write-in message The packet number of packet, not set write request number, then delete all message of corresponding requests packet write-in;If the request is arranged simultaneously The packet number and write request of request packet where the request of write-in message are numbered, then delete target message;
Message reading unit: the local zone time for receiving message to request end return after receiving reading message request is big In all message for being equal to minimum time;
Message listens to registering unit: new when having for after receiving and listening to message request, request end addition message to be listened to list It is actively pushed to registered request end when message is written;
Message listens to removal unit: for listening to validity period according to the message set in message request of listening to received, passing through It crosses after the message listens to validity period, which is listened in list from message and is removed;
State declares unit: for being made the following judgment and being handled according to state after receiving statement status request: if statement State is sky, and without statement person's corresponding states in original state list, then with no treatment;If the state of statement is sky, and There is statement person's corresponding states in original state list, then delete statement person's corresponding states in original state list, and by the state Changing push gives all request ends for having registered state and listening to;If the state of statement is not empty, and statement in original state list Person's corresponding states is identical as statement state, then updates statement person's corresponding states data in status list;If the state of statement is not For sky, and statement person's corresponding states is different from statement state in original state list/be not present, then update the Shen in status list The new statement person's corresponding states data of bright person's corresponding states data/creation, and the state change is pushed to all have registered The request end that state is listened to;
State reading unit: for it is stateful to return to institute in status list to request end after receiving reading state request;
State listens to registering unit: for after receiving and listening to status request, request end addition state to be listened to list, when there is shape It is actively pushed to registered request end when state changes;
State listens to removal unit: for listening to validity period according to the state set in status request of listening to received, passing through It crosses after the state listens to validity period, request end is listened in list from state and is removed,
Wherein, the request that the request packet number and write request of message are incidentally written to the message that request end is sent is numbered, to asking The request end time when state qualification state for asking end to send.
8. device as claimed in claim 7, which is characterized in that the permission of the label also identification information operation, to same key The operation of information under value and label further includes that permission is sentenced with response unit in accordance with the permission identified in label, the request processing Disconnected unit, the request type for being judged according to label to request type judging unit judge, request institute to determine Whether the operation being related to needs permission:
If not needing permission, enters subsequent processing units and handled;
Whether if desired permission then possesses the corresponding private key of key assignments by public key acquisition and authentication unit checking request end in advance, Possess private key, then enters subsequent processing units and handled, without private key, then do not enter subsequent processing units.
9. method information publication in peer-to-peer network and obtained, which is characterized in that the method is based on Visit agreement, the side Method the following steps are included:
It generates request: generating the request for being related to information operation or listening to operation;
It sends request: common key assignments and label being specified to carry out the transmission of the request of above-mentioned generation, wherein key assignments is peer-to-peer network The key of middle access DHT, the permission that the corresponding Extended Protocol of tag identifier, information operate.
10. method as claimed in claim 9, which is characterized in that the request is with one of Types Below:
Message request is written, includes following data: message content;Message validity;
Message request is deleted, includes following data: the packet number of request packet where the request of the message is written;Write request is asked Seek number;
Message request is read, includes following data: minimum time;
Message request is listened to, include following data: message listens to validity period;
Status request is declared, includes following data: statement person;State;Validity period;Request end current time;
Reading state request;
Status request is listened to, include following data: state listens to validity period.
11. device information publication in peer-to-peer network and obtained, which is characterized in that described device is based on Visit agreement and carries out letter Breath publication and acquisition, described device include:
Request generation unit: for generating the request for being related to information operation or listening to operation;
Request transmitting unit: for specify common key assignments and label carry out above-mentioned generation request transmission, wherein key assignments be The key of DHT, the permission that the corresponding Extended Protocol of tag identifier, information operate are accessed in peer-to-peer network.
12. device as claimed in claim 11, which is characterized in that the request generation unit generate following request wherein it One:
Message request is written, includes following data: message content;Message validity;
Message request is deleted, includes following data: the packet number of request packet where the request of the message is written;Write request is being asked Seek the number in packet;
Message request is read, includes following data: minimum time;
Message request is listened to, include following data: message listens to validity period;
Status request is declared, includes following data: statement person;State;Validity period;Request end current time;
Reading state request;
Status request is listened to, include following data: state listens to validity period.
13. information cache and method for pushing in peer-to-peer network, which is characterized in that the method is based on Visit agreement, the method Include:
Several first peer nodes generate the request for being related to information operation or listening to operation, and specify common key assignments and label into The transmission of row request, wherein key assignments is the key that DHT is accessed in peer-to-peer network, the corresponding Extended Protocol of tag identifier;
Queue is listened in several second peer node storage message queues, and according to the request of the first peer node received Type updates stored message queue, listens to queue, carries out reply response, push response, the letter to the first peer node Breath queue listens to queue corresponding to the specified common key assignments and label, and second peer node is logical for peer-to-peer network Cross the node that key assignments is found.
14. method as claimed in claim 13, which is characterized in that the information is message or state, the message queue packet Message queue and status list are included, listening to queue includes that message listens to queue and state listens to queue, under each key assignments Each label, second peer node store following data:
Message queue: including all not out of date message, sorting according to receiving time, includes following data for every message: write-in The packet number of request packet where the request of the message;The request of write request is numbered;Message content;Receive the local of the message Time;The expired time of the message;
Status list: including it is stateful be not the state of empty statement, include following data for every bar state: statement person marks Know;The packet number of request packet where the statement status request of last time statement;The request end time of last time statement;Finally The local zone time once declared;State expired time;The state of last time statement;
Message listens to queue: listening to request client information including all not out of date message;
State listens to queue: request client information is listened to including all not out of date states,
It includes following data that message, which listens to queue, state listens to each of queue to listen to the information of request end: listener's mark; The packet number of request packet where listener's last time listens to request;Listener's last time listens to the request number of request;It detects The time that hearer begins listening for;Listen to the expired time;For PUSH message/condition responsive session object.
15. method as claimed in claim 14, which is characterized in that the request is one of following request:
Message request is written, includes following data: message content;Message validity;
Message request is deleted, includes following data: the packet number of request packet where the request of the message is written;Write request is being asked Seek the number in packet;
Message request is read, includes following data: minimum time;
Message request is listened to, include following data: message listens to validity period;
Status request is declared, includes following data: statement person;State;Validity period;Request end current time;
Reading state request;
Status request is listened to, include following data: state listens to validity period.
16. method as claimed in claim 15, which is characterized in that after second peer node receives request, judge to request Type carry out following subsequent processing respectively and according to the type of the request received:
Write-in message: after receiving write-in message request, which is stored in message queue, which is listened into team All request ends stored in column, in the case where delete operation does not occur the message after message validity from message team Complete deletion in column;
It deletes message: after receiving deletion message request, being handled as follows: if the request institute of the not set write-in message of the request In the packet number of request packet, then all message are deleted;If the packet of request packet is compiled where the request is provided with the request of write-in message Number, number of the not set write request in request packet then deletes all message of corresponding requests packet write-in;If the request is simultaneously Number of the packet number and write request of request packet in request packet where request provided with write-in message, then delete target disappears Breath;
It reads message: after receiving reading message request, the local zone time for receiving message is returned to request end more than or equal to most All message of small time;
Registration message is listened to: after receiving and listening to message request, request end addition message being listened to list, when there is new information write-in When actively to registered request end push;
It removes message to listen to: validity period being listened to according to the message set in message request of listening to received, is passing through the message After listening to validity period, which is listened in list from message and is removed;
Statement state: it after receiving statement status request, is made the following judgment and is handled according to state: if the state of statement is Sky, and without statement person's corresponding states in original state list, then with no treatment;If the state of statement is empty, and original state There is statement person's corresponding states in list, then deletes statement person's corresponding states in original state list, and the state change is pushed away Give all request ends for having registered state and listening to;If the state of statement is not empty, and the statement person is corresponding in original state list State is identical as statement state, then updates statement person's corresponding states data in status list;If the state of statement is not empty, and Statement person's corresponding states is different from statement state in original state list/it is not present, then update statement person couple in status list The statement person's corresponding states data for answering status data/creation new, and the state change is pushed to all states that have registered and is detectd The request end listened;
Reading state: after receiving reading state request, it is stateful that institute in status list is returned to request end;
Login state is listened to: after receiving and listening to status request, request end addition state being listened to list, when stateful variation Actively pushed to registered request end;
Removal state is listened to: being listened to validity period according to the state set in status request of listening to received, is being passed through the state After listening to validity period, request end is listened in list from state and is removed,
Wherein, the request that the request packet number and write request of message are incidentally written to the message that request end is sent is numbered, to asking The request end time when state qualification state for asking end to send.
17. the method described in claim 16, which is characterized in that the permission of the label also identification information operation, to same The operation of information under key assignments and label is carrying out judging request in accordance with the permission identified in label, second peer node After type step, according to label judge the request involved in operate whether need permission:
If not needing permission, enter subsequent processing;
If desired permission needs to start in advance public key acquisition process and verifying process then with checking request end and whether possesses key-value pair The private key answered possesses private key, then enters subsequent processing without private key and do not enter subsequent processing then.
18. information cache and supplying system in peer-to-peer network, which is characterized in that the system is based on Visit agreement, the system Include:
Several first peer nodes constitute request end, comprising:
Generation unit is requested, for generating the request for being related to information operation or listening to operation;
Request transmitting unit, the transmission for specifying common key assignments and label to make requests, wherein key assignments is in peer-to-peer network Access the key of DHT, the corresponding Extended Protocol of tag identifier;
Several second peer nodes, the node found by peer-to-peer network by key assignments constitute server-side, comprising:
Data storage cell, for storing message queue, listening to queue, the message queue listens to queue corresponding to the finger Fixed common key assignments and label;
Request processing and response unit are updated and are stored for the type according to the request of the first peer node received Queue is listened in message queue, carries out reply response, push response to the first peer node.
19. system as claimed in claim 18, which is characterized in that the information is message or state, the message queue packet Message queue and status list are included, listening to queue includes that message listens to queue and state listens to queue, under each key assignments Each label, the data storage cell store following data:
Message queue: including all not out of date message, sorting according to receiving time, includes following data for every message: write-in The packet number of request packet where the request of the message;The request of write request is numbered;Message content;Receive the local of the message Time;The expired time of the message;
Status list: including it is stateful be not the state of empty statement, include following data for every bar state: statement person marks Know;The packet number of request packet where the statement status request of last time statement;The request end time of last time statement;Finally The local zone time once declared;State expired time;The state of last time statement;
Message listens to queue: listening to request client information including all not out of date message;
State listens to queue: request client information is listened to including all not out of date states,
It includes following data that message, which listens to queue, state listens to each of queue to listen to the information of request end: listener's mark; The packet number of request packet where listener's last time listens to request;Listener's last time listens to the request number of request;It detects The time that hearer begins listening for;Listen to the expired time;For PUSH message/condition responsive session object.
20. system as claimed in claim 19, which is characterized in that the request generation unit generate following request wherein it One:
Message request is written, includes following data: message content;Message validity;
Message request is deleted, includes following data: the packet number of request packet where the request of the message is written;Write request is being asked Seek the number in packet;
Message request is read, includes following data: minimum time;
Message request is listened to, include following data: message listens to validity period;
Status request is declared, includes following data: statement person;State;Validity period;Request end current time;
Reading state request;
Status request is listened to, include following data: state listens to validity period.
21. system as claimed in claim 20, which is characterized in that the request, which is handled with response unit, includes:
Request type judging unit judges the type of request;
Subsequent processing units comprising the following processing unit that various types of requests are handled:
Message writing unit: for which being stored in message queue, which is disappeared after receiving write-in message request Breath listens to all request ends of queue for storing, and the message is being passed through message validity in the case where delete operation does not occur The complete deletion from message queue afterwards;
Message deletes unit: for being handled as follows: if the not set write-in message of the request after receiving deletion message request Request where request packet packet number, then delete all message;If the request is provided with request where the request of write-in message The packet number of packet, not set write request number, then delete all message of corresponding requests packet write-in;If the request is arranged simultaneously The packet number and write request of request packet where the request of write-in message are numbered, then delete target message;
Message reading unit: the local zone time for receiving message to request end return after receiving reading message request is big In all message for being equal to minimum time;
Message listens to registering unit: new when having for after receiving and listening to message request, request end addition message to be listened to list It is actively pushed to registered request end when message is written;
Message listens to removal unit: for listening to validity period according to the message set in message request of listening to received, passing through It crosses after the message listens to validity period, which is listened in list from message and is removed;
State declares unit: for being made the following judgment and being handled according to state after receiving statement status request: if statement State is sky, and without statement person's corresponding states in original state list, then with no treatment;If the state of statement is sky, and There is statement person's corresponding states in original state list, then delete statement person's corresponding states in original state list, and by the state Changing push gives all request ends for having registered state and listening to;If the state of statement is not empty, and statement in original state list Person's corresponding states is identical as statement state, then updates statement person's corresponding states data in status list;If the state of statement is not For sky, and statement person's corresponding states is different from statement state in original state list/be not present, then update the Shen in status list The new statement person's corresponding states data of bright person's corresponding states data/creation, and the state change is pushed to all have registered The request end that state is listened to;
State reading unit: for it is stateful to return to institute in status list to request end after receiving reading state request;
State listens to registering unit: for after receiving and listening to status request, request end addition state to be listened to list, when there is shape It is actively pushed to registered request end when state changes;
State listens to removal unit: for listening to validity period according to the state set in status request of listening to received, passing through It crosses after the state listens to validity period, request end is listened in list from state and is removed,
Wherein, the request that the request packet number and write request of message are incidentally written to the message that request end is sent is numbered, to asking The request end time when state qualification state for asking end to send.
22. system as claimed in claim 21, which is characterized in that the permission of the label also identification information operation, to same In accordance with the permission identified in label, the request processing and response unit further include permission for the operation of information under key assignments and label Judging unit, the request type for being judged according to label to request type judging unit judge, to determine request Whether related operation needs permission:
If not needing permission, enters subsequent processing units and handled;
Whether if desired permission then possesses the corresponding private key of key assignments by public key acquisition and authentication unit checking request end in advance, Possess private key, then enters subsequent processing units and handled, without private key, then do not enter subsequent processing units.
CN201510603003.9A 2015-09-21 The method, apparatus and system of information cache and push in peer-to-peer network Active CN106549995B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510603003.9A CN106549995B (en) 2015-09-21 The method, apparatus and system of information cache and push in peer-to-peer network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510603003.9A CN106549995B (en) 2015-09-21 The method, apparatus and system of information cache and push in peer-to-peer network

Publications (2)

Publication Number Publication Date
CN106549995A CN106549995A (en) 2017-03-29
CN106549995B true CN106549995B (en) 2019-07-16

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286920A (en) * 2008-05-15 2008-10-15 华中科技大学 Expandable resource lookup method in peer-to-peer network with structure
CN104301356A (en) * 2013-07-19 2015-01-21 中国移动通信集团公司 Data transmission method and system of P2P network

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286920A (en) * 2008-05-15 2008-10-15 华中科技大学 Expandable resource lookup method in peer-to-peer network with structure
CN104301356A (en) * 2013-07-19 2015-01-21 中国移动通信集团公司 Data transmission method and system of P2P network

Similar Documents

Publication Publication Date Title
CN104735164B (en) A kind of method and apparatus of save file information
CN113094396B (en) Data processing method, device, equipment and medium based on node memory
CN100484125C (en) Answering method to address inquire and appts. thereof
TW202101439A (en) Method and device for sending authenticable message across chain
US10990704B2 (en) Management of cryptographic transactions
KR101986081B1 (en) Method for sharing and verifing a block between specific nodes in a blockchain
CN106664298A (en) Representational state transfer operations using information centric networking
CN104714965B (en) Static resource De-weight method, static resource management method and device
CN113972986A (en) Block chain-based industrial internet identification information analysis method and related device
CN107251528A (en) It is used as the network identity of service
CN104468579B (en) Suitable for the Verification System of distributed storage
CN105868231A (en) Cache data updating method and device
CN101771537A (en) Processing method and certificating method for distribution type certificating system and certificates of certification thereof
CN105956143B (en) Data bank access method and database broker node
CN102035815A (en) Data acquisition method, access node and data acquisition system
CN109769249B (en) Authentication method, system and device
CN113507475A (en) Cross-domain access method and device
JP5447722B1 (en) Information processing system and program
Le et al. TrustedChain: A blockchain-based data sharing scheme for supply chain
JP5678893B2 (en) Attribute information linkage providing system, access information management device, access information proxy management device, method, and program
CN106921648A (en) Date storage method, application server and remote storage server
CN111556148B (en) Data sharing method, data sharing platform and device
WO2023221719A1 (en) Data processing method and apparatus, computer device, and readable storage medium
CN106549995B (en) The method, apparatus and system of information cache and push in peer-to-peer network
CN109617787A (en) For the message method of sending and receiving of block chain network, storage medium, calculate equipment

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant