changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/pod/util.lisp

changeset 441: 9fa3b9154bb2
parent: dec30b6fd500
author: Richard Westhaver <ellis@rwest.io>
date: Thu, 13 Jun 2024 21:57:36 -0400
permissions: -rw-r--r--
description: add pod/containerfile, rm pod/buildah, some work on zstd
1 ;; lib/pod/util.lisp --- Pod utilities
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :pod)
7 
8 (defun decode-podman-response (buf))
9 
10 (defun encode-podman-request (obj))
11 
12 ;;; HTTP/UDS
13 ;; assumes socket-connect was already called
14 (defun format-libpod-api-local (path)
15  (format nil "http://localhost/v~a/libpod/~a" *libpod-api-version* path))
16 
17 (defun libpod-request (client path &optional (method :get) timeout)
18  (let ((stream (socket-make-stream client
19  :element-type 'octet
20  :input t
21  :output t
22  :buffering :none)))
23  ;; TODO 2024-04-01: remove dependencies
24  (let ((wrapped-stream (flexi-streams:make-flexi-stream (chunga::make-chunked-stream stream)
25  :external-format :utf8)))
26  (req:request (format-libpod-api-local path)
27  :method method
28  :stream wrapped-stream
29  :connect-timeout #1=(or timeout t)
30  :read-timeout #1#))))
31 
32 (defun libpod-request-json (client path &optional (method :get) timeout)
33  (dat/json:json-decode (libpod-request client path method timeout)))
34 
35 ;; (libpod-request-json *client* "_ping")
36 ;; (libpod-request-json *client* "info")
37 ;; (libpod-request-json *client* "events")
38 ;; (libpod-request-json *client* "version")
39 ;; (libpod-request-json *client* "containers/json")