Package org.nustaq.reallive.client
Class ShardedTable
java.lang.Object
org.nustaq.reallive.client.ShardedTable
- All Implemented Interfaces:
java.io.Serializable,ChangeReceiver,ChangeStream,RealLiveStreamActor,RealLiveTable,SafeChangeStream,SafeRealLiveStreamActor,SafeRealLiveTable
- Direct Known Subclasses:
DynShardedTable
public class ShardedTable extends java.lang.Object implements RealLiveTable
Created by moelrue on 06.08.2015.
Provides a single view on to a sharded table client side
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected TableDescriptiondescriptionstatic booleanDUMP_IN_PROC_CHANGESprotected java.util.concurrent.atomic.AtomicBooleanglobalListenReadyprotected FilterProcessorprocprotected java.util.Set<RealLiveTable>shardsprotected java.util.HashMap<java.lang.Integer,RealLiveTable>tableShardMap -
Constructor Summary
Constructors Constructor Description ShardedTable(RealLiveTable[] shards, TableDescription desc) -
Method Summary
Modifier and Type Method Description void_deepMerge(int senderId, Record jsonrec)org.nustaq.kontraktor.IPromise<java.lang.Boolean>add(int senderId, java.lang.String key, java.lang.Object... keyVals)voidaddNode(RealLiveTable shard)org.nustaq.kontraktor.IPromise<java.lang.Boolean>addRecord(int senderId, Record rec)protected voidadjustLimitFilter(RLPredicate filter)org.nustaq.kontraktor.IPromiseatomic(int senderId, java.lang.String key, RLFunction<Record,java.lang.Object> action)apply the function to the record with given key and return the result inside a promise changes to the record inside the function are applied to the real record and a change message is generated.voidatomicUpdate(RLPredicate<Record> filter, RLFunction<Record,java.lang.Boolean> action)mass update.<T> voidforEachWithSpore(org.nustaq.kontraktor.Spore<Record,T> spore)org.nustaq.kontraktor.IPromise<Record>get(java.lang.String key)org.nustaq.kontraktor.IPromise<TableDescription>getDescription()org.nustaq.kontraktor.IPromise<StorageStats>getStats()protected RealLiveTablegetTableForKey(java.lang.String key)voidmerge(int senderId, java.lang.String key, java.lang.Object... keyVals)voidmergeRecord(int senderId, Record rec)org.nustaq.kontraktor.IPromiseping()voidpruneRemoveLog(long maxAge)voidput(int senderId, java.lang.String key, java.lang.Object... keyVals)voidqueryRemoveLog(long from, long to, org.nustaq.kontraktor.Callback<RemoveLog.RemoveLogEntry> cb)voidrealUnsubscribe(Subscriber subs)voidreceive(ChangeMessage change)voidremove(int senderId, java.lang.String key)voidremoveNode(org.nustaq.kontraktor.Actor actorRef)voidremoveTableShard(RealLiveTable shard2Remove)org.nustaq.kontraktor.IPromiseresizeIfLoadFactorLarger(double loadFactor, long maxGrowBytes)voidsetRecord(int senderId, Record rec)org.nustaq.kontraktor.IPromise<java.lang.Long>size()voidstop()voidsubscribe(Subscriber subs)DO NOT USE DIRECTLY, use subscribeOn etc.org.nustaq.kontraktor.IPromise<Record>take(int senderId, java.lang.String key)voidunsubscribe(Subscriber subs)voidunsubscribeById(int subsId)voidupdate(int senderId, java.lang.String key, java.lang.Object... keyVals)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nustaq.reallive.api.ChangeStream
listen, observe, subscribeOn, subscribeOnMethods inherited from interface org.nustaq.reallive.api.RealLiveStreamActor
forEach, forEach, map, query
-
Field Details
-
DUMP_IN_PROC_CHANGES
public static boolean DUMP_IN_PROC_CHANGES -
description
-
tableShardMap
-
shards
-
proc
-
globalListenReady
protected java.util.concurrent.atomic.AtomicBoolean globalListenReady
-
-
Constructor Details
-
Method Details
-
addNode
-
removeTableShard
-
getTableForKey
-
receive
- Specified by:
receivein interfaceChangeReceiver
-
resizeIfLoadFactorLarger
public org.nustaq.kontraktor.IPromise resizeIfLoadFactorLarger(double loadFactor, long maxGrowBytes)- Specified by:
resizeIfLoadFactorLargerin interfaceSafeRealLiveTable
-
subscribe
Description copied from interface:ChangeStreamDO NOT USE DIRECTLY, use subscribeOn etc.- Specified by:
subscribein interfaceChangeStream
-
adjustLimitFilter
-
unsubscribe
- Specified by:
unsubscribein interfaceChangeStream
-
unsubscribeById
public void unsubscribeById(int subsId)- Specified by:
unsubscribeByIdin interfaceRealLiveTable
-
realUnsubscribe
-
atomic
public org.nustaq.kontraktor.IPromise atomic(int senderId, java.lang.String key, RLFunction<Record,java.lang.Object> action)Description copied from interface:RealLiveTableapply the function to the record with given key and return the result inside a promise changes to the record inside the function are applied to the real record and a change message is generated. In case the function returns a changemessage (add,putRecord,remove ..), the change message is applied to the original record and broadcasted. Else the result of the action function is passed to the remote callee- Specified by:
atomicin interfaceRealLiveTable- Returns:
- the result of function.
-
atomicUpdate
Description copied from interface:RealLiveTablemass update.- Specified by:
atomicUpdatein interfaceRealLiveTable- Parameters:
filter- - selects recordsaction- - function, the function might modify the record using putField. If false is returned, the record is deleted
-
put
public void put(int senderId, java.lang.String key, java.lang.Object... keyVals)- Specified by:
putin interfaceSafeRealLiveTable
-
merge
public void merge(int senderId, java.lang.String key, java.lang.Object... keyVals)- Specified by:
mergein interfaceSafeRealLiveTable
-
_deepMerge
- Specified by:
_deepMergein interfaceSafeRealLiveTable
-
add
public org.nustaq.kontraktor.IPromise<java.lang.Boolean> add(int senderId, java.lang.String key, java.lang.Object... keyVals)- Specified by:
addin interfaceSafeRealLiveTable
-
addRecord
- Specified by:
addRecordin interfaceSafeRealLiveTable
-
mergeRecord
- Specified by:
mergeRecordin interfaceSafeRealLiveTable
-
setRecord
- Specified by:
setRecordin interfaceSafeRealLiveTable
-
update
public void update(int senderId, java.lang.String key, java.lang.Object... keyVals)- Specified by:
updatein interfaceSafeRealLiveTable
-
take
- Specified by:
takein interfaceSafeRealLiveTable
-
remove
public void remove(int senderId, java.lang.String key)- Specified by:
removein interfaceSafeRealLiveTable
-
forEachWithSpore
- Specified by:
forEachWithSporein interfaceRealLiveStreamActor
-
ping
public org.nustaq.kontraktor.IPromise ping()- Specified by:
pingin interfaceSafeRealLiveTable
-
getDescription
- Specified by:
getDescriptionin interfaceSafeRealLiveTable
-
stop
public void stop()- Specified by:
stopin interfaceSafeRealLiveTable
-
getStats
- Specified by:
getStatsin interfaceSafeRealLiveTable
-
get
- Specified by:
getin interfaceSafeRealLiveTable
-
size
public org.nustaq.kontraktor.IPromise<java.lang.Long> size()- Specified by:
sizein interfaceSafeRealLiveTable
-
removeNode
public void removeNode(org.nustaq.kontraktor.Actor actorRef) -
queryRemoveLog
public void queryRemoveLog(long from, long to, org.nustaq.kontraktor.Callback<RemoveLog.RemoveLogEntry> cb)- Specified by:
queryRemoveLogin interfaceRealLiveTable
-
pruneRemoveLog
public void pruneRemoveLog(long maxAge)- Specified by:
pruneRemoveLogin interfaceRealLiveTable
-