about summary refs log tree commit diff
path: root/src/nix-store/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T19·19+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T19·19+0000
commit40b3f64b55f98e03b3173541b8d94cd924099223 (patch)
tree78a14654425eab2729e3c8077860573766a794c0 /src/nix-store/main.cc
parent9adc074dc3e135356c2390038bf72264c29c1e03 (diff)
* Skeleton of the privileged worker program.
* Some refactoring: put the NAR archive integer/string serialisation
  code in a separate file so it can be reused by the worker protocol
  implementation.

Diffstat (limited to 'src/nix-store/main.cc')
-rw-r--r--src/nix-store/main.cc25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index f31814881f71..c3755c2a1ef6 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -607,17 +607,6 @@ static void opDelete(Strings opFlags, Strings opArgs)
 }
 
 
-/* A sink that writes dump output to stdout. */
-struct StdoutSink : DumpSink
-{
-    virtual void operator ()
-        (const unsigned char * data, unsigned int len)
-    {
-        writeFull(STDOUT_FILENO, data, len);
-    }
-};
-
-
 /* Dump a path as a Nix archive.  The archive is written to standard
    output. */
 static void opDump(Strings opFlags, Strings opArgs)
@@ -625,22 +614,12 @@ static void opDump(Strings opFlags, Strings opArgs)
     if (!opFlags.empty()) throw UsageError("unknown flag");
     if (opArgs.size() != 1) throw UsageError("only one argument allowed");
 
-    StdoutSink sink;
+    FdSink sink(STDOUT_FILENO);
     string path = *opArgs.begin();
     dumpPath(path, sink);
 }
 
 
-/* A source that reads restore input from stdin. */
-struct StdinSource : RestoreSource
-{
-    virtual void operator () (unsigned char * data, unsigned int len)
-    {
-        readFull(STDIN_FILENO, data, len);
-    }
-};
-
-
 /* Restore a value from a Nix archive.  The archive is read from
    standard input. */
 static void opRestore(Strings opFlags, Strings opArgs)
@@ -648,7 +627,7 @@ static void opRestore(Strings opFlags, Strings opArgs)
     if (!opFlags.empty()) throw UsageError("unknown flag");
     if (opArgs.size() != 1) throw UsageError("only one argument allowed");
 
-    StdinSource source;
+    FdSource source(STDIN_FILENO);
     restorePath(*opArgs.begin(), source);
 }