パッケージ org.piax.gtrans.ov.sg
クラス SkipGraph<E extends Endpoint>
- すべての実装されたインタフェース:
SkipGraphIf<E>,RPCIf
public class SkipGraph<E extends Endpoint> extends RPCInvoker<SkipGraphIf<E>,E> implements SkipGraphIf<E>
Skip graphクラス.Skip graphに参加する単一物理ピアに対応する.
複数のキーを登録できるが,メンバシップベクタは複数のキーで共通である.
-
ネストされたクラスの概要
ネストされたクラス 修飾子とタイプ クラス 説明 static classSkipGraph.BestLinkA class used for passing a link to the closest node.static classSkipGraph.ExecQueryReturnan execQuery return value used by (non-scalable) range queriesstatic classSkipGraph.LvStateA state for each level of a skip graph.static classSkipGraph.RightNodeMismatchstatic classSkipGraph.SGNodeInfoThis is a class used as a return type for SkipGraph#getSGNodeInfo -
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static intDDLL_CHECK_PERIOD_L0DDLL's left node check period for level 0 (msec)static intDDLL_CHECK_PERIOD_L1DDLL's left node check period for level 1 and above (msec)static TransportIdDEFAULT_TRANSPORT_IDstatic intFIND_INSERT_POINT_TIMEOUTtimeout forfind(Endpoint, DdllKey, boolean)static intQID_EXPIRATION_TASK_PERIODperiod for executing a task for purging stale QueryIDsstatic intQID_EXPIREexpiration time for purging stale QueryIDsstatic StringQUERY_INSERT_POINT_SPECIALused as the query string for finding insert points.static intRPC_TIMEOUTstatic intRQ_EXPIRATION_GRACEadditional grace time before removing RQReturn in intermediate nodesstatic intRQ_FLUSH_PERIODthe period for flushing partial results in intermediate nodesstatic intRQ_NRECENTRange Queryでトラバース中に通信エラーが起きた場合に戻れるノード数static intRQ_RETRANS_PERIODrange query retransmission periodクラスから継承されたフィールド org.piax.gtrans.RPCInvoker
channelPool, isActive, objId, POOL_CHANNEL, POOL_CHANNEL_SIZE, trans, transId, USE_CHANNEL_FOR_ONEWAY -
コンストラクタの概要
コンストラクタ コンストラクタ 説明 SkipGraph(TransportId transId, ChannelTransport<E> trans, SGExecQueryCallback execQueryCallback)SkipGraph(ChannelTransport<E> trans, SGExecQueryCallback execQueryCallback)create a SkipGraph instance. -
メソッドの概要
修飾子とタイプ メソッド 説明 voidackReceived(int msgId)booleanaddKey(E introducer, Comparable<?> rawkey)add a key to the skip graph.booleanaddKey(Comparable<?> rawkey)add a key to the skip graph.voidfin()Node.InsertPointfind(E introducer, DdllKey key, boolean accurate)find a location to insert `key'.SkipGraph.BestLinkfindClosestLocal(DdllKey key, boolean accurate)推奨されていません。Node.InsertPointfindOld(E introducer, DdllKey key, boolean accurate)推奨されていません。voidfixAndPropagateSingle(Comparable<?> target, Link failedLink, Collection<Link> failedLinks, DdllKey rLimit)List<RemoteValue<?>>forwardQuery(boolean isPlusDir, Range<?> range, int maxNum, Object query)指定されたkeyとNavigableCondの条件を満たすキーを持つピア(最大num個)にクエリを転送し、 得られた結果(リスト)を返す。List<RemoteValue<?>>forwardQuery(Collection<? extends Range<?>> ranges, Object query)指定された複数の範囲にクエリを転送し、得られた結果(リスト)を返す。intgetHeight()経路表の高さを返す.Link[]getLocalLinks()PeerIdgetPeerId()get PeerIdSGNode<E>getSGNode(Comparable<?> rawkey)get SGNode instance (for debugging only)SkipGraph.SGNodeInfogetSGNodeInfo(Comparable<?> target, int level, MembershipVector mv, int nTraversed)SkipGraph.ExecQueryReturninvokeExecQuery(Comparable<?> rawkey, Link curRight, org.piax.gtrans.ov.sg.SkipGraph.QueryId qid, boolean doAction, Object query)Range Query実行時にRPCで呼び出されるメソッド.booleanremoveKey(Comparable<?> rawkey)remove a key from the skip graph.voidreplyMsgReceived(SGMessagingFramework.SGReplyMessage<E> sgReplyMessage)voidrequestMsgReceived(SGMessagingFramework.SGRequestMessage<E> sgMessage)one-way RPCsFutureQueue<?>scalableRangeQuery(Collection<? extends Range<?>> ranges, Object query, TransOptions opts)Perform a range query.StringshowTable()get a the routing table in plain text format.StringtoString()StringtoStringShort()クラスから継承されたメソッド org.piax.gtrans.RPCInvoker
changeRPCTimeout, changeTransport, checkActive, createObjId, getEndpoint, getRPCObject, getSrcPeerId, getStub, getStub, getStub, getStub, getStub, getStub, getStub, getStub, getStub, getStub, getTransport, invokeInReceive, isOnline, newMethodCall, offline, online, rcall, rcall, rcall, rcall, rcall, rcall, rcall, rcall, receiveOneway, receiveSync, registerRPCObject, sendInvoke, sendOnewayInvoke, unregisterRPCObject
-
フィールド詳細
-
DEFAULT_TRANSPORT_ID
-
DDLL_CHECK_PERIOD_L0
public static int DDLL_CHECK_PERIOD_L0DDLL's left node check period for level 0 (msec) -
DDLL_CHECK_PERIOD_L1
public static int DDLL_CHECK_PERIOD_L1DDLL's left node check period for level 1 and above (msec) -
RQ_NRECENT
public static int RQ_NRECENTRange Queryでトラバース中に通信エラーが起きた場合に戻れるノード数 -
RPC_TIMEOUT
public static int RPC_TIMEOUT -
QID_EXPIRE
public static int QID_EXPIREexpiration time for purging stale QueryIDs -
QID_EXPIRATION_TASK_PERIOD
public static int QID_EXPIRATION_TASK_PERIODperiod for executing a task for purging stale QueryIDs -
RQ_FLUSH_PERIOD
public static int RQ_FLUSH_PERIODthe period for flushing partial results in intermediate nodes -
RQ_EXPIRATION_GRACE
public static int RQ_EXPIRATION_GRACEadditional grace time before removing RQReturn in intermediate nodes -
RQ_RETRANS_PERIOD
public static int RQ_RETRANS_PERIODrange query retransmission period -
QUERY_INSERT_POINT_SPECIAL
used as the query string for finding insert points. seefind(Endpoint, DdllKey, boolean) -
FIND_INSERT_POINT_TIMEOUT
public static int FIND_INSERT_POINT_TIMEOUTtimeout forfind(Endpoint, DdllKey, boolean)
-
-
コンストラクタの詳細
-
SkipGraph
public SkipGraph(ChannelTransport<E> trans, SGExecQueryCallback execQueryCallback) throws IdConflictException, IOExceptioncreate a SkipGraph instance.- パラメータ:
trans- underlying transportexecQueryCallback- a callback object called when #execQuery(Deque, Comparable, QueryCondition, Object) is called- 例外:
IdConflictException- an exception occurs when the default transport id is registered.IOException- an exception thrown when an I/O error occurred.
-
SkipGraph
public SkipGraph(TransportId transId, ChannelTransport<E> trans, SGExecQueryCallback execQueryCallback) throws IdConflictException, IOException
-
-
メソッドの詳細
-
fin
public void fin()- オーバーライド:
finクラス内RPCInvoker<SkipGraphIf<E extends Endpoint>,E extends Endpoint>
-
getSGNode
get SGNode instance (for debugging only)- パラメータ:
rawkey- the raw key.- 戻り値:
- the corresponding SGNode object.
-
getPeerId
get PeerId- 戻り値:
- PeerId
-
toString
-
toStringShort
-
showTable
get a the routing table in plain text format.- 戻り値:
- routing table
-
addKey
add a key to the skip graph.- パラメータ:
rawkey- the key- 戻り値:
- true if the key was successfully added
- 例外:
IOException- thrown when some I/O error occurred in communicating with the introducerUnavailableException- thrown when the introducer has no key
-
addKey
add a key to the skip graph.同一キーは複数登録できない. 1物理ノード上に複数キーを並行挿入できるようにすることが 困難だったので,synchronized method としている.
- パラメータ:
introducer- some node that has been inserted to the skip graphrawkey- the key- 戻り値:
- true if the key was successfully added
- 例外:
IOException- thrown when some I/O error occurred in communicating with the introducerUnavailableException- thrown when the introducer has no key
-
removeKey
remove a key from the skip graph.- パラメータ:
rawkey- the key- 戻り値:
- true if the key was successfully removed
- 例外:
IOException- thrown if some I/O error occurred.
-
getLocalLinks
- 定義:
getLocalLinksインタフェース内SkipGraphIf<E extends Endpoint>
-
findClosestLocal
@Deprecated public SkipGraph.BestLink findClosestLocal(DdllKey key, boolean accurate) throws UnavailableException推奨されていません。ローカルの経路表からkeyに最も近いリンクを検索する. RPCで呼ばれる. 返される BestLink u は,isOrdered(u.link.key, key, u.rightLink.key) を満たす.- 定義:
findClosestLocalインタフェース内SkipGraphIf<E extends Endpoint>- パラメータ:
key- 検索するキーaccurate- 正確な値が必要ならばtrue (左リンクを信用しない)- 戻り値:
- BestLink
- 例外:
UnavailableException- ローカルの経路表にキーが1つも登録されていない場合
-
getSGNodeInfo
public SkipGraph.SGNodeInfo getSGNodeInfo(Comparable<?> target, int level, MembershipVector mv, int nTraversed) throws NoSuchKeyException- 定義:
getSGNodeInfoインタフェース内SkipGraphIf<E extends Endpoint>- 例外:
NoSuchKeyException
-
findOld
@Deprecated public Node.InsertPoint findOld(E introducer, DdllKey key, boolean accurate) throws UnavailableException, IOException推奨されていません。find a location to insert `key'.iterative routingを使用.
アルゴリズム: ・introducerからBestLinkを得る (findBestの呼び出し). introducer==nullの場合,自ノードの経路表を使う. ・introducerとの通信で通信エラーが発生した場合はIOExceptionをthrowする. ・エラーでなければ再帰的に自分自身を呼び出す. ・IOExceptionをキャッチしたら,introducerからBestLinkを再度得てやりなおす.
- パラメータ:
introducer- the node to communicate with.key- the query keyaccurate- true if accurate location is required (do not trust left links of DDLL node)- 戻り値:
- the insertion point for `key'
- 例外:
UnavailableException- 自ノードあるいはseedにkeyが登録されていないIOException- seedと通信する際にエラーが発生
-
find
public Node.InsertPoint find(E introducer, DdllKey key, boolean accurate) throws UnavailableException, IOExceptionfind a location to insert `key'.- パラメータ:
introducer- the node to communicate with.key- the query keyaccurate- true if accurate location is required (do not trust left links of DDLL node)- 戻り値:
- the insertion point for `key'
- 例外:
UnavailableException- 自ノードあるいはseedにkeyが登録されていないIOException- communication error
-
getHeight
public int getHeight()経路表の高さを返す. Level0しかない経路表の高さは1. INSERTEDであるノードの経路表高さは一致していなければならない.- 戻り値:
- the height of the routing tables
-
forwardQuery
指定された複数の範囲にクエリを転送し、得られた結果(リスト)を返す。- パラメータ:
ranges- 範囲のリストquery- クエリ- 戻り値:
- クエリ結果のリスト
-
forwardQuery
public List<RemoteValue<?>> forwardQuery(boolean isPlusDir, Range<?> range, int maxNum, Object query)指定されたkeyとNavigableCondの条件を満たすキーを持つピア(最大num個)にクエリを転送し、 得られた結果(リスト)を返す。例えば、keyが10、NavigableCondがLOWER、numが5の場合、10を越えなくて、 10の近傍にある最大5個のキーが探索対象となる。 numに2以上をセットする用途としては、 DHTのように特定のkeyの近傍集合に アクセスするケースがある。 尚、探索対象となるキーは、指定されたkeyと同じ型を持つ必要が ある。
- パラメータ:
isPlusDir- +方向にrangeにサーチする場合はtruerange- 探索対象となるRangemaxNum- 条件を満たす最大個数query- the query passed to execQuery()- 戻り値:
- クエリ結果のリスト
-
invokeExecQuery
public SkipGraph.ExecQueryReturn invokeExecQuery(Comparable<?> rawkey, Link curRight, org.piax.gtrans.ov.sg.SkipGraph.QueryId qid, boolean doAction, Object query) throws NoSuchKeyException, SkipGraph.RightNodeMismatchRange Query実行時にRPCで呼び出されるメソッド. 指定されたパラメータで execQuery を実行する. curRight != null の場合,レベル0の右リンクがcurRightと等しい場合にのみ実行. execQueryの結果(RemoteValue)と,レベル0での左右のリンクをSkipGraph.ExecQueryReturnに詰めて返す.- 定義:
invokeExecQueryインタフェース内SkipGraphIf<E extends Endpoint>- 例外:
NoSuchKeyException- rawkeyが存在しないSkipGraph.RightNodeMismatch- curRightがマッチしない
-
scalableRangeQuery
public FutureQueue<?> scalableRangeQuery(Collection<? extends Range<?>> ranges, Object query, TransOptions opts)Perform a range query.this procedure tries to send a query message to all the nodes within the specified ranges. this method is asynchronous; this method returns immediately and results are returned asynchronously via ReturnSet.
if some results could not be obtained within
RQ_RETRANS_PERIOD, the originating node retransmits a range query message that covers the missing ranges until it exceeds the timeout.- パラメータ:
ranges- set of query rangesquery- the object passed to the nodes in the query rangeopts- the options.- 戻り値:
- ReturnSet to obtain query results
-
requestMsgReceived
one-way RPCs- 定義:
requestMsgReceivedインタフェース内SkipGraphIf<E extends Endpoint>
-
replyMsgReceived
- 定義:
replyMsgReceivedインタフェース内SkipGraphIf<E extends Endpoint>
-
ackReceived
public void ackReceived(int msgId)- 定義:
ackReceivedインタフェース内SkipGraphIf<E extends Endpoint>
-
fixAndPropagateSingle
public void fixAndPropagateSingle(Comparable<?> target, Link failedLink, Collection<Link> failedLinks, DdllKey rLimit)- 定義:
fixAndPropagateSingleインタフェース内SkipGraphIf<E extends Endpoint>
-