A CouchDB replication endpoint in PHP


Formal Metadata

A CouchDB replication endpoint in PHP
Title of Series
Part Number
Number of Parts
Nordmann, Kore
CC Attribution - NonCommercial 2.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Free and Open Source software Conference (FrOSCon) e.V.
Release Date

Content Metadata

Subject Area
A CouchDB replication endpoint in PHP This talk shows how I implemented a replication endpoint for the CouchDB replication protocol in PHP. This makes it possible to use about any backend as a synchronization point for Offline-First HTML5 applications powered by tools like PouchDB or TouchDB. You will also be able to replicate a CouchDB database into a MySQL database or vice-versa. The growing amount of endpoints for this protocol in different languages and environments suggests that the CouchDB replication protocol might evolve as a standard for eventual consistent multi-master replication. ······························ Speaker: Kore Nordmann Event: FrOSCon 2014 by the Free and Open Source Software Conference (FrOSCon) e.V.
Free and Open Source Software Conference
Trail Freeware Open source Replication (computing) Software protection dongle Food energy Replication (computing) Number
Logical constant Android (robot) Database transaction Parsing State of matter INTEGRAL Code View (database) Scientific modelling Insertion loss Client (computing) Function (mathematics) Replication (computing) Likelihood function Facebook Video game Mathematics Single-precision floating-point format Diagram Physical system Adventure game Spacetime Feedback Open source Basis (linear algebra) Electronic mailing list Point cloud Bit Instance (computer science) Functional (mathematics) Sequence Replication (computing) Connected space Message passing Network topology Vector space Hash function Data storage device CouchDB Phase transition output Right angle Pattern language Quicksort Asynchronous Transfer Mode Point (geometry) Ocean current Slide rule Server (computing) Implementation Mobile app Service (economics) Open source Motion capture Auto mechanic Point cloud Web browser Theory Twitter Number Revision control Internetworking Term (mathematics) Database Communications protocol Subtraction Traffic reporting Computer architecture Form (programming) Standard deviation Myspace Scaling (geometry) Server (computing) Consistency Forcing (mathematics) Projective plane Planning Client (computing) Set (mathematics) Multilateration Cartesian coordinate system Single-precision floating-point format Particle system Subject indexing Word Mixed reality Vertex (graph theory) Speech synthesis Film editing Communications protocol
Randomization State of matter Code Replication (computing) Mereology Formal language Dependent and independent variables Statistics Row (database) Multiplication Computer font Email Algorithm Software developer Open source Replication (computing) Flow separation Category of being Software testing Data management Data type Row (database) Point (geometry) Random number Implementation Server (computing) Overhead (computing) Observational study Consistency Disintegration Web browser Host Identity Protocol 2 (number) Revision control Punched tape Latent heat Database String (computer science) Divisor Implementation Analytic continuation Proxy server Associative property Metropolitan area network Multiplication Set (mathematics) Cartesian coordinate system Particle system Integrated development environment Computer network Dependent and independent variables Communications protocol Library (computing)
INTEGRAL System administrator Price index Insertion loss Replication (computing) Food energy Usability Medical imaging Video game Logic Repository (publishing) Electronic visual display Software framework Information Error message Stability theory Social class Service (economics) Algorithm File format Software developer Bit Front and back ends Process (computing) Database Repository (publishing) Data storage device Software framework Software testing Row (database) Point (geometry) Read-only memory Trail Implementation Game controller Presentation of a group Algorithm Theory Revision control Read-only memory Database Software testing Scripting language Implementation Absolute value Subtraction Metropolitan area network Game controller Home page Standard deviation Cellular automaton Cartesian coordinate system Frame problem Particle system Logic Dependent and independent variables Quantum logic Object (grammar) Units of measurement Communications protocol Window Library (computing)
Word Vector space Database Counting Website Software testing Data structure Replication (computing) System call Field (computer science)
Server (computing) Open source Presentation of a group Chemical equation Content (media) Bit Function (mathematics) Replication (computing) Cartesian coordinate system Tracing (software) Föderiertes Datenbanksystem Arithmetic mean Database Software testing
Point (geometry) Collaborationism Implementation Spacetime Information State of matter Replication (computing) Sequence Table (information) Number Revision control Data storage device Database Selectivity (electronic) Office suite Object (grammar) Thermal conductivity
Revision control Point (geometry) Default (computer science) Statistics Information State of matter Database Interface (computing) Replication (computing) Sphere Föderiertes Datenbanksystem
Implementation Information Divisor Computer file File format Direction (geometry) Content (media) Counting Replication (computing) Revision control Term (mathematics) Database MiniDisc Family Resultant
Revision control Point (geometry) Slide rule Algorithm Open source Inheritance (object-oriented programming) Database Direction (geometry) Sheaf (mathematics) Resonance Replication (computing) Local ring
Context awareness Group action Code State of matter Archaeological field survey Replication (computing) Web 2.0 Response time (technology) Mathematics Synchronization Extension (kinesiology) Intelligent Network Feedback Moment (mathematics) Graph coloring Database Internet service provider Telecommunication Website Quicksort Thermal conductivity Resultant Point (geometry) Laptop Server (computing) Implementation Mobile app Consistency Real number Mobile Web Auto mechanic Event horizon Computer Wave packet Revision control Database Game theory Mobile Web Run time (program lifecycle phase) Mobile app Default (computer science) Multiplication Uniqueness quantification Consistency Set (mathematics) Vertex (graph theory) Backup Dependent and independent variables Near-ring
Point (geometry) Slide rule Implementation Server (computing) Cone penetration test Open source Code Source code Client (computing) Replication (computing) Mereology Fluid statics Facebook Linker (computing) Database Operator (mathematics) Selectivity (electronic) Functional programming Proxy server Subtraction Traffic reporting Stability theory Area Focus (optics) Algorithm Software developer Projective plane Feedback Line code Bit Set (mathematics) Line (geometry) Cartesian coordinate system Message passing Commutator Repository (publishing) Speech synthesis Pattern language Communications protocol Reading (process) Matching (graph theory) Reverse engineering
morning everyone and welcome to the 1st day at frost on and to the PhD conference mirror holiday here in this number 6 and presents me talking about cultural replication . php and the 1st opposite to what I want to say 1 thing we have 1 the talk in that's 16 circular thing which got canceled due to sickness we got got it replaced already this to new talk because it was to cold for a PhD and arguing about what went on and that's 1745 I think it's PHP energy even Steckle occasionally on the future so that if you don't see that is going get we got to replace thoughts so and again welcome to the PHP track and let me start with the country repetition and what so this sounds can insane I guess to you to let me start why I would do something like this so we all know
this smartphones right who doesn't have a slot for you all to almost everybody got this last fall and the nice thing about this month from this that you have access to a number of that which you can use for a lot of different things like Twitter or Facebook and for example this is scheduled for the 1st time scale you will get you life updates of sources give your plants and stuff like this most of those that except for very few rare cases depend on some kind of Internet connection they will access some kind of sort of Twitter for example will of course affect of tweets Facebook that will of course axis of the Facebook service to meet new messages or whatever you using personal for and then when we're using those last I experience that quite often because of the from the point of view the world and in foreign countries where do I do not have data access so problems with the connection usually lead to some nonfunctional labs so basically can use my phone when I in some other country for example it got better and better service and you a you European data plants and stuff like that but it still sucks to be in different countries thought I was in Switzerland in May I think which is not included in the European Data plans and again my phone was basically right because you have no Internet connection it starts so do most apps nowadays are still mostly unusable developed an internet connection in the basic education sometimes doesn't really work so what can do about that there are some technologies which forces problem really really nicely I will explain how this works in a bit and if you're using culture to be on the server and for example approach to be on a client you can have venture consistent data storage so you can use application on your phone like it would be online but it is not and solids applications send back with the server magic only at some point in time so it will be eventually it will be consistent again so it's a false friend and run it through the trees condescending not even to call the standard so there's a force from that of the so we will have a definite consistent state from the time and this already works and it's all in 1 thing which it's nice to use and stuff like that I won't talk about this well I was writing a beautifully wrapped in front of culture which speaks the same API discussion us to make it possible to synchronize from already using 1 of those implementations of the cutting particle with the PHP feedback and the thing why it's there is that I get back to the 2nd and 1 thing which you can do with that it's actually replacing the culture being the vector using and technology and patterns that you have there and that you you do not need to rely on a constant custody is a really nice database and do not advocate against using culture but I wanted to be able to replace that fall some reasonably get to that in a 2nd so this is what the talk is about and this is actually the case I have from that which I want to be offline capable of flying 1st want to be able to use of an offline stage I want to synchronize it in the same ventricles that's a state with some back application and effectively applications and on I developed mostly Peachtree is of course written in PHP and instances of PHP tracking mix of support more than year so use cases no 1st client implementations of implementation to constant replication protocols already implemented by for quite some Charles clients and you I will talk about in a little more depth about all those so for example this is fine culture already mentioned by the local which is a full not almost full coach implementation integrals of which can work with uh index to be and focused on so you have a cult to be modulated visually in use your browser can just store data output data and get data out Randall's MapReduce functions stuff like that and this approach to be in your browser can synchronise back material culture and can replicate back and forth with the culture 14 different states where it doesn't really is a customer replication particles but almost uses that ants and it makes it really really simple to develop offline 1st became there will be a talk later today what we have on on the latest slide and so if you want to learn more about that you should there the rest of the rich implements and it's implemented this natively for Android for I and I'm not sure about the current state of things is only an IOS implementation of words is also in the implementation of project protocol you can synchronize some some Ioser occasionally succumbs to the server there's some sort of implementation of course this Apache County this cloud and partially server that applied a small Python over and the replicators with a bunch of them like replicate protocol itself can of course also replicated stuff and again rectified and some of the things to which might or might not be entirely work so we already have a bunch of different implementations so we could use those implementations of the state already on the front and on the back so again why do I want to do with 1 idea could be you have an existing PHP applications and want to put a front on the speech we had occasion to write a mobile app was supposed to be touching on something that that and makes Peachtree application of likelihood so you can replicate the data in the mobile app against from and back to the to the speech we have what we could also could do is replicate MySpace database into into account he always word of replicate from a culture being into almost go database and any other databases might you are able to connect with PHP the thing I want to use this for all life in she wrote the stuff is I have come to the back and and it could just replicated its culture to be but I want to and that the data which is in the culture be based on some current circumstances like some you scope and stuff like that like that I want to modify the data and parses only after back to the client so needs some modifications stack this is why I implemented system this Peachtree culture be replication and point to note data from cut to the modified and replicated back to the client which will something culture all already is using approach so this is the idea we want some of capable client it should
5 months to be able to replicate data from 1 back from all back and intervention cumbersome state the interesting thing is how does it work or at least this is interesting to me so I know will get a little bit more in depth in regarding protocols were distributed storages I thought with a very very simple case and to show how this kind of adventure consistent replication can work it's very simple if you have a single last case so we have 1 thing that's also true where all data is primarily written and we have a bunch of clients which just read data and do not write data on the slide sets of known would you must set up basically you could consider this a master-slave setup using the common database terms this is a simple case of eventual consistent replication using this in quite some setups where we distribute data across the several nodes this is really the resistant so if you have the distributed system like micro-services like a service oriented architecture architecture this kind of protocol is a very simple thing to use to distribute the thing so what do we do in this case I introduced at the cross is a good basis for understanding the cost the replication fork so what the end year we have some kind of replicators which has to ensure the data is replicated across all modes this is sort of true which is some kind of database and there's a client wants to displace the code most their replication starts this asking the client was the last revision of data useful so what is the last thing can you will return knowledge cases you did not see any data or some kind of revision hash and just something we need to remember about those hedges but I get to back to that in a 2nd after we just out there true and lasting peace give me all updates since this kind of revision you can limit the number of updates if you like but that's basically how this will return and a bunch of updates to together with the revision of each update and then the cost of those updates to all clients this kind of rights is those updates of list but you need to remember 2 things to make this work in the same way 1st the revisions on our theory truth all master must increments strictly motivation to be able to have a you find sorting of culturally if you mix up the oral updates its depending on the data we're replicating bad things can happen like data loss and stuff like that so if I and there's a after B 8 must have a higher revisions the id name must not be the same because otherwise it will not work in a 2nd and we are implemented this mechanism in this work those with some of our customers and and at some point in the past 2 all met some updates for tried to march updates and try to throw away old updates this is really really dangerous you should be really careful with that so that looks like something like that and or be really really smart about that the other thing is on our client we must have some or in the best case here some it's compatible storage use this small transactions or something like that because it's not update phase of the climate like I cannot start this update you must not right so the revision as sport only I should only a revision like I received it up if I really were able to store just discovered that it is also really important otherwise declined to talk later revision story but did not reach which out they get so we have those are the only 2 things which you need to remember our income we are committing something like that if you do this you already have eventually consistent system which works in a really really saying and stable way you risk and that connection losses and stuff like that capture the users and and once version of this because we got a problem that we don't have the answer but in which you must so let's take a look at that but it's still fairly simple culture now acts as a source and the target of the the replication and also acts as a replicator as mentioned before we have different implementations for each of those nodes so let's talk about that again we are the 1st start by asking for a target what is your replication status regarding this concrete source so it will contain the last update sequence which is similar to the last revision unmentionables like before and if I replicating between let's say 10 different nodes in each directional what and how I Each database will start this replication status for each of the other then it's is the same as before we get the change things that the since the last update from all of all there are some interesting things about this country changes which really for example as a same change he can be requested in a continuous way like using long for example to receive all updates often often after which is really nothing follows uh which is a really nice thing for a lot of different things like just like in some back and services which processes all data which pass the country and stuff like that this is already really nice think use but it's also used for this replication by the replicate and now it gets a little bit more complicated than see this more space left here than in our single source of true example and we receive a revision of this form the what can happen here the tensions that never multi-master replication and for example you can different nodes which we replicate each against each other so at the time target might already have received some revisions of some documents since the last revision so the replicator ask OK I got this bunch of documents with this model provisions which Richland you see here and this this is referred by the time of the target now report on tendencies is this this but I already got those mostly this is what the target reports and then the replicated the rest found some book on the source of the scale of the documents which is targeted not receive yet and passes on those documents to the park which are omitted here in the diagram
is that the replication status after the replication has been finished is stored on the source and on the top this is a simplified version of how culture replication works what we got with this this invention comes would you must replication and I did not mention
that yet all so all this implementation we saw here is done while http is a practical this is disturbing
and the nice thing it's disturbing because at least my 1st association is when I heard you a database replicates it's data over HTTP I think the sounds from inefficient it should be has a huge overhead and it seems just overall on the on the other hand HEP is a protocol which you can total tunnel through every corporate network and which of across all browsers understand this is by counting the culture you can just replicate should every browser implements that it should be like obviously and so on culture can just say culture OK please replicate and is just also just HDP calls the last thing again about culture using a T P As a particle is that we can reuse all FIL http infrastructure that like Midwest catching proxies like a little better themselves like as as proxies and stuff like that so this is also nice thing about culture you the HDP is a protocol and another nice thing about this is every language are every development of 1 and of course speaks should in some way this and they should be trying to create everywhere so every development environment k you can easily connects to culture and to the replication particle of course so this is a part of the Commission's regarding the protocol or stuff yes yeah the question is what triggers the replication and you basically so it will show a replication replication come later and it's just post to some your replicate and the replication will stop there are 2 types of replication culture 110 replication with just the current of the database is replicated to another 1 and there's continuous replication year at the flat continuous troops and would just replicate as long as it works and when it does not work in the hall and continue afterwards so there's continues application which is a common type of replicate you would use with other databases and it's also time replication if implemented and browser for example using punch be you try to replicate basically every 10 minutes or every 20 seconds whatever you like and sometimes it will work sometimes it will look and every time it will work you are guaranteed to receive a consistent state or to end up in a consistent state was other question otherwise I will know you was implementation details so you might want to add another question about the protocol it's really get into code OK let's say you ask for it so I wanted to write the at that future and for a culture replication the question now is the particle is not really a document and this is a bad thing multiple because it's not really documented yet there some this documentation evolving regarding that not all algorithms are implemented and documented and stuff like that so I could not this again some kind of specifications so only and you will next week or a really a real culture the replication and out against my PhD and points so the 2 I used small man in the middle which I can just start and say OK but an HTTP proxy to that server and record everything on everything and then I I pointed out in the middle of to my country server and say culture is tied to a culture these replicates to this property that it recorded everything that I told the country please replicate from this property and recorded this again I developed a set of scenarios and recall all those scenarios and had yeah had several examples of culture the replication implementations the next step I obviously did was replaying those stance against my own implementation against my own PHP and end point since the management of users teamwork strings to damsels finds and anybody hurdles I didn't yourselves before it tries to be a binary save Jason baby by the data developed by the JAB so and of course there's some PHP library very rich uh problems those things so I could just read them but it's something responses all requests all of it and put it into my and point so this was fairly simple and there are some things you need to remember rendering such things for example there are a lot of random ideas like the revisions or some days in the HTTP headers and stuff like that you must replace those of course because the dates and the date of replication will not match the dates when I replace all saying so we will replace some had also I removed from and stuff like that and after I just fix the failures I made every retailer and with and the nice thing about that with I started with a really really simple case like I created 1 document all the countries among revision and said replicates that it's in really trivial case they got that working and then I another version I edit a conflict and resource conflict and stuff like that to make it more complex and more complex and while doing that I of course state quite some understanding of succumbed to be eradication protocol and was able to reflect on my code i've rolled for the 1st and respected and recycling in a better state so I ended up with something which is fairly understandable code which solves all those problems the thing I wanted and wanting where did this study is to document the cost the replication fork I want to
start there some other people who didn't do room will be the same as a Python back into also try to document although the I which I will be here and I want to contribute to that and document holders replication particle works and this is 1 main thing I want to do with because they contribute to the replication protocol is not implemented in multiple places it's very very same thing to do you have a lot of implementations and lastly short documents such a particle of course and the 2 lanes to when the middle down for example to record and replay achieve the track traffic which is really nice images of telling us to to do that and I wrote to his replay there amid it non recordings and replacing dates and ideas and stuff like that in certain requests and responses I expected that into a small library which is that you can find it causes addressed and if you want to use this for example for testing your application of stuff like that good because of outcome is always and this just a small library to make this replaying of stuff is there to those of course just integration tests I've put in an HTTP request and ensure that the outcome is what kind you expects what I will need to write this for example test for some of the more advanced algorithms the and I mentioned in the vertical all of you that I have to do some revision and this is a little bit more complex which you will not be able to test entirely using those integration test my would playing a GP track that will need to write down tests for such things and those are not written yet because it's all very much in development right now and it's not stable at all the guys on stated but I will write in test for the more complex algorithms in the if you have mentioned only already relative to raise your hand you try to answer every question why the talk what we can also have like 15 minutes at the end of the book where you can add to our questions and discuss stuff I talked about and some things like that but don't hesitate adjustments in the implementation of uses Symphony 2 as a GP framework for me it's the most or you know how to phrase that it's not divorced which it should be from the pitch people right now you might even say it's the best 1 to me the hazards false so we can use that use that as base because it did did not want to write another GP framework so I'm using the HEP comes from the need to pass in HEP request and provide you with the correct rest objects and creator response objects and stuff like that and z actual logic of the replication is all implemented in absolute frame agnostic control so they do not they do not know nothing about something to so you can put in energy difference wanted from of the actual replication of it because I don't want to be to overcome be replication and Quantum Logic of a ball to some concrete PHP framework so if you want to integrate that in your page that you should be fine did not test that yet but you should be fine and then there is some kind of a repository the classes currently stored cold storage which has the job of actually storing all the stuff so you could say it's a repository and the only repository I actively tested that is in memory repository as mentioned and reclaimed in tests all the HTTP request against 1 endpoint and format has the fastest thing to use of course is a very simple in-memory-implementation old it has just stopped and PHP error this of course unusable in any real application for this being I road and thus the cell they quickly I had my skyline points so I would the that later so where I can replicate the culture he said because yet into a much databases was fairly easy to write and it took me like 1 or 2 also something like that so that you can act in theory basically any storage or any back and you want and what not to realize that the stability of the API of class because yeah so this is under development and I think I did there can also be found under on the time of course it's OK agency culturally and . 4 you'll find that very few difficulties in front of stuff like that and so if you want to check out want to check it out want to play with it just go there and so clone it and try to so no I'm getting to the life you apart per if there aren't any questions left if you have any questions about the life you don't hesitate to ask so let's see I have a small problem the work you cannot see the stoppage of all the leftmost side which is slightly annoying but and yeah I hope it will still
work so 1st all yes it's annoying because z presentation window is set to topmost display and the loss of everything fax itself or something of that so 1st I started my contraband point I can quickly show it's a very very simple script which we got here and knowledge innocent you don't in expiatory is very simple standard symphony stuff just a great man and point and say and point 1 which uh DosSemRequest pollen and stuff like that it's is really really really simple so that me start some and I receptors the mice get database which is used to store documents so we can we create all this kind of stuff so the next thing I do is using the couch to be administration back and which is delivered together was country
to create a new database let's call it soft and now we are creating documents in the
database so for example lot let's start with document test 1 and the end of the year to year hello word constantly documents on about any adjacent structure so I can put it whenever I want to and so let's say this document yeah assesses document so we can see this is again NASA that's missing there we can add another documents and let's call it frost called and editing the field you're 2014 for example so we have that very simple document which contains a year of the conference call so we now have a simple database which contains just 2 documents and this data is and now want to replicate to my culture the replication count be is absolutely trivial the common doesn't look vector trivia but I got I'm going to explain that so what we have here except for the missing problem left site is a culture
replication I want to start I just posted to the euro this is universal culturally most of the were found a 4 I call posted documented understood replicate URL and then I just say culturally OK the source is my testing here should change that source because the cultivation is adjusted source and the target is my PhD server and I called the virtual database master this is everything you need to do to execute a cultural replication I should pass the content application Jason there to tell country OK this is jason Jason body were receiving here so let me quickly changed that to sort and yet the output I piped into adjacent pretty to make them look a little bit more beautiful and now we should see a replication actually the nice thing is worked because otherwise you would see some strange Uhlenbeck traces of bad thing about culture if you happen to run into a narrowed always get I mean balance vectorises it doesn't look nice and it's hard to understand what the what we can see here what you can see here is the most important thing that we try to most and then have I hope you get is
the last of working for the other presenters later so what we see here is OK true this is a nice thing and we can see some details about the replication like not written to the start and end time and stuff like that so we see the replication works and know that smoking is really the case I have this database
called coach and how can you can again don't you again don't see everything so is that leftmost can move further to the left good so let's
try that so I my skull I access the database culture directly should so I have a few tables in here space there and which is document document updated revision interesting kind of courses documentation where all documents of so just do select asterisk from document and what we can see here is I had this and point to get out so it's not the most beautiful thing you can do but we can see here is the the testament convulsive of that I decided to use the collaboration it most 1st refusal of human tragedy by now you have a really revisions were the 1st number is an incremental number so once for personal and everything after the matches the SH 1 has of the actual document and then the document just draw Peachtree serialized Russian the object so it is probably not what you want to do in real implementation of a country the end point but for is the just works so this is a document document updates just draw some up information about the sequence numbers and stuff like that and the revisions stores the revisions database table stores the revision state status of each replication so this is the simplest case which already works what I can show now is for example next year you might have an update to office conduction of
light it's the year 2015 I saves a document and we start the replication executing the same coming again just say state replicate again and I hope for hopefully it works again looks like so I can go into my database selects again arising from our database and what we see here is the 2nd revision of now isn't all that hemisphere in the frontal and here's the 2nd revision question also shown on coaching have an http interface so replication and point of course also has an http interface but I can do now is accessing my
endpoint no I called a virtual database must and what comes to be delivered by default is some kind of statistical information at
colleges way about database the most important thing is we see the document count here it's too and most of which is in your it's not really relevant for replicating so in my personal implemented and I just didn't you like disk size data size I just don't care and it doesn't really make sense for my student of assorted reversing of 0 in their replication of care about it so I don't care about that yet I might add that information they what we can also do of course is requesting the 1st come documents what is return now is of course adjacent reconstruction results in my brother just nicely formats this kind of stuff so what you can see here is that you're implementing the ID yeah the idea the revision of the document and some additional information this information culture will not return that information and the course is only requested and results such a flat file in my implementation I the only thing I need to do is this fact factor is always passed by the replicator so I do not care about the slack yet and just in terms of information always so z from couched itself for the same document should look fairly similar similar so I just change your to accounting for intercultural database and return should be similar except it does not send a proper hand up here I see this as 1 magician collecting doesn't detectors as and just prevents also depends great but it's the same content from culturally and from my replication put so this is a simple thing about being and what i can also show is replication of the other direction so what I can do
now is creating a new database let's call it targets and and he's a
database antiphonal and no started replication again to replicate out of my PhD and point into this new approach so the source now is locals smash must stance and the target now is my culture data restrictions on the following 8 5 9 8 5 and I called the database target and I replicated to the target database what we see here this is really the replicated revisions and if I'm now going to the target database Section C 2 documents here in the resonance we have here so replication in
both directions brought from a cultural point and what I call always call off my PhD that end what does not work yet is replicating attachments and there's some slides problem have understanding parents revisions if in case of some kind of conflict which I supposed to return I do not match the codon culture algorithm entirely there yet so it's might not behave entirely like your
culture some color uh conflict states of your database so context might cure for example and I replicates 1 document like let's say some of the key text and having on 1 note replicated to another node so goes most nodes are offline for a 2nd or for a while and I and it's this concrete document both nodes in a different way when an extensive replication next time of course the replicator will detect some kind of conflict because you have the document has been updated in different ways and both nodes and the replicator by default does not know how to handle the imagine somebody change subparagraph documents a computer is it's not possible for a computer to know how to nationals to paragraph changes so what culture does here is an it puts both versions of the documents on each node not this document as conflict and select the exactly same version of this document and every node so you have a consistent state again on every node 1 of the most documents released on every node and consistent the state introduction to reflect as conflict so you can go as a user and said look at all documents which are in conflict state and resources conflict manually programmaticaly what assumes you and this and the conduction for example where paragraph should this change in 2 different ways you probably want to solve manually with some in a lot of other cases you you it's easy to resolve those conflicts and provide for them at the correct so if you like it can also jump into the code but I will use that to be a quarter of an hour of question time we got left that's you and or in in about 5 minutes so let me summarize what we saw here the I showed you know I think that also 1st event consist of a Chairman of 5 May but that's on the future being sorry for the mother bingo but I really think this is the case so I I do not believe in native apps I think it should have 5 that's what you want to go what I think is that you should build every time your asked on your mobile websites many near real websites this offline capability in mind and maybe even start with so I'm really pissed when for example in training I'm using my aunt and just dropped with about everything can you use navigation more stuff like that because I'm currently offline across the training them on the way to 200 for example in a moment of London in the training set and really really not that that can continue to work well in the 2nd I'm also it's really important for example using something that who will not did not work offline for while I think by now it rots somehow but you could use just had to stop typing because you offline for 2nd this is really really annoying so please if you about mobile apps keep that in mind I want to continue working with my when it's on the other hand synchronization of data between the state you modified my offline and the state of the server can be really really complex at introduce like 3 years ago something some kind of backup you might remember the name of the apple stuff to synchronize the survey data server sorry I can't get the items yeah exactly it doesn't really work because it doesn't know about this kind of revision of this kind of event condescending and you have to hand entirely yourself if you want to use if you go there right in the event and it unifies offline use some kind of ventricles mechanisms and to make them even use a cultural replication OK this is for me this is a key feature of how to and the unique selling point for culture is this invention comes multi-master replication the this is a nice thing about how to be a thing as it's just below so you might want to keep that in mind to make them easier trying what is an approach to make it really really simple to develop such offline at it uses culture in the back and you don't need to care about that but just if you want to put a title right those offline 1st that's just use so he doesn't talk it's called could be continued of the and missing the bitingly acts as the court of prosody and C 117 it's back there and you might want to listen to the talk if you care about writing about of the 1st mobile apps and yeah and you take that as a child those custom implementation like peach feedback and I just showed I want to use that to add some additional salt to the daytime replicate out of culture and so results implementation and you sort of a bunch of became a bunch of implementations already available in Python Johnston and stuff like that you might use those 2 to do something additional is the data and do some fun things like it already works as a plain county and stuff like we are proud to be you can already right off for us and mobile apps which will just work with the data will be consistent over multiple mobile phones among multiple notebooks on multiple servers and stuff like that this is not only important by the way for the case where you have more electrons in service but also important for if you have a several distributed across different continents you cannot have your it's not saying to have friends actions across would become his across the runtime of the because the responses justice too long it takes too long for saying response time on the web so you will need a venture consistency in there and you might have heard about the baseball and stuff like that so that's basically what we now have time for about 15
minutes or less if you want to leave earlier for these 4 questions
for discussions I can't even jumped into the code if you care about that and harassing phone line as I mentioned 2 slides will be online at some point you will find that I will to intervals of slides and my wouldn't is on your you can read that way it's Caribbean and so I will only on all the links to the repositories on that so you can jump into the code your set and look at it but I can also show you something if you have questions so any questions yes no or the we don't want to do with the use of a and so the question is what is the set of Cambodia what would be the set up a you that case where you have a certain data just certain uses and the answer let me answer with the 3 points 1st County encounter we usually use 1 database the user countries are easily about with 10 all of the countries so you can use 1 database for each user the current next question is then I will have documents which will which will be synchronized between different you like for example the facebook in case I post a message on the wall of another user but you can use for that is again replication and country report supports fit replication so a replication of knew the database I into the database be which just replicates matches messages which are intended for of this just represent replication filter and we also just like like this you the only thing you need to do is passed on to this for the use the 2nd answer is who this morning there when see this aspect of culture including you rejust 1st and every user gets its own database and then in the early there is something very very very simply does the API and the role of a can say shared this document and we will take care of this replication stuff in the back of the will just work and tumultus stability of yet for Woody because at least 3 months ago it was still under development in might already work you can ask all and and the later in the in that we talk about this but it's going to just working points phd my phd that and you can use anything you want here for example you could pass and uh it should be all had was a username and select database based on that or patterns to the minus queries or whatever you want them speech feedback on that it works just like it worked individually application can use whatever you want without question will go along with it makes it easy areas of the thank yes please use you this is a constant for this is what you get is higher than that of the 1st yeah there remains intact cone you I just had this 1 for use cases yes and student and so the point is and this happens to me again and again and again and I have this open source project in mind I want to do I did that lot different predicament implement and then saying OK I need that I should do this in the right way and then it starts to consume time and because need this country protocol I implemented this HTTP proxy replaced stuff which also did the right man for that I had to you implement something else so this is project in the a B C D E static and I'm back to be right now because I want to complete contraband point and then I want to come to the continuous start working on a project and and yet this is time consuming but I tried to do it the right way and try to contribute documentation and stuff like that but again this is even more time consuming than girls so yes I implemented hopefully some most of it yet but not everything my point doesn't support long polling for example yet for also changes the but I probably would have you have to read it and to you that she was and the question is if I had to revert and in that I had to reverse engineer most of its there's some documentation that documentation focus is different than what I needed to the documentation focus right now is on how to implement the replicator and on how to implement a client and what I did was implementing yet something somebody should just slightly different and something clientage I say clientages operation because in cultural everything is a client and server as a master all the time but so the commutation had a different focus on some of the algorithms like the the different and stuff like that slot document again and I had to revert I still have to reverse-engineer parts of that yes it's a lot of reverse engineering problem is a line code is I think the most readable code ever I really am similar was a bunch of functional languages but is a different kind of thing and code is obvious health so it's really hard to read and understand those algorithms from reading the culture because which is of course open source that's an Apache project that yes so it's a bit movement of source code reading and stuff like that other questions 3 to 1 then thank you answers you next time on the pitch you


  858 ms - page object


AV-Portal 3.9.1 (0da88e96ae8dbbf323d1005dc12c7aa41dfc5a31)