BOINC Client Communication Infrastructure, Part III

Parsing Responses

When I mentioned earlier about the BOINC XML parser assuming a line-by-line parse what I meant by that the XML responses are relatively flat and is parsed in one pass. This has some interesting ramifications, for instance the relationship between XML elements is determined by what was parsed before it.

For an example of what I mean I’m going to use the uber GUI RPC <get_state> which dumps the BOINC Daemons entire state and should be called at the beginning of any session. Most of the mini update RPC’s do not contain any relational information so you have to run a quick query against the <get_state> results to map a workunit to a project for instance.

Here would be the request:


<boinc_gui_rpc_request>
   <major_version>5</major_version>
   <minor_version>5</minor_version>
   <release>15</release>
   <get_state/>
</boinc_gui_rpc_request>

Here is a simplified version of the response:


<boinc_gui_rpc_reply>
    <major_version>5</major_version>
    <minor_version>5</minor_version>
    <release>13</release>
    …
    <project>
        <name>Alpha Project</name>
        …
    </project>
    <app>
        <name>alphaapp</name>
        <user_friendly_name>Alpha Application</user_friendly_name>
        …
    </app>
    <file_info>
        <name>aapp_5.24_windows_intelx86.exe</name>
        …
    </file_info>
    <app_version>
        <name>alphaapp</name>
        <version_num>524</version_num>
        <file_ref>
            <file_name>aapp_5.24_windows_intelx86.exe</file_name>
            <main_program/>
        </file_ref>
        …
    </app_version>
    <workunit>
        <name>Test1</name>
        <app_name>alphaapp</app_name>
        <version_num>524</version_num>
        …
    </workunit>
    <result>
        <name>Test1_0</name>
        <wu_name>Test1</wu_name>
    </result>
    <project>
        <name>Beta Project</name>
        …
    </project>
    <app>
        <name>betaapp</name>
        <user_friendly_name>Beta Application</user_friendly_name>
        …
    </app>
    <file_info>
        <name>bapp_5.24_windows_intelx86.exe</name>
        …
    </file_info>
    <app_version>
        <name>betaapp</name>
        <version_num>524</version_num>
        <file_ref>
            <file_name>bapp_5.24_windows_intelx86.exe</file_name>
            <main_program/>
        </file_ref>
        …
    </app_version>
    <workunit>
        <name>Test1</name>
        <app_name>betaapp</app_name>
        <version_num>524</version_num>
        …
    </workunit>
    <result>
        <name>Test1_0</name>
        <wu_name>Test1</wu_name>
    </result>
</boinc_gui_rpc_reply>

So in this example you can see that there is no explicit reference to a project in any of the app, app_version, file_info, workunit, and result elements because it is assumed that they all belong to the same project until the next project element is parsed.

This example illustrates what I mean by a relatively flat XML structure. XPath and XQuery would have a hard time trying to return results that are not in a hierarchical in nature.

—– Rom

%d bloggers like this: