public class DBSyntableBuilder extends DATranscxt
DBSyntext
for handling database synchronization.
Improved with temporary tables for broken network (and shutdown), concurrency and memory usage.DATranscxt.SemanticsMap, DATranscxt.SmapFactory<M extends DATranscxt.SemanticsMap>
Modifier and Type | Field and Description |
---|---|
protected SynChangeMeta |
chgm |
protected SynchangeBuffMeta |
exbm |
HashMap<String,Nyquence> |
nyquvect
Nyquence vector [{synode, Nyquence}]
|
protected PeersMeta |
pnvm |
protected Nyquence |
stamp |
protected SynSubsMeta |
subm |
protected SynodeMeta |
synm |
cfgroot, dummy, runtimepath, smtMaps
Constructor and Description |
---|
DBSyntableBuilder(String conn,
String synodeId,
SynodeMode mode) |
DBSyntableBuilder(String conn,
String synodeId,
SynodeMode mode,
SynChangeMeta chgm,
SynodeMeta synm) |
Modifier and Type | Method and Description |
---|---|
ExchangeBlock |
abortExchange(ExessionPersist cx) |
void |
abortExchange(ExessionPersist cx,
String target,
ExchangeBlock rep) |
ExchangeBlock |
addMyChild(ExessionPersist ap,
ExchangeBlock req,
String org) |
static HashMap<String,Object[]> |
checkChangeCol(HashMap<String,Object[]> colnames)
Check and extend column
#ChangeFlag , which is for changing flag of change-logs. |
protected void |
cleanStaleSubs(String peer)
Clean any subscriptions that should been accepted by the peer in
the last session, but was not accutally accepted.
|
HashMap<String,Nyquence> |
closeJoining(ExessionPersist cp,
HashMap<String,Nyquence> clone) |
ExchangeBlock |
closexchange(ExessionPersist cx,
ExchangeBlock rep) |
protected io.odysz.transact.sql.Statement<?> |
del0subchange(String iffnode)
Delete change log if no subscribers accept.
|
int |
deleteEntityBySynuid(SyntityMeta entm,
String synuid) |
String |
domain() |
ExchangeBlock |
domainSignup(ExessionPersist app,
String admin) |
int |
entities(SyntityMeta m) |
SyntityMeta |
getEntityMeta(String entbl) |
SyntityMeta |
getSyntityMeta(String tbl) |
Nyquence |
incN0(Nyquence... n)
this.n0++, this.n0 = max(n0, maxn)
|
DBSyntableBuilder |
incNyquence()
Inc my n0, then reload from DB.
|
long |
incSeq() |
ExchangeBlock |
initDomain(ExessionPersist cp,
String admin,
ExchangeBlock domainstatus) |
ExchangeBlock |
initExchange(ExessionPersist cp,
String target)
insert into exchanges select * from change_logs where n > nyquvect[target].n
|
String[] |
insertEntity(SyntityMeta m,
SynEntity e) |
io.odysz.semantics.ISemantext |
instancontxt(String conn,
io.odysz.semantics.IUser usr)
Create a new semantext instance with the static resources.
|
DBSyntableBuilder |
loadNyquvect0(String conn) |
Nyquence |
n0() |
protected DBSyntableBuilder |
n0(Nyquence nyq) |
void |
onAbort(ExchangeBlock req) |
ExchangeBlock |
onclosexchange(ExessionPersist sx,
ExchangeBlock rep) |
ExchangeBlock |
onInit(ExessionPersist sp,
ExchangeBlock inireq)
insert into exchanges select * from change_logs where n > nyquvect[sx.peer].n
|
void |
onRequires(ExessionPersist cp,
ExchangeBlock req) |
protected Nyquence |
persistamp() |
protected Nyquence |
persistamp(Nyquence n) |
DBSyntableBuilder |
registerEntity(String conn,
SyntityMeta m) |
ExchangeBlock |
requirestore(ExessionPersist xp,
String peer) |
void |
restorexchange()
Client have found unfinished exchange session then retry it.
|
String |
synconn()
Get synchronization meta connection id.
|
protected String |
synode() |
io.odysz.semantics.IUser |
synrobot() |
protected HashMap<String,Nyquence> |
synyquvectMax(String peer,
HashMap<String,Nyquence> nv,
HashMap<String,Nyquence> mynv) |
String |
updateEntity(String synoder,
String synuid,
SyntityMeta entm,
Object... nvs) |
configRoot, delete, dummyUser, exists, findResulved, getBasicTrans, getHandler, getSysConnId, hasSemantics, initConfigs, insert, key, key, loadSemantics, now, quotation, select, tableMeta, update
protected SynodeMeta synm
protected PeersMeta pnvm
protected SynSubsMeta subm
protected SynChangeMeta chgm
protected SynchangeBuffMeta exbm
protected Nyquence stamp
public DBSyntableBuilder(String conn, String synodeId, SynodeMode mode) throws SQLException, SAXException, IOException, io.odysz.transact.x.TransException
SQLException
SAXException
IOException
io.odysz.transact.x.TransException
public DBSyntableBuilder(String conn, String synodeId, SynodeMode mode, SynChangeMeta chgm, SynodeMeta synm) throws SQLException, SAXException, IOException, io.odysz.transact.x.TransException
SQLException
SAXException
IOException
io.odysz.transact.x.TransException
public String synconn()
protected String synode()
protected Nyquence persistamp(Nyquence n) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
protected Nyquence persistamp() throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public Nyquence n0()
protected DBSyntableBuilder n0(Nyquence nyq)
public String domain()
public io.odysz.semantics.IUser synrobot()
public long incSeq()
public SyntityMeta getSyntityMeta(String tbl)
public ExchangeBlock initExchange(ExessionPersist cp, String target) throws io.odysz.transact.x.TransException, SQLException
cp
- target
- io.odysz.transact.x.TransException
SQLException
public ExchangeBlock onInit(ExessionPersist sp, ExchangeBlock inireq) throws SQLException, io.odysz.transact.x.TransException
sp
- inireq
- io.odysz.transact.x.TransException
SQLException
public void abortExchange(ExessionPersist cx, String target, ExchangeBlock rep)
public ExchangeBlock closexchange(ExessionPersist cx, ExchangeBlock rep) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
protected HashMap<String,Nyquence> synyquvectMax(String peer, HashMap<String,Nyquence> nv, HashMap<String,Nyquence> mynv) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public ExchangeBlock abortExchange(ExessionPersist cx) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public ExchangeBlock onclosexchange(ExessionPersist sx, ExchangeBlock rep) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public void onAbort(ExchangeBlock req) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public ExchangeBlock requirestore(ExessionPersist xp, String peer)
public void onRequires(ExessionPersist cp, ExchangeBlock req) throws ExchangeException
ExchangeException
public void restorexchange()
public int deleteEntityBySynuid(SyntityMeta entm, String synuid) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public String[] insertEntity(SyntityMeta m, SynEntity e) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public String updateEntity(String synoder, String synuid, SyntityMeta entm, Object... nvs) throws io.odysz.transact.x.TransException, SQLException, IOException
io.odysz.transact.x.TransException
SQLException
IOException
public DBSyntableBuilder registerEntity(String conn, SyntityMeta m) throws SemanticException, io.odysz.transact.x.TransException, SQLException
SemanticException
io.odysz.transact.x.TransException
SQLException
public SyntityMeta getEntityMeta(String entbl) throws SemanticException
SemanticException
public DBSyntableBuilder incNyquence() throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public Nyquence incN0(Nyquence... n) throws io.odysz.transact.x.TransException, SQLException
maxn
- SQLException
io.odysz.transact.x.TransException
public DBSyntableBuilder loadNyquvect0(String conn) throws SQLException, io.odysz.transact.x.TransException
SQLException
io.odysz.transact.x.TransException
public io.odysz.semantics.ISemantext instancontxt(String conn, io.odysz.semantics.IUser usr) throws io.odysz.transact.x.TransException
DATranscxt
Create a new semantext instance with the static resources.
DATranscxt
use a basic context (without semantics handler) for basic sql building.DASemantics
handling must use this to create a new context instance.instancontxt
in class DATranscxt
conn
- connection id usually mapped with client function uri, like: Connects.uri2conn(req.uri())io.odysz.transact.x.TransException
ISemantext
public ExchangeBlock domainSignup(ExessionPersist app, String admin)
public ExchangeBlock initDomain(ExessionPersist cp, String admin, ExchangeBlock domainstatus) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public HashMap<String,Nyquence> closeJoining(ExessionPersist cp, HashMap<String,Nyquence> clone)
protected void cleanStaleSubs(String peer)
peer
- protected io.odysz.transact.sql.Statement<?> del0subchange(String iffnode) throws io.odysz.transact.x.TransException
domain
- iffnode
- delete the change-log iff the node, i.e. the subscriber, exists.
For answers, it's the node himself, for challenge, it's the source node.io.odysz.transact.x.TransException
public static HashMap<String,Object[]> checkChangeCol(HashMap<String,Object[]> colnames)
#ChangeFlag
, which is for changing flag of change-logs.answer
- public ExchangeBlock addMyChild(ExessionPersist ap, ExchangeBlock req, String org) throws io.odysz.transact.x.TransException, SQLException
io.odysz.transact.x.TransException
SQLException
public int entities(SyntityMeta m) throws SQLException, io.odysz.transact.x.TransException
SQLException
io.odysz.transact.x.TransException
Copyright © 2024. All rights reserved.