Download Text - Barrelfish

Transcript
3. Approach
Please note that this section is necessarily implementation-oriented in order
to provide a basis for describing the interface. For a more detailed discussion
of the architecture, please refer to Section 4.1 in the next chapter.
3.2
Query Language
Currently, Barrelfish uses a straight-forward approach to interface with the
SKB: Strings, written in Prolog syntax, are sent directly to the SKB, which
forwards it to ECLi PSe . ECLi PSe then parses the string and executes it as a
query. This approach provides a lot of flexibility for the clients but has some
disadvantages:
• A client needs knowledge about the underlying Prolog code in order
to write correct queries.
• Executing queries unchecked on the ECLi PSe CLP engine makes it
hard to have a reliable service as it is easy to write queries that affect
or corrupt the state of the stored data or the engine itself.
• Queries for the SKB have to follow the rules dictated by the ECLi PSe
Prolog syntax (uppercase variable names, strings in double quotes,
atoms must start with a lowercase letter etc.).
As it is desirable to have a service that is not tied too strong with ECLi PSe ,
we decided to come up with a designated syntax that could be used throughout all the different APIs our service should provide.
3.2.1
Record Notation
In this section we introduce the notion of a Octopus record: A set of attribute–
value pairs identified by a record name. As an introduction, we give some
examples of records stored in Barrelfish:
spawnd.1 { iref: 12 }
hw.pci.device.1 { bus: 0, device: 1, function: 0,
vendor: 0x8086, device_id: 0x107d,
class: ’C’ }
The first line is a record created by the name service client API. It contains
the interface reference for the exported service named spawnd.1. The second
line is a record for a e1000 network card found during PCI bus enumeration.
The syntax is mostly inspired by JSON (JavaScript Object Notation) [27] — a
data-interchange format that is easy to read and write for humans and easy
to parse and generate for machines. Table 3.1 gives a description of a record
10