mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
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>
This commit is contained in:
@@ -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 ...)
|
||||
|
||||
@@ -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"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user