public class SkipGraph<E extends Endpoint> extends RPCInvoker<SkipGraphIf<E>,E> implements SkipGraphIf<E>
| 修飾子とタイプ | クラスと説明 |
|---|---|
static class |
SkipGraph.BestLink
A class used for passing a link to the closest node.
|
static class |
SkipGraph.ExecQueryReturn
an execQuery return value used by (non-scalable) range queries
|
static class |
SkipGraph.LvState
A state for each level of a skip graph.
|
static class |
SkipGraph.RightNodeMismatch |
static class |
SkipGraph.SGNodeInfo
This is a class used as a return type for
SkipGraph#getSGNodeInfo
|
RPCInvoker.MethodCall| 修飾子とタイプ | フィールドと説明 |
|---|---|
static int |
DDLL_CHECK_PERIOD_L0
DDLL's left node check period for level 0 (msec)
|
static int |
DDLL_CHECK_PERIOD_L1
DDLL's left node check period for level 1 and above (msec)
|
static TransportId |
DEFAULT_TRANSPORT_ID |
static int |
FIND_INSERT_POINT_TIMEOUT
timeout for
find(Endpoint, DdllKey, boolean) |
static int |
QID_EXPIRATION_TASK_PERIOD
period for executing a task for purging stale QueryIDs
|
static int |
QID_EXPIRE
expiration time for purging stale QueryIDs
|
static String |
QUERY_INSERT_POINT_SPECIAL
used as the query string for finding insert points.
|
static int |
RPC_TIMEOUT |
static int |
RQ_EXPIRATION_GRACE
additional grace time before removing RQReturn in intermediate nodes
|
static int |
RQ_FLUSH_PERIOD
the period for flushing partial results in intermediate nodes
|
static int |
RQ_NRECENT
Range Queryでトラバース中に通信エラーが起きた場合に戻れるノード数
|
static int |
RQ_RETRANS_PERIOD
range query retransmission period
|
channelPool, isActive, objId, POOL_CHANNEL, POOL_CHANNEL_SIZE, trans, transId, USE_CHANNEL_FOR_ONEWAY| コンストラクタと説明 |
|---|
SkipGraph(ChannelTransport<E> trans,
SGExecQueryCallback execQueryCallback)
create a SkipGraph instance.
|
SkipGraph(TransportId transId,
ChannelTransport<E> trans,
SGExecQueryCallback execQueryCallback) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
ackReceived(int msgId) |
boolean |
addKey(Comparable<?> rawkey)
add a key to the skip graph.
|
boolean |
addKey(E introducer,
Comparable<?> rawkey)
add a key to the skip graph.
|
void |
fin() |
Node.InsertPoint |
find(E introducer,
DdllKey key,
boolean accurate)
find a location to insert `key'.
|
SkipGraph.BestLink |
findClosestLocal(DdllKey key,
boolean accurate)
非推奨です。
|
Node.InsertPoint |
findOld(E introducer,
DdllKey key,
boolean accurate)
非推奨です。
|
void |
fixAndPropagateSingle(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)
指定された複数の範囲にクエリを転送し、得られた結果(リスト)を返す。
|
int |
getHeight()
経路表の高さを返す.
|
Link[] |
getLocalLinks() |
PeerId |
getPeerId()
get PeerId
|
SGNode<E> |
getSGNode(Comparable<?> rawkey)
get SGNode instance (for debugging only)
|
SkipGraph.SGNodeInfo |
getSGNodeInfo(Comparable<?> target,
int level,
MembershipVector mv,
int nTraversed) |
SkipGraph.ExecQueryReturn |
invokeExecQuery(Comparable<?> rawkey,
Link curRight,
org.piax.gtrans.ov.sg.SkipGraph.QueryId qid,
boolean doAction,
Object query)
Range Query実行時にRPCで呼び出されるメソッド.
|
boolean |
removeKey(Comparable<?> rawkey)
remove a key from the skip graph.
|
void |
replyMsgReceived(SGMessagingFramework.SGReplyMessage<E> sgReplyMessage) |
void |
requestMsgReceived(SGMessagingFramework.SGRequestMessage<E> sgMessage)
one-way RPCs
|
FutureQueue<?> |
scalableRangeQuery(Collection<? extends Range<?>> ranges,
Object query,
TransOptions opts)
Perform a range query.
|
String |
showTable()
get a the routing table in plain text format.
|
String |
toString() |
String |
toStringShort() |
changeRPCTimeout, changeTransport, checkActive, 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, unregisterRPCObjectpublic static TransportId DEFAULT_TRANSPORT_ID
public static int DDLL_CHECK_PERIOD_L0
public static int DDLL_CHECK_PERIOD_L1
public static int RQ_NRECENT
public static int RPC_TIMEOUT
public static int QID_EXPIRE
public static int QID_EXPIRATION_TASK_PERIOD
public static int RQ_FLUSH_PERIOD
public static int RQ_EXPIRATION_GRACE
public static int RQ_RETRANS_PERIOD
public static String QUERY_INSERT_POINT_SPECIAL
find(Endpoint, DdllKey, boolean)public static int FIND_INSERT_POINT_TIMEOUT
find(Endpoint, DdllKey, boolean)public SkipGraph(ChannelTransport<E> trans, SGExecQueryCallback execQueryCallback) throws IdConflictException, IOException
trans - underlying transportexecQueryCallback - a callback object called when
#execQuery(Deque, Comparable, QueryCondition, Object)
is calledIdConflictException - an exception occurs when the default transport id is registered.IOException - an exception thrown when an I/O error occurred.public SkipGraph(TransportId transId, ChannelTransport<E> trans, SGExecQueryCallback execQueryCallback) throws IdConflictException, IOException
public void fin()
fin クラス内 RPCInvoker<SkipGraphIf<E extends Endpoint>,E extends Endpoint>public SGNode<E> getSGNode(Comparable<?> rawkey)
rawkey - the raw key.public PeerId getPeerId()
public String toStringShort()
public String showTable()
public boolean addKey(Comparable<?> rawkey) throws IOException, UnavailableException
rawkey - the keyIOException - thrown when some I/O error occurred in communicating with the
introducerUnavailableException - thrown when the introducer has no keypublic boolean addKey(E introducer, Comparable<?> rawkey) throws UnavailableException, IOException
同一キーは複数登録できない. 1物理ノード上に複数キーを並行挿入できるようにすることが 困難だったので,synchronized method としている.
introducer - some node that has been inserted to the skip graphrawkey - the keyIOException - thrown when some I/O error occurred in communicating with the
introducerUnavailableException - thrown when the introducer has no keypublic boolean removeKey(Comparable<?> rawkey) throws IOException
rawkey - the keyIOException - thrown if some I/O error occurred.public Link[] getLocalLinks()
getLocalLinks インタフェース内 SkipGraphIf<E extends Endpoint>@Deprecated public SkipGraph.BestLink findClosestLocal(DdllKey key, boolean accurate) throws UnavailableException
findClosestLocal インタフェース内 SkipGraphIf<E extends Endpoint>key - 検索するキーaccurate - 正確な値が必要ならばtrue (左リンクを信用しない)UnavailableException - ローカルの経路表にキーが1つも登録されていない場合public SkipGraph.SGNodeInfo getSGNodeInfo(Comparable<?> target, int level, MembershipVector mv, int nTraversed) throws NoSuchKeyException
getSGNodeInfo インタフェース内 SkipGraphIf<E extends Endpoint>NoSuchKeyException@Deprecated public Node.InsertPoint findOld(E introducer, DdllKey key, boolean accurate) throws UnavailableException, IOException
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)UnavailableException - 自ノードあるいはseedにkeyが登録されていないIOException - seedと通信する際にエラーが発生public Node.InsertPoint find(E introducer, DdllKey key, boolean accurate) throws UnavailableException, IOException
introducer - the node to communicate with.key - the query keyaccurate - true if accurate location is required (do not trust left links
of DDLL node)UnavailableException - 自ノードあるいはseedにkeyが登録されていないIOException - communication errorpublic int getHeight()
public List<RemoteValue<?>> forwardQuery(Collection<? extends Range<?>> ranges, Object query)
ranges - 範囲のリストquery - クエリpublic List<RemoteValue<?>> forwardQuery(boolean isPlusDir, Range<?> range, int maxNum, Object query)
例えば、keyが10、NavigableCondがLOWER、numが5の場合、10を越えなくて、 10の近傍にある最大5個のキーが探索対象となる。 numに2以上をセットする用途としては、 DHTのように特定のkeyの近傍集合に アクセスするケースがある。 尚、探索対象となるキーは、指定されたkeyと同じ型を持つ必要が ある。
isPlusDir - +方向にrangeにサーチする場合はtruerange - 探索対象となるRangemaxNum - 条件を満たす最大個数query - the query passed to execQuery()public SkipGraph.ExecQueryReturn invokeExecQuery(Comparable<?> rawkey, Link curRight, org.piax.gtrans.ov.sg.SkipGraph.QueryId qid, boolean doAction, Object query) throws NoSuchKeyException, SkipGraph.RightNodeMismatch
SkipGraph.ExecQueryReturn に詰めて返す.invokeExecQuery インタフェース内 SkipGraphIf<E extends Endpoint>NoSuchKeyException - rawkeyが存在しないSkipGraph.RightNodeMismatch - curRightがマッチしないpublic FutureQueue<?> scalableRangeQuery(Collection<? extends Range<?>> ranges, Object query, TransOptions opts)
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.public void requestMsgReceived(SGMessagingFramework.SGRequestMessage<E> sgMessage)
requestMsgReceived インタフェース内 SkipGraphIf<E extends Endpoint>public void replyMsgReceived(SGMessagingFramework.SGReplyMessage<E> sgReplyMessage)
replyMsgReceived インタフェース内 SkipGraphIf<E extends Endpoint>public void ackReceived(int msgId)
ackReceived インタフェース内 SkipGraphIf<E extends Endpoint>public void fixAndPropagateSingle(Comparable<?> target, Link failedLink, Collection<Link> failedLinks, DdllKey rLimit)
fixAndPropagateSingle インタフェース内 SkipGraphIf<E extends Endpoint>Copyright © 2017. All rights reserved.