guix_mirror_bot pushed a commit to branch master
in repository guix.

commit ab72a155c6ddaaad7d3a5dfc7cd018ed48fd0e09
Author: Ludovic Courtès <[email protected]>
AuthorDate: Tue Nov 25 14:25:55 2025 +0100

    store: Move low-level protocol bit-twiddling to (guix remote-procedures).
    
    * guix/store.scm (%protocol-version, %worker-magic-1, %worker-magic-2)
    (protocol-major, protocol-minor, protocol-version): Move to…
    * guix/remote-procedures.scm: … here.
    
    Change-Id: Idbb23e63ab6314aa7e9ce0e3e5aa835be85c27d9
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 guix/remote-procedures.scm | 29 ++++++++++++++++++++++++++++-
 guix/store.scm             | 12 ------------
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/guix/remote-procedures.scm b/guix/remote-procedures.scm
index 3f4f9babce..dca491a76d 100644
--- a/guix/remote-procedures.scm
+++ b/guix/remote-procedures.scm
@@ -18,7 +18,14 @@
 
 (define-module (guix remote-procedures)
   #:use-module (guix serialization)
-  #:export (visit-remote-procedures
+  #:export (%protocol-version
+            %worker-magic-1
+            %worker-magic-2
+            protocol-major
+            protocol-minor
+            protocol-version
+
+            visit-remote-procedures
             id:
             returns:
             remote-procedure-id
@@ -37,6 +44,26 @@
 ;;;
 ;;; Code:
 
+(define %protocol-version
+  ;; Version of the currently-implemented protocol.
+  #x164)
+
+;; Values sent by the client and then the server upon handshake.
+(define %worker-magic-1 #x6e697863)               ; "nixc"
+(define %worker-magic-2 #x6478696f)               ; "dxio"
+
+(define (protocol-major magic)
+  "Extract from MAGIC, an integer, the protocol major version."
+  (logand magic #xff00))
+
+(define (protocol-minor magic)
+  "Extract from MAGIC, an integer, the protocol minor version."
+  (logand magic #x00ff))
+
+(define (protocol-version major minor)
+  "Return an integer representing protocol version MAJOR and MINOR."
+  (logior major minor))
+
 (define-syntax define-remote-procedures
   (syntax-rules (define)
     ((_ walk definition ...)
diff --git a/guix/store.scm b/guix/store.scm
index 7d0626372a..4fd42cc658 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -211,18 +211,6 @@
             derivation-log-file
             log-file))
 
-(define %protocol-version #x164)
-
-(define %worker-magic-1 #x6e697863)               ; "nixc"
-(define %worker-magic-2 #x6478696f)               ; "dxio"
-
-(define (protocol-major magic)
-  (logand magic #xff00))
-(define (protocol-minor magic)
-  (logand magic #x00ff))
-(define (protocol-version major minor)
-  (logior major minor))
-
 (define %default-socket-path
   (string-append %state-directory "/daemon-socket/socket"))
 

Reply via email to