summaryrefslogtreecommitdiff
path: root/src/backend.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend.lisp')
-rw-r--r--src/backend.lisp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend.lisp b/src/backend.lisp
index d2b81b2..8571e66 100644
--- a/src/backend.lisp
+++ b/src/backend.lisp
@@ -22,6 +22,9 @@
(defclass decoding-backend ()
((fetch-function :type function)))
+(defclass p/encoding-backend ()
+ ())
+
(defgeneric fetch-data (read-capability backend &key &allow-other-keys)
(:documentation
"Using the BACKEND, return a stream that decodes the provided READ-CAPABILITY
@@ -58,3 +61,21 @@ size less than 16kib. It should be set either to 1024b or 32kib."))
1kib)
output-function
:secret secret)))
+
+(defgeneric p/store-data (input backend &key secret block-size threads)
+ (:documentation "Like store-data but parallel. lparallel:*kernel* has to be bound before
+calling."))
+
+(defmethod p/store-data (input (backend p/encoding-backend)
+ &key (secret null-secret) (block-size 32kib) &allow-other-keys)
+ (with-slots (output-function) backend
+ (p/eris-encode input
+ (if (> (etypecase input
+ (pathname (file-size input))
+ (file-stream (file-length input))
+ (vector (length input))
+ (t block-size))
+ 16384)
+ 32kib
+ 1kib)
+ output-function :secret secret)))