unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
To: Pjotr Prins <pjotr.public12@thebird.nl>
Cc: guix-devel@gnu.org
Subject: Re: Self-contained Guix tarball
Date: Tue, 21 Apr 2015 12:08:39 +0200	[thread overview]
Message-ID: <idjk2x5vlnc.fsf@bimsb-sys02.mdc-berlin.net> (raw)
In-Reply-To: <20150421083722.GA16564@thebird.nl>


Pjotr Prins writes:

> On Tue, Apr 21, 2015 at 10:11:29AM +0200, Ludovic Courtès wrote:
>> The important thing is that currently, the DB is authoritative.  So it
>> cannot be corrupt (that would be equivalent to having lost /gnu/store
>> altogether), and thus it cannot be repaired.
>
> The point really is that it is not so hard to achieve rebuilding the
> database. Anyone on this list thinks that should be possible? I am
> asking the big systems guys :)

You could rebuild the database only if the contents of the /gnu/store
directory were authoritative (which they are not).  The database only
contains four tables and none of the entries are magical:

  sqlite> .fullschema
  CREATE TABLE ValidPaths (
      id               integer primary key autoincrement not null,
      path             text unique not null,
      hash             text not null,
      registrationTime integer not null,
      deriver          text,
      narSize          integer
  );
  CREATE TABLE Refs (
      referrer  integer not null,
      reference integer not null,
      primary key (referrer, reference),
      foreign key (referrer) references ValidPaths(id) on delete cascade,
      foreign key (reference) references ValidPaths(id) on delete restrict
  );
  CREATE TABLE DerivationOutputs (
      drv  integer not null,
      id   text not null, -- symbolic output id, usually "out"
      path text not null,
      primary key (drv, id),
      foreign key (drv) references ValidPaths(id) on delete cascade
  );
  CREATE TABLE FailedPaths (
      path text primary key not null,
      time integer not null
  );
  CREATE INDEX IndexReferrer on Refs(referrer);
  CREATE INDEX IndexReference on Refs(reference);
  CREATE INDEX IndexDerivationOutputs on DerivationOutputs(path);
  CREATE TRIGGER DeleteSelfRefs before delete on ValidPaths
    begin
      delete from Refs where referrer = old.id and reference = old.id;
    end;
  /* No STAT tables available */

To create records in Refs you would obviously need to know the
relationship between packages, but you can get that by using Guix
and the package modules as a library.

Someone daring enough to mess with the store contents (by manually
adding, altering or removing stuff) without going through the daemon
would also have to take care of manipulating database records in the
appropriate manner.  I fail to see, however, in what situation this
would be desirable to a system administrator.

Sysadmins don't expect, for example, to be able to delete files from a
system where software is managed with RPM *without* also having to
modify the RPM database to avoid problems.

If I were to sync /gnu/store/ across different machines with rsync, I'd
make sure to keep any additional state by also copying the
localstatedir: /var/guix/.  But as I said before, I fail to see a good
reason to do this.

> It may also allow for people creating other store-based tools in time.

Guix can be used as a library and with the store monad it is possible to
programmatically manipulate the store.  I expect this to become even
easier once the daemon is rewritten in Scheme (which is bound to result
in more reusable parts that could be glued together by adventurous
sysadmins).

~~ Ricardo

  reply	other threads:[~2015-04-21 10:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10  8:46 Copying whole /gnu/store from USB does not work Pjotr Prins
2015-04-10 11:48 ` Ludovic Courtès
2015-04-10 13:14   ` Pjotr Prins
2015-04-10 13:41     ` David Thompson
2015-04-12 10:28     ` Copying whole /gnu/store from USB does not work (SOLVED) Pjotr Prins
2015-04-12 12:29       ` Ludovic Courtès
2015-04-12 20:07     ` Self-contained Guix tarball Ludovic Courtès
2015-04-13  6:54       ` Pjotr Prins
2015-04-13  9:57         ` Ludovic Courtès
2015-04-13 10:05           ` Pjotr Prins
2015-04-13 13:29           ` Mark H Weaver
2015-04-14 21:33             ` Ludovic Courtès
2015-04-13 15:47       ` Thompson, David
2015-04-15 21:31       ` Ludovic Courtès
2015-04-16  5:33         ` Pjotr Prins
2015-04-18 21:23           ` Ludovic Courtès
2015-04-19  8:18             ` Pjotr Prins
2015-04-19 20:09               ` Ludovic Courtès
2015-04-19 13:34             ` Taylan Ulrich Bayırlı/Kammer
2015-04-20 20:49               ` Ludovic Courtès
2015-04-21  7:03                 ` Pjotr Prins
2015-04-21  7:19                   ` Pjotr Prins
2015-04-21  8:18                     ` Ludovic Courtès
2015-04-21  8:44                       ` Pjotr Prins
2015-04-21 12:16                         ` Ludovic Courtès
2015-04-21  8:11                   ` Ludovic Courtès
2015-04-21  8:37                     ` Pjotr Prins
2015-04-21 10:08                       ` Ricardo Wurmus [this message]
2015-04-21 10:17                         ` Pjotr Prins
2015-04-21 12:08                           ` Andreas Enge
2015-04-21 12:12                       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=idjk2x5vlnc.fsf@bimsb-sys02.mdc-berlin.net \
    --to=ricardo.wurmus@mdc-berlin.de \
    --cc=guix-devel@gnu.org \
    --cc=pjotr.public12@thebird.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).