Next: , Previous: , Up: Programming Interface   [Contents][Index]


4.3 The Store

Conceptually, the store is where derivations that have been successfully built are stored—by default, under /gnu/store. Sub-directories in the store are referred to as store paths. The store has an associated database that contains information such has the store paths referred to by each store path, and the list of valid store paths—paths that result from a successful build.

The store is always accessed by the daemon on behalf of its clients (see Invoking guix-daemon). To manipulate the store, clients connect to the daemon over a Unix-domain socket, send it requests, and read the result—these are remote procedure calls, or RPCs.

The (guix store) module provides procedures to connect to the daemon, and to perform RPCs. These are described below.

Scheme Procedure: open-connection [file] [#:reserve-space? #t]

Connect to the daemon over the Unix-domain socket at file. When reserve-space? is true, instruct it to reserve a little bit of extra space on the file system so that the garbage collector can still operate, should the disk become full. Return a server object.

file defaults to %default-socket-path, which is the normal location given the options that were passed to configure.

Scheme Procedure: close-connection server

Close the connection to server.

Scheme Variable: current-build-output-port

This variable is bound to a SRFI-39 parameter, which refers to the port where build and error logs sent by the daemon should be written.

Procedures that make RPCs all take a server object as their first argument.

Scheme Procedure: valid-path? server path

Return #t when path is a valid store path.

Scheme Procedure: add-text-to-store server name text [references]

Add text under file name in the store, and return its store path. references is the list of store paths referred to by the resulting store path.

Scheme Procedure: build-derivations server derivations

Build derivations (a list of <derivation> objects or derivation paths), and return when the worker is done building them. Return #t on success.

Note that the (guix monads) module provides a monad as well as monadic versions of the above procedures, with the goal of making it more convenient to work with code that accesses the store (see The Store Monad).

This section is currently incomplete.


Next: , Previous: , Up: Programming Interface   [Contents][Index]