diff options
author | Piotr Szarmanski | 2023-08-25 19:09:50 +0200 |
---|---|---|
committer | Piotr Szarmanski | 2023-08-25 19:09:50 +0200 |
commit | fed34b8df2b19ba996ef810f44d5666437c90fb7 (patch) | |
tree | 6d5aac31bbfb7eab265490c8e37856382ebdd2ba /src/backend.lisp | |
parent | da0e1aa69defa7cbc87209966c751918f523f1fb (diff) |
Add the parallel encoder.
Diffstat (limited to 'src/backend.lisp')
-rw-r--r-- | src/backend.lisp | 21 |
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))) |