[aerogear-dev] how about this API for sync?

Summers Pittman supittma at redhat.com
Fri Dec 6 12:16:21 EST 2013


One of the questions I have about this API is how are push events 
handled with sync or is this just an offline cache?

IE how is data sent down to the client when things change (or is that 
not for this use case)

On Wed 04 Dec 2013 04:09:30 AM EST, Erik Jan de Wit wrote:
> Just to get some discussions going and have something to talk about
> I’ve drafted some API, so what do you think?
>
> // [option 1 fully automatic we create a pipe and add the posibilty to
> add a store for failover and sync just happens at on- and offline events]
> // and because merging can fail users can add a conflict handlers
> Builder builder =
> Builder.createPipe(pipeConfig).addFailoverStore(storeConfig);
> Pipe<Car> pipe = builder.pipe(Car.class);
> pipe.addConfictHandler(new ConflictHandler() {
> public void conflict(Field originalField, Field newField) {
> // user interaction
> }
> });
> // [option 2 explicit let the user specify when to sync and what to sync]
> SyncedPipe pipe = SyncPipeBuilder.build(options); // SyncPipe Store
> and Pipe togheter
> // or we only use a store to sync and tell the sync manager where to
> sync to
> SyncManager syncManager = new SyncManger();
> syncManger.filter(readFilter); // maybe we don't want to sync all data
> but just some part
> syncManager.addConnectionHandler(new ConnectionHandler() {
> public void onConnection() {
> syncManger.sync(pipe);
> }
> });
> syncManger.addConfictHandler(new ConflictHandler() {
> public void conflict(Field original, Field new) {
> // user interaction
> }
> });
>
> Cheers,
> Erik Jan
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev




More information about the aerogear-dev mailing list