<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ipc on Roberto Selbach</title><link>https://rselbach.com/tags/ipc/</link><description>Recent content in Ipc on Roberto Selbach</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Tue, 14 Nov 2006 20:09:00 +0000</lastBuildDate><atom:link href="https://rselbach.com/tags/ipc/index.xml" rel="self" type="application/rss+xml"/><item><title>D-Bus 1.0 and Boring Interfaces</title><link>https://rselbach.com/dbus-1-0-and-boring-interfaces/</link><pubDate>Tue, 14 Nov 2006 20:09:00 +0000</pubDate><guid>https://rselbach.com/dbus-1-0-and-boring-interfaces/</guid><description>&lt;p&gt;D-Bus 1.0 arrived last week, so I replaced a small experimental IPC call today and discovered that my &amp;ldquo;simple&amp;rdquo; interface exposed an internal class name, an internal enum, and optimism about call order.&lt;/p&gt;
&lt;p&gt;The wire has four names worth keeping straight: a bus name identifies the service, an object path identifies an object, an interface groups methods and signals, and a member names the operation. Treating all four as one application string works until the service grows a second object.&lt;/p&gt;
&lt;p&gt;For a thumbnail service I settled on deliberately plain values:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;service: org.kde.Thumbnailer
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;path: /Thumbnailer
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;interface: org.kde.Thumbnailer
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;method: Queue(string url, int width, int height)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;signal: Ready(string url, string file)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The exact names may change; the useful constraint is that callers do not need my C++ headers or object layout. Strings and integers cross the process boundary predictably. Errors should cross as named errors, not magic negative dimensions.&lt;/p&gt;
&lt;p&gt;A method call can be synchronous, but that does not make blocking the GUI wise. Thumbnail generation may involve disk access or a broken file. The caller should queue work and react to completion, while also handling service disappearance. Processes are allowed to crash independently; that is among their principal features.&lt;/p&gt;
&lt;p&gt;I prefer small, boring bus interfaces with operations phrased in domain terms. They are easier to inspect and less likely to preserve an accidental implementation forever. The caveat is round-trip cost and versioning. Turning every getter into a remote call creates slow, chatty code, and changing a published signature later can break clients I do not control.&lt;/p&gt;
&lt;p&gt;Introspection is useful during development, but readable metadata does not replace a written contract. Callers still need to know whether requests are idempotent, which errors are expected, and how long returned object paths remain valid.&lt;/p&gt;
&lt;p&gt;For KDE 4 porting, D-Bus 1.0 gives us a stable point to build against, not permission to export every object. I am writing the interface first, testing it from a separate process, and only then attaching the current implementation. If the test needs a private header, the boundary has failed.&lt;/p&gt;
&lt;p&gt;Today&amp;rsquo;s service returns one error instead of hanging when the source file vanishes. This is less exciting than transparent desktop integration, but substantially more useful when transparent desktop integration loses a file.&lt;/p&gt;</description></item></channel></rss>