190 likes | 304 Views
Xydra Graphics. XAddress. main / phonebook / john / phone. XID. XID. XID. XID. XValue.
E N D
XAddress main/phonebook/john/phone XID XID XID XID XValue XBooleanListValue, XBooleanValue, XByteListValue, XCollectionValue<E>, XDoubleListValue, XDoubleValue, XID, XIDListValue, XidOrVariable, XIDSetValue, XIDSortedSetValue, XIntegerListValue, XIntegerValue, XListValue<E>, XLongListValue, XLongValue, XNumberListValue<T>, XNumberValue, XSetValue<E>, XStringListValue, XStringSetValue, XStringValue, main XRepository phonebook XModel john XObject phone 123-456 XField XValue XField XValue … XField XValue … XObject … XField XValue XModel XObject XField XValue
XydraandtheSemantic Web Xydrais well-suitedtostoreand manage RDF data NamedGraph Subject Property Object main XRepository phonebook XModel john XObject phone 123-456 XField XValue Semantic Web Xydra URI Xaddress (externalreferences) / XID (internalreferences) BlankNode -- LanguageTaggedLiteral -- DatatypedLiteralXydravalues (BooleanValue, LongValue, StringValue, ..) PlainLiteralStringValue
Xydraand XML main XRepository phonebook XModel john XObject phone 123-456 XField XValue <?xmlversion="1.0" encoding="UTF-8"?> <main> <phonebook> <john> <phone> <long>123-456</long> </phone> </john> </phonebook> </main> XID namingrulesensurestringscanbeusedas valid XML elementnames Values areserialised in a self-describingand extensible form
Xydra Store API These twoallowstatesynchronisationbetweenseveralrepositores Observechanges Request change Read currentstate Persistence, Access controlVersioning, Transactions, Persistenceforgroups, members, rights Computeaccessrights
Xydra Store API Serializable Event Observechange Command Request change • Repository/Model/Object/FieldSnapshot • Read currentstate • getChildren/getValue • getRevision • VersionedStore • Persistence, Versioning, Transactions, Access control • getSnapshot • executeCommand • getEventsSince • AccessRightsManager • Nestedgroups, hierarchicalrights, computeaccessrights • hasAccess • AccessRightsStore • Stores groups, members, rights • get/changeGroups • get/changeMembers • get/changeAccessDefinition
Blocking I/O Thereforethe Store API isdesignedwithasync in mind • VersionedStore • Snapshot getSnapshot( Xaddressaddress, longrev) Async I/O • AsyncVersionedStore • voidgetSnapshot( Xaddressaddress, longrev, Callback< Snapshot> ) Sync Async Async Sync Easy towrap Nonsense
Implementationsfor different Platforms • GaeStore • Persistence on GAE datastore • Parallel transactionmanagement via ChangeEntites • Snapshots via memcache/datastore • Custom accesspersistence on datastore Memory-Store Persistenceonly in memory HTML5-Store (planned) Persistence via HTML5 or Google GearsorSQLite CsvFile-Store (planned) Persistence in CSV file(s) XydraAsync Store API Command/Event/SnapshotGroup/Member/Access AppEngine (GAE) Browser/JavaScript (GWT) Desktop Java Desktop Java
For all platforms Xydra Core API Xydra Tools • Repository API • Event listener • Forwards all incomingchangesto registered eventlisteners • Familiarchangeoperations (add/removechild, get/setvalue), on theflytranslatedintocommandsto an in-memoryXydrastoreimplementation • Checks accessrightsalready on clientside • Based on a local, partial copyofaccessrightsdatabase • Undo • Byexecuting anti-commands • SynchronisationManager • synchronisestatebetween a Store and a SyncableStore XydraAsync Store API Command/Event/SnapshotGroup/Member/Access SyncableMemory-Store Persistenceonly in memory Sync via SynchronisationManager
REST API Implementsasyncpersistence API REST Async Client Java methodcallsin the same VM XML over HTTP XydraAsync Store API Command/Event/SnapshotGroup/Member/Access XydraAsync StoreImplementation REST Server
Error Handling Whatcan happen with an applicationcommandissuestotheAsync Store API? Error source OK SafeCommandFailed e.g. for a SafeCommandtherevisionnumbersdontmatchexpectations Sync CommandFailed e.g. operation on deletedentity Access Forbidden i.e. actorhasnopermissionto do this Timeout Noresponse. Network down? Server gone? Network IllegalArgument The requestfromtheclientisill-formed Client Server RuntimeError e.g. thedatabase just crashed, AppEngine ran out ofquota
Synchronisation Advanced Synchronisation: Oneclientwithseveral persistent stores • 4 localevents not yetcommitted • 3 events in syncfromstore Store 2 XModel XChangeLog Syncable 1 XModel XChangeLog • 2 localevents not yetcommitted • 4 events in syncfromstore Store 1 XModel XChangeLog • 5 events in history • Store hasnoknowledgewhosyncedwhat Syncable 2
Xydrasourcecodeprojects in SVN • xydra-gae • Code for Google AppEngine: • GaeStore • (GaeRestClient) • xydra-java • Code forplain Java • JavaRestClient • JavaFileStore • xydra-gwt • Code for Google Web Toolkit: • GwtRestClient Runs-on-GAE Runs-on-GWT Depends-on xydra-server Code sharedby REST Server implementations • xydra-core • Core API (blocking): • - Event listeners, • Store API: (async) • executeCommand • getSnapshot • Syncable Store API (blocking) • - TBD xydra-client Code sharedby REST Client implementations Runs-on-GAE Runs-on-GWT Runs-on-GAE Runs-on-GWT Runs-on-GAE
Xydra Core implementation plan Real-World Application doSomething(…, Callback ); Core API Very easy touse API Register eventlisteners TODO: Add nice API fortransactions Impl Delegatesto a SyncableStoreandmaintainsstateofthemostrecentXmodel SyncableStore API TBD: Extendsoruses Store API Callback Usedforsynchronisation Store API MemoryStore
Store Implementation Plan Interceptand check accessrights. If ok, delegate. AccessRightsManager uses Group & RightPersistence API G&R Implementation Delegatingto a Xydra Store AllowAllStoreimplemention with trivial allow-all accessrights AllowAllStoreimplemention with trivial allow-all accessrights Repository State Access Rights
AllowAll Store implementation plan ForeachXModel: ChangeLog Event 0 Event 1 Event 2 … ModelSnapshotCache Map: revNr ModelSnapshot Map: ObjectID ObjectSnapshotCache ObjectSnapshotCache Map: revNr ObjectSnapshot ObjectSnapshotCache Map: revNr ObjectSnapshot ObjectSnapshotCache Map: revNr ObjectSnapshot ObjectSnapshotCache Map: revNr ObjectSnapshot
ARM datamodelling • Design goals: • Handle ca. 1 Mio. users • Each in 10 groups • Ofwhich 5 indirect Model „actors“ objectIdfieldIdvalue groupId „hasMember“ XIDSetactors actorIdhasPasswordHashXstring Thistriggers: actorIdhasGroupsXIDSetallTransitiveGroups (actorId, hasGroups,*) isread-only enc( XID x): If null „_N“ elsex.replaceAll(„_“,“__“) // use „_.“ asseparator enc( Xaddress a):enc(a.repo)+“._“+enc(a.model)+“._“+enc(a.obj)+“._“+enc(a.field) Foreach model ‚xxx‘ in mainrepo: Model xxx objectIdfieldIdvalue actorIDenc(xaddress )+“_.“+enc(rightID) Xboolean RightIdsaredefinedtomean: READ, WRITE, ADMIN
ARM architecture grantAccess(…), denyAccess(..) createGroup(), addUserToGroup(..),… AccessWrapper GroupWrapper Model xxx Noredundancy Model „actors“ Noredundancy Access Rights Manager Repository Interpret writeoperations, In-memoryindexes (whichmight also bepersisted) ActorXaddressRight Index0 0 0 - 0 0 1 - 0 1 0 XR 0 1 1 XR 1 0 0 AR (redundant to AXR?) 1 0 1 AR (redundant to AXR?) 1 1 0 AXR 1 1 1 AXR Index Model „actors“Read-only Persistent Model „actors“ Persistent Model „xxx“
Xydra Data Modelling Clear model vs. Query efficienye.g. use a numberoffieldIdsas a fast setof XIDs Nice OO API vs. Efficientbatchoperations ThatswhywemadetheXydraStore API so ugly Desired: A fast wayto check iftherehadbeen ANY changes in thedatastore.