public class StorageRPC extends ReplyHandler
Constructor and Description |
---|
StorageRPC(PeerBean peerBean,
ConnectionBean connectionBean) |
Modifier and Type | Method and Description |
---|---|
FutureResponse |
add(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
Collection<Data> dataSet,
boolean protectDomain,
boolean signMessage,
boolean list,
ChannelCreator channelCreator,
boolean forceUDP,
SenderCacheStrategy senderCacheStrategy)
Adds data on a remote peer.
|
FutureResponse |
compareAndPut(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
Map<Number160,HashData> hashDataMap,
FutureSuccessEvaluator futureSuccessEvaluator,
boolean protectDomain,
boolean protectEntry,
boolean signMessage,
boolean partialPut,
ChannelCreator channelCreator,
boolean forceUDP)
Compares and puts data on a peer.
|
FutureResponse |
get(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
Collection<Number160> contentKeys,
SimpleBloomFilter<Number160> keyBloomFilter,
SimpleBloomFilter<Number160> contentBloomFilter,
boolean signMessage,
boolean digest,
boolean returnBloomFilter,
boolean range,
ChannelCreator channelCreator,
boolean forceUDP)
Get the data from a remote peer.
|
PeerAddress |
getPeerAddress() |
Message |
handleResponse(Message message,
boolean sign)
If the message is OK, that has been previously checked by the user using
checkMessage, a reply to the message is generated here.
|
FutureResponse |
put(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
Map<Number160,Data> dataMap,
boolean protectDomain,
boolean protectEntry,
boolean signMessage,
ChannelCreator channelCreator,
boolean forceUDP,
SenderCacheStrategy senderCacheStrategy)
Stores data on a remote peer.
|
FutureResponse |
putIfAbsent(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
Map<Number160,Data> dataMap,
boolean protectDomain,
boolean protectEntry,
boolean signMessage,
ChannelCreator channelCreator,
boolean forceUDP,
SenderCacheStrategy senderCacheStrategy)
Stores data on a remote peer.
|
FutureResponse |
remove(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
Collection<Number160> contentKeys,
boolean sendBackResults,
boolean signMessage,
ChannelCreator channelCreator,
boolean forceUDP)
Removes data from a peer.
|
createMessage, createResponseMessage, exceptionCaught, forwardMessage, getConnectionBean, getPeerBean, registerIoHandler, setSignReply
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, handleDownstream, handleUpstream, messageReceived, setInterestOpsRequested, unbindRequested, writeComplete, writeRequested
public StorageRPC(PeerBean peerBean, ConnectionBean connectionBean)
public PeerAddress getPeerAddress()
public FutureResponse put(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Map<Number160,Data> dataMap, boolean protectDomain, boolean protectEntry, boolean signMessage, ChannelCreator channelCreator, boolean forceUDP, SenderCacheStrategy senderCacheStrategy)
remotePeer
- The remote peer to store the datalocationKey
- The location of the datadomainKey
- The domain of the datadataMap
- The map with the content key and dataprotectDomain
- Set to true if the domain should be set to protected. This
means that this domain is flagged an a public key is stored
for this entry. An update or removal can only be made with the
matching private key.protectEntry
- Set to true if the entry should be set to protected. This
means that this domain is flagged an a public key is stored
for this entry. An update or removal can only be made with the
matching private key.signMessage
- Set to true if the message should be signed. For protecting an
entry, this needs to be set to true.channelCreator
- The channel creatorforceUDP
- Set to true if the communication should be UDP, default is TCPpublic FutureResponse putIfAbsent(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Map<Number160,Data> dataMap, boolean protectDomain, boolean protectEntry, boolean signMessage, ChannelCreator channelCreator, boolean forceUDP, SenderCacheStrategy senderCacheStrategy)
remotePeer
- The remote peer to store the datalocationKey
- The location of the datadomainKey
- The domain of the datadataMap
- The map with the content key and dataprotectDomain
- Set to true if the domain should be set to protected. This
means that this domain is flagged an a public key is stored
for this entry. An update or removal can only be made with the
matching private key.protectEntry
- Set to true if the entry should be set to protected. This
means that this domain is flagged an a public key is stored
for this entry. An update or removal can only be made with the
matching private key.signMessage
- Set to true if the message should be signed. For protecting an
entry, this needs to be set to true.channelCreator
- The channel creatorforceUDP
- Set to true if the communication should be UDP, default is TCPpublic FutureResponse compareAndPut(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Map<Number160,HashData> hashDataMap, FutureSuccessEvaluator futureSuccessEvaluator, boolean protectDomain, boolean protectEntry, boolean signMessage, boolean partialPut, ChannelCreator channelCreator, boolean forceUDP)
remotePeer
- The remote peer to store the datalocationKey
- The location keydomainKey
- The domain keyhashDataMap
- The map with the data and the hashes to compare tofutureSuccessEvaluator
- The evaluator that determines if a future was a success.protectDomain
- Protect the domainprotectEntry
- Protect the entrysignMessage
- Set to true if the message should be signed. For protecting an
entry, this needs to be set to true.partialPut
- Set to true if partial puts should be allowed. If set to
false, then the complete map must match the hash, otherwise it
wont be stored.channelCreator
- The channel creatorforceUDP
- Set to true if the communication should be UDP, default is TCPpublic FutureResponse add(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Collection<Data> dataSet, boolean protectDomain, boolean signMessage, boolean list, ChannelCreator channelCreator, boolean forceUDP, SenderCacheStrategy senderCacheStrategy)
#put(PeerAddress, Number160, Number160, Map, Type, boolean, ChannelCreator, boolean)
and
#putIfAbsent(PeerAddress, Number160, Number160, Map, boolean, boolean, boolean, ChannelCreator, boolean)
is that it will convert the data collection to map. The key for the map
will be the SHA-1 hash of the data. This is an RPC.remotePeer
- The remote peer to store the datalocationKey
- The location keydomainKey
- The domain keydataSet
- The set with data. This will be converted to a map. The key
for the map is the SHA-1 of the data.protectDomain
- Set to true if the domain should be set to protected. This
means that this domain is flagged an a public key is stored
for this entry. An update or removal can only be made with the
matching private key.signMessage
- Set to true if the message should be signed. For protecting an
entry, this needs to be set to true.channelCreator
- The channel creatorforceUDP
- Set to true if the communication should be UDP, default is TCPpublic FutureResponse get(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Collection<Number160> contentKeys, SimpleBloomFilter<Number160> keyBloomFilter, SimpleBloomFilter<Number160> contentBloomFilter, boolean signMessage, boolean digest, boolean returnBloomFilter, boolean range, ChannelCreator channelCreator, boolean forceUDP)
remotePeer
- The remote peer to send this requestlocationKey
- The location keydomainKey
- The domain keycontentKeys
- The content keys or null if requested allsignMessage
- Adds a public key and signs the messagedigest
- Returns a list of hashes of the data stored on this peerchannelCreator
- The channel creator that creates connections. Typically we
need one connection here.forceUDP
- Set to true if the communication should be UDP, default is TCPpublic FutureResponse remove(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Collection<Number160> contentKeys, boolean sendBackResults, boolean signMessage, ChannelCreator channelCreator, boolean forceUDP)
remotePeer
- The remote peer to send this requestlocationKey
- The location keydomainKey
- The domain keycontentKeys
- The content keys or null if requested allsendBackResults
- Set to true if the removed data should be sent backsignMessage
- Adds a public key and signs the message. For protected entry
and domains, this needs to be provided.channelCreator
- The channel creator that creates connectionsforceUDP
- Set to true if the communication should be UDP, default is TCPpublic Message handleResponse(Message message, boolean sign) throws IOException
ReplyHandler
handleResponse
in class ReplyHandler
message
- Request messageIOException
Copyright © 2013. All Rights Reserved.