summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-11-25 14:25:55 +0100
committerLudovic Courtès <ludo@gnu.org>2026-01-27 12:58:18 +0100
commitab72a155c6ddaaad7d3a5dfc7cd018ed48fd0e09 (patch)
treee10b7288741f8fab4d727e5cb578acbe0c069746
parent68f1f74fb8896a1f77d244eb1fee32055eba9e49 (diff)
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 <ludo@gnu.org>
-rw-r--r--guix/remote-procedures.scm29
-rw-r--r--guix/store.scm12
2 files changed, 28 insertions, 13 deletions
diff --git a/guix/remote-procedures.scm b/guix/remote-procedures.scm
index 3f4f9babce7..dca491a76d3 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 7d0626372a8..4fd42cc6587 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"))