Package io.odysz.semantic.syn
Class SyndomContext
java.lang.Object
io.odysz.semantic.syn.SyndomContext
A synode context, a database cache, per domain, for managing and sharing domain
wide information, e.g. stamp, n0, Nyquvect, etc., across multiple syn-change
handlers.
- Author:
- ody
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionThe admin's id, first of synusers in dictionary.json, used for logging into peers.protected final SynChangeMeta
final boolean
protected String
protected final SynchangeBuffMeta
static boolean
Force throw exception if stamp >= n0 + 1 when try to increase stamp.final SynodeMode
protected final PeersMeta
protected final SynSubsMeta
final String
protected SyncUser
final SynodeMeta
final String
-
Constructor Summary
ModifierConstructorDescriptionprotected
SyndomContext
(SynodeMode mod, String dom, String synode, String synconn, boolean debug) -
Method Summary
Modifier and TypeMethodDescriptionadmin
(io.odysz.semantics.IUser r) domain()
domainitOnjoin
(DBSyntableBuilder b, String dom, Nyquence n0) Update domain context by upper node's reply.static Nyquence
getNyquence
(DATranscxt trb, String conn, io.odysz.semantics.IUser usr, SynodeMeta m, String nyqfield, String... where_eqs) Load nyquence without triggering semantics handling.static Nyquence
For test.void
incStamp
(DBSyntableBuilder synb, HashMap<String, Nyquence> peernv) loadNvstamp
(DATranscxt tb, io.odysz.semantics.IUser usr) loadNvstamp
(DBSyntableBuilder synb) boolean
lockme
(SyndomContext.OnMutexLock onMutext) Request a mutex lock for synchronization, for synssion of myself.boolean
n0()
n0
(DBSyntableBuilder synb, Nyquence maxn) persistamp
(DBSyntableBuilder trb, Nyquence... up2max) persistNyquence
(DBSyntableBuilder trb, String synid, Nyquence n) long
stamp()
void
unlockme()
void
-
Field Details
-
forceExceptionStamp2n0
public static boolean forceExceptionStamp2n0Force throw exception if stamp >= n0 + 1 when try to increase stamp. -
dbg
public final boolean dbg -
domain
-
synode
-
synconn
-
synm
-
pnvm
-
subm
-
chgm
-
exbm
-
admin
The admin's id, first of synusers in dictionary.json, used for logging into peers. for tasks such as update syn_node, etc. -
mode
-
synlocker
-
-
Constructor Details
-
Method Details
-
domain
-
admin
-
stamp
public long stamp() -
n0
-
incStamp
public void incStamp(DBSyntableBuilder synb, HashMap<String, Nyquence> peernv) throws io.odysz.transact.x.TransException, SQLException- Throws:
io.odysz.transact.x.TransException
SQLException
-
incN0
- Throws:
io.odysz.transact.x.TransException
SQLException
-
n0
public Nyquence n0(DBSyntableBuilder synb, Nyquence maxn) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
loadNvstamp
public HashMap<String,Nyquence> loadNvstamp(DBSyntableBuilder synb) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
loadNvstamp
public SyndomContext loadNvstamp(DATranscxt tb, io.odysz.semantics.IUser usr) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
getNyquence
public static Nyquence getNyquence(DBSyntableBuilder trb) throws SQLException, io.odysz.transact.x.TransException For test.- Parameters:
trb
-- Returns:
- Nyquence
- Throws:
SQLException
io.odysz.transact.x.TransException
-
getNyquence
public static Nyquence getNyquence(DATranscxt trb, String conn, io.odysz.semantics.IUser usr, SynodeMeta m, String nyqfield, String... where_eqs) throws SQLException, io.odysz.transact.x.TransException Load nyquence without triggering semantics handling.- Parameters:
trb
-conn
-m
-nyqfield
-where_eqs
-- Returns:
- nyquence
- Throws:
SQLException
io.odysz.transact.x.TransException
-
domainitOnjoin
public SyndomContext domainitOnjoin(DBSyntableBuilder b, String dom, Nyquence n0) throws io.odysz.transact.x.TransException, SQLException Update domain context by upper node's reply.- Parameters:
b
-dom
-n0
-- Returns:
- Throws:
io.odysz.transact.x.TransException
SQLException
-
persistamp
public Nyquence persistamp(DBSyntableBuilder trb, Nyquence... up2max) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
persistNyquence
public Nyquence persistNyquence(DBSyntableBuilder trb, String synid, Nyquence n) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
unlockx
-
lockme
Request a mutex lock for synchronization, for synssion of myself.- Parameters:
onMutext
- delay provide, a random value, 0 for trying immediately, < 0 for quite.- Returns:
- whether successful or not
- Throws:
InterruptedException
-
unlockme
public void unlockme() -
lockx
-