[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 366e21fc4f 1/4: Change/Fix: (hyperdrive-delete)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 366e21fc4f 1/4: Change/Fix: (hyperdrive-delete) Update version info in callback |
Date: |
Fri, 22 Sep 2023 04:01:05 -0400 (EDT) |
branch: elpa/hyperdrive
commit 366e21fc4f8d72f9a0ce8568d66bd25dc863f366
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Change/Fix: (hyperdrive-delete) Update version info in callback
---
hyperdrive-lib.el | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 5572dc7dac..7c658227e6 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -877,14 +877,21 @@ HYPERDRIVE's public metadata file."
(hyperdrive-persist hyperdrive)
hyperdrive))
-(cl-defun hyperdrive-delete (entry &key then else)
- "Delete ENTRY, then call THEN.
-Call ELSE if request fails."
+(cl-defun hyperdrive-delete (entry &key (then #'ignore) (else #'ignore))
+ "Delete ENTRY, then call THEN with response.
+Call ELSE with `plz-error' struct if request fails."
(declare (indent defun))
- ;; TODO: update-version-ranges here.
- ;; TODO: `hyperdrive--fill-latest-version' here.
(hyperdrive-api 'delete (hyperdrive-entry-url entry)
- :then then :else else))
+ :as 'response
+ :then (lambda (response)
+ (pcase-let* (((cl-struct plz-response headers) response)
+ ((map etag) headers)
+ (nonexistent-entry (hyperdrive-copy-tree entry t)))
+ (setf (hyperdrive-entry-version nonexistent-entry)
(string-to-number etag))
+ (hyperdrive--fill-latest-version (hyperdrive-entry-hyperdrive
entry) headers)
+ (hyperdrive-update-nonexistent-version-range nonexistent-entry)
+ (funcall then response)))
+ :else else))
(cl-defun hyperdrive-purge-no-prompt (hyperdrive &key then else)
"Purge all data corresponding to HYPERDRIVE, then call THEN with response.