Package io.odysz.semantic.syn
Class DBSyntableBuilder
java.lang.Object
io.odysz.transact.sql.Transcxt
io.odysz.semantic.DATranscxt
io.odysz.semantic.syn.DBSyntableBuilder
Sql statement builder for
DBSynmantext
for handling database synchronization.
Improved with temporary tables for broken network (and shutdown), concurrency and memory usage.
Issue ee153bcb30c3f3b868413beace8cc1f3cb5c3f7c
version: Semantic-DA 2.0.0-SNAPSHOT, jserv.docsyc 0.2.0-SNAPSHOT commit: ee153bcb30c3f3b868413beace8cc1f3cb5c3f7c & ee153bcb30c3f3b868413beace8cc1f3cb5c3f7c About: DBSyntableBuilder.stamp is managed not for each domain. To use stamp in this way, nyquence numbers should be synchronized in a cross-domain style; To use stamps for each domain, multiple change-logs for each domain of an entity changing operation must be generated.
- Author:
- Ody
-
Nested Class Summary
Nested classes/interfaces inherited from class io.odysz.semantic.DATranscxt
DATranscxt.SemanticsMap, DATranscxt.SmapFactory<M extends DATranscxt.SemanticsMap>
-
Field Summary
Fields inherited from class io.odysz.semantic.DATranscxt
cfgroot, dummy, runtimepath, smtMaps
Fields inherited from class io.odysz.transact.sql.Transcxt
basictx
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abortExchange
(ExessionPersist cx, String target, ExchangeBlock rep) checkChangeCol
(HashMap<String, Object[]> colnames) Check and extend columnExchangeBlock.ExchangeFlagCol
, 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.closexchange
(ExessionPersist cx, ExchangeBlock rep) protected io.odysz.transact.sql.Statement<?>
del0subchange
(String iffnode) Delete change log if no subscribers accept.int
deleteEntityBySynuid
(SyndomContext syndomContext, SyntityMeta entm, String synuid) domainCloseJoin
(ExessionPersist cp, ExchangeBlock rep) close joining session.domainitMe
(ExessionPersist cp, String admin, String adminserv, String domain, ExchangeBlock domainof) domainOnAdd
(ExessionPersist ap, ExchangeBlock req, String org) domainSignup
(ExessionPersist app, String admin) Set n-stamp, then create a request package.int
Get entity count, ofm.tbl
.void
long
incSeq()
insert into exchanges select * from change_logs where n > nyquvect[target].nString[]
insertEntity
(SyndomContext sdx, SyntityMeta m, SynEntity e, String... entitypk) NOTE: This method sholdn't be used other than tests.io.odysz.semantics.ISemantext
void
onAbort
(ExchangeBlock req) onclosexchange
(ExessionPersist sx, ExchangeBlock rep) onInit
(ExessionPersist sp, ExchangeBlock inireq) Insert into exchanges select * from change_logs where n > nyquvect[sx.peer].n.void
onRequires
(ExessionPersist cp, ExchangeBlock req) requirestore
(ExessionPersist xp, String peer) void
Client have found unfinished exchange session then retry it.synrobot()
synyquvectMax
(ExessionPersist xp, HashMap<String, Nyquence> xnv) updateEntity
(SyndomContext sdx, String synoder, String[] uids, SyntityMeta entm, Object... nvs) NOTE: This method sholdn't be used other than tests.xp
(ExessionPersist exessionPersist) Methods inherited from class io.odysz.semantic.DATranscxt
configRoot, delete, dummyUser, exists, findResulved, getBasicTrans, getHandler, hasSemantics, initConfigs, insert, instancontxt, key, key, loadSemanticsXml, now, quotation, select, tableMeta, update
Methods inherited from class io.odysz.transact.sql.Transcxt
basictx, delete, insert, insertExp, select, selectPage, selectPage, tableMeta, update, with, with
-
Field Details
-
syndomx
-
-
Constructor Details
-
DBSyntableBuilder
- Parameters:
x
-- Throws:
Exception
-
-
Method Details
-
synrobot
-
incSeq
public long incSeq() -
initExchange
public ExchangeBlock initExchange(ExessionPersist cp) throws io.odysz.transact.x.TransException, SQLException insert into exchanges select * from change_logs where n > nyquvect[target].n- Parameters:
cp
-- Returns:
- {total: change-logs to be exchanged}
- Throws:
io.odysz.transact.x.TransException
SQLException
-
onInit
public ExchangeBlock onInit(ExessionPersist sp, ExchangeBlock inireq) throws SQLException, io.odysz.transact.x.TransException Insert into exchanges select * from change_logs where n > nyquvect[sx.peer].n.- Parameters:
sp
-inireq
-- Returns:
- response block
- Throws:
io.odysz.transact.x.TransException
SQLException
-
abortExchange
-
closexchange
public ExchangeBlock closexchange(ExessionPersist cx, ExchangeBlock rep) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
synyquvectMax
public HashMap<String,Nyquence> synyquvectMax(ExessionPersist xp, HashMap<String, Nyquence> xnv) throws io.odysz.transact.x.TransException, SQLException- Throws:
io.odysz.transact.x.TransException
SQLException
-
abortExchange
public ExchangeBlock abortExchange(ExessionPersist cx) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
onclosexchange
public ExchangeBlock onclosexchange(ExessionPersist sx, ExchangeBlock rep) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
onAbort
- Throws:
io.odysz.transact.x.TransException
SQLException
-
requirestore
-
onRequires
- Throws:
ExchangeException
-
restorexchange
public void restorexchange()Client have found unfinished exchange session then retry it. -
deleteEntityBySynuid
public int deleteEntityBySynuid(SyndomContext syndomContext, SyntityMeta entm, String synuid) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
insertEntity
public String[] insertEntity(SyndomContext sdx, SyntityMeta m, SynEntity e, String... entitypk) throws io.odysz.transact.x.TransException, SQLException NOTE: This method sholdn't be used other than tests.FYI: There is no syn-change semantics, and don't configure syn-change semantics for the table.
- Parameters:
m
-e
-entitypk
- must be ignored if is inserting an entity ofsmtype.autoInc
- Returns:
- [entity-id, change-id]
- Throws:
io.odysz.transact.x.TransException
SQLException
-
updateEntity
public String updateEntity(SyndomContext sdx, String synoder, String[] uids, SyntityMeta entm, Object... nvs) throws io.odysz.transact.x.TransException, SQLException, IOException NOTE: This method sholdn't be used other than tests.FYI: There is no syn-change semantics, and don't configure syn-change semantics for the table.
- Parameters:
sdx
-synoder
-uids
-entm
-nvs
-- Returns:
- Throws:
io.odysz.transact.x.TransException
SQLException
IOException
-
incN0
- Throws:
io.odysz.transact.x.TransException
SQLException
-
domainSignup
public ExchangeBlock domainSignup(ExessionPersist app, String admin) throws io.odysz.transact.x.TransException, SQLException Set n-stamp, then create a request package.- Parameters:
app
-admin
-- Returns:
- the request
- Throws:
io.odysz.transact.x.TransException
SQLException
-
domainOnAdd
public ExchangeBlock domainOnAdd(ExessionPersist ap, ExchangeBlock req, String org) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
domainitMe
public ExchangeBlock domainitMe(ExessionPersist cp, String admin, String adminserv, String domain, ExchangeBlock domainof) throws io.odysz.transact.x.TransException, SQLException - Throws:
io.odysz.transact.x.TransException
SQLException
-
domainCloseJoin
public ExchangeBlock domainCloseJoin(ExessionPersist cp, ExchangeBlock rep) throws io.odysz.transact.x.TransException, SQLException close joining session.Debug Notes:
rep.nv
is polluted, but should be safely dropped.- Parameters:
cp
-rep
-- Returns:
- reply
- Throws:
io.odysz.transact.x.TransException
SQLException
-
cleanStaleSubs
Clean any subscriptions that should been accepted by the peer in the last session, but was not accutally accepted. Such case can be the peer node rejected data when no knowledge about the synoder.- Parameters:
peer
-
-
del0subchange
protected io.odysz.transact.sql.Statement<?> del0subchange(String iffnode) throws io.odysz.transact.x.TransException Delete change log if no subscribers accept.- Parameters:
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.- Returns:
- the delete statement
- Throws:
io.odysz.transact.x.TransException
-
checkChangeCol
Check and extend columnExchangeBlock.ExchangeFlagCol
, which is for changing flag of change-logs.- Parameters:
colnames
-- Returns:
- this
-
entities
Get entity count, ofm.tbl
.- Parameters:
m
-- Returns:
- count
- Throws:
SQLException
io.odysz.transact.x.TransException
-
entitySynuids
public AnResultset entitySynuids(SyntityMeta m) throws SQLException, io.odysz.transact.x.TransException - Throws:
SQLException
io.odysz.transact.x.TransException
-
xp
-
instancontxt
public io.odysz.semantics.ISemantext instancontxt() throws io.odysz.transact.x.TransException- Throws:
io.odysz.transact.x.TransException
-