Questions about the Backend Interface

Dave Peticolas dave@krondo.com
Tue, 06 Mar 2001 13:57:20 -0800


 writes:
> It's been rumoured that Derek Atkins said:
> > > > > 	2) There appears to be no way for the backend to trigger an
> > > > >            event to the engine/GUI if something happens.  For example
> ,
> > > > >            I'd like the backend (server) to signal to the engine
> > > > >            (client) that some information changed, or perhaps even
> > > > >            pushing the changed information.
> > > 
> > > Terminology, as used in gnucash:
> > > -- backend: the part of the client that knows how to talk to servers.
> > > -- engine: the part of the client that provides a data cache and a 
> > >    uniform API to the GUI.
> > > 
> > > To answer your question: in practice, the backend can 'push' new data 
> > > into the engine, because it has access to all the pointers & structures. 
> > 
> > Hrm.  Then perhaps the best way to 'trigger' an event is to have the
> > server push the new data to the backend, and the backend can then push
> > it into the engine and notify the engine that the data has changed?
> 
> Yes.  Although the last step can be skipped: the backend itself
> can trigger the event mechanism to tell the gui that something changed 
> (using suspend_events and resume_events in gnc-event.c, I beleive).

We must be careful here. Presumably the Backend is going to receive
information that the engine needs to be updated by some out-of-band
mechanism like a signal. Right now, the Backend must not mess with
the engine outside of the normal flow of control. Everything outside
the engine has been written under the assumption that the engine
cannot change outside of the current thread of control. Relaxing
that assumption would require a significant amount of work.

I think it would be much easier if the Backend informed the engine
that it needs to be synchronized with the external source, and then
the GUI event loop would poll the engine and, if needed, tell it to
synchronize with the external source.

dave