[Twisted-Python] Transparent Remote Objects

Justin Johnson justinjohnson at fastmail.fm
Fri May 16 12:34:33 MDT 2003


In your example, is VobContainer the object returned by
pb.getObjectAt(server, 8789, 30)?  And then the callRemote method ends up
invoking the remote_* methods on the service running on the other server
(the thing that inherits pb.Root)?  So I basically a class RemoteVOB that
just needs a connection to the service and it makes the remote calls for
me?

Feel free to correct my terminology if it's messed up.

Thanks.

On Fri, 16 May 2003 13:04:37 -0500, "Glyph Lefkowitz"
<glyph at twistedmatrix.com> said:
> 
> On Friday, May 16, 2003, at 10:23 AM, Justin Johnson wrote:
> 
> > Adding callbacks to Deffereds looks a little cumbersome and makes it 
> > harder to read the code.  Is there a way to make this more > transparent?
> 
> Transparency is not a goal of PB.
> 
> It does sound like you don't really need many callbacks though: your 
> example code could be something like:
> 
> o = remoteThingy.getMeAVobContainer().addCallback(gotMeAVobContainer)
> 
> class RemoteVOB:
>      def __init__(self, vc, tag, site):
>          self.vc = vc
>          self.tag = tag
>          self.site = site
> 
>      def make(self):
>          return self.vc.callRemote("makeVOB", self.tag, self.site)
>      def export(self, s):
>          return self.vc.callRemote("exportVOB", self.tag, self.site, s)
>      def import(self):
>          return self.vc.callRemote("importVOB", self.tag, self.site)
> 
> def gotMeAVobContainer(vc):
>      for tag in vobs:
>          v = RemoteVOB(vc, tag, start_site)
>          v.make()
>          for s in sites:
>              v.export(s)
>              rv = RemoteVOB(tag, s)
>              rv.import()
> 
> Does that explain anything?
> 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 




More information about the Twisted-Python mailing list