Subject: [PATCH 06/23] store: Export protocol related constants.

From: Christopher Baines <[email-masked]>
Date: Sun, 21 Apr 2024 10:42:24 +0100

* guix/store.scm (%protocol-version, %worker-magic-1, %worker-magic-2): Export
variables.
(protocol-major, protocol-minor, protocol-version): Export procedures.
(%stderr-next, %stderr-read, %stderr-write, %stderr-last, %stderr-error):
Move from process-stderr and export variables.

Change-Id: Id0b1b5e6feeac5260875558f33aa5d923d5e0903
---
 guix/store.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/guix/store.scm b/guix/store.scm
index c3b58090e5..578e46507e 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -206,18 +206,25 @@ (define-module (guix store)
             derivation-log-file
             log-file))
 
-(define %protocol-version #x164)
+(define-public %protocol-version #x164)
 
-(define %worker-magic-1 #x6e697863)               ; "nixc"
-(define %worker-magic-2 #x6478696f)               ; "dxio"
+(define-public %worker-magic-1 #x6e697863)               ; "nixc"
+(define-public %worker-magic-2 #x6478696f)               ; "dxio"
 
-(define (protocol-major magic)
+(define-public (protocol-major magic)
   (logand magic #xff00))
-(define (protocol-minor magic)
+(define-public (protocol-minor magic)
   (logand magic #x00ff))
-(define (protocol-version major minor)
+(define-public (protocol-version major minor)
   (logior major minor))
 
+;; magic cookies from worker-protocol.hh
+(define-public %stderr-next  #x6f6c6d67)          ; "olmg", build log
+(define-public %stderr-read  #x64617461)          ; "data", data needed from source
+(define-public %stderr-write #x64617416)          ; "dat\x16", data for sink
+(define-public %stderr-last  #x616c7473)          ; "alts", we're done
+(define-public %stderr-error #x63787470)          ; "cxtp", error reporting
+
 (define-syntax define-enumerate-type
   (syntax-rules ()
     ((_ name->int (name id) ...)
@@ -709,13 +716,6 @@ (define* (process-stderr server #:optional user-port)
   (define p
     (store-connection-socket server))
 
-  ;; magic cookies from worker-protocol.hh
-  (define %stderr-next  #x6f6c6d67)          ; "olmg", build log
-  (define %stderr-read  #x64617461)          ; "data", data needed from source
-  (define %stderr-write #x64617416)          ; "dat\x16", data for sink
-  (define %stderr-last  #x616c7473)          ; "alts", we're done
-  (define %stderr-error #x63787470)          ; "cxtp", error reporting
-
   (let ((k (read-int p)))
     (cond ((= k %stderr-write)
            ;; Write a byte stream to USER-PORT.
-- 
2.41.0