summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cache.lisp45
-rw-r--r--src/eris-decode.lisp30
-rw-r--r--src/package.lisp2
3 files changed, 9 insertions, 68 deletions
diff --git a/src/cache.lisp b/src/cache.lisp
deleted file mode 100644
index d6bce9c..0000000
--- a/src/cache.lisp
+++ /dev/null
@@ -1,45 +0,0 @@
-;; This is a patch for function-cache, enabling a per-stream cache for
-;; eris-decode-stream.
-
-(in-package :function-cache)
-
-(defmacro cached-lambda (cache-list lambda-list &body body)
- "Creates a cached lambda function with the cache-list
- cache-list is a list (&rest CACHE-INIT-ARGS
- &key CACHE-CLASS TABLE TIMEOUT SHARED-RESULTS?)
-
- TABLE - a shared cache-store to use, usually a hash-table, a function that returns
- a hashtable, or a symbol whose value is a hash-table
- TIMEOUT - how long entries in the cache should be considered valid for
- CACHE-CLASS - controls what cache class will be instantiated (uses
- default-cache-class if not provided)
- SHARED-RESULTS? - do we expect that we are sharing cache space with other things
- defaults to t if TABLE is provided
- CACHE-INIT-ARGS - any other args that should be passed to the cache
- "
- (destructuring-bind (&rest cache-args
- &key table (shared-results? nil shared-result-input?)
- cache-class
- &allow-other-keys)
- (ensure-list cache-list)
- (declare (ignore cache-class)) ;; handled in default-cache-class
- (remf cache-args :cache-class)
- (remf cache-args :table)
- (remf cache-args :shared-results?)
- (when (and table (not shared-result-input?)) (setf shared-results? t))
- (let* ((cache-class (default-cache-class (cons nil cache-list) lambda-list))
- (call-list (%call-list-for-lambda-list lambda-list))
- (cache (gensym)))
- `(let ((,cache
- (make-instance ',cache-class
- :body-fn (lambda ,lambda-list
- ,@body)
- :name nil
- :lambda-list ',lambda-list
- :shared-results? ,shared-results?
- :cached-results ,table
- ,@cache-args)))
- (lambda ,lambda-list
- (cacher ,cache ,call-list))))))
-
-(export 'cached-lambda)
diff --git a/src/eris-decode.lisp b/src/eris-decode.lisp
index df64913..ac458fb 100644
--- a/src/eris-decode.lisp
+++ b/src/eris-decode.lisp
@@ -209,7 +209,7 @@ it is necessary and sets the position in the buffer to 0."
-(defun eris-decode (read-capability fetch-function &key (cache-capacity 2048))
+(defun eris-decode (read-capability fetch-function)
"Using the FETCH-FUNCTION, return a stream that decodes the READ-CAPABILITY.
This stream implements the Gray streams protocol.
@@ -219,32 +219,18 @@ be destructively modified, so you MUST provide a fresh array every time. If a
hash-table is used, a (copy-seq) needs to be done on the return value of
gethash.
-The keyword argument CACHE-CAPACITY indicates the amount of blocks stored in the
-cache. It may be NIL to turn off caching entirely.
-
The conditions ERIS:MISSING-BLOCK, ERIS:PADDING, ERIS:HASH-MISMATCH and ERIS:EOF
may be signaled by operations on the stream. Any condition signaled from within
FETCH-FUNCTION is not handled."
(declare (type read-capability read-capability)
- (type function fetch-function)
- (type (or integer null) cache-capacity))
+ (type function fetch-function))
(with-slots (level block-size root-reference-pair) read-capability
- (let* ((get-block (if cache-capacity ;; handle caching
- (cached-lambda (:cache-class 'lru-cache
- :capacity cache-capacity
- :table (make-hash-table :size (1+ cache-capacity) :test #'equalp))
- (rk nonce)
- (declare (type octet-vector rk nonce))
- (let ((block (execute-fetch-function fetch-function rk)))
- (declare (type octet-vector block))
- (hash-check block rk)
- (decrypt-block block rk nonce)))
- (lambda (rk nonce)
- (declare (type octet-vector rk nonce))
- (let ((block (execute-fetch-function fetch-function rk)))
- (declare (type octet-vector block))
- (hash-check block rk)
- (decrypt-block block rk nonce)))))
+ (let* ((get-block (lambda (rk nonce)
+ (declare (type octet-vector rk nonce))
+ (let ((block (execute-fetch-function fetch-function rk)))
+ (declare (type octet-vector block))
+ (hash-check block rk)
+ (decrypt-block block rk nonce))))
(root (funcall get-block root-reference-pair (make-nonce level))))
;; "Implementations MUST verify the key appearing in the read capability
;; if level of encoded content is larger than 0."
diff --git a/src/package.lisp b/src/package.lisp
index 51ca5c7..e516e74 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -15,7 +15,7 @@
(defpackage eris
- (:use #:common-lisp #:trivial-gray-streams #:alexandria #:serapeum #:function-cache)
+ (:use #:common-lisp #:trivial-gray-streams #:alexandria #:serapeum)
(:export
#:eris-encode
#:eris-decode