diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eris-decode.lisp | 3 | ||||
-rw-r--r-- | src/eris.lisp | 14 | ||||
-rw-r--r-- | src/parallel-decoder.lisp | 5 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/eris-decode.lisp b/src/eris-decode.lisp index 351da72..508dc67 100644 --- a/src/eris-decode.lisp +++ b/src/eris-decode.lisp @@ -209,12 +209,13 @@ it is necessary and sets the position in the buffer to 0." (defun eris-decode (read-capability fetch-function &key (cache-capacity 2048)) "Using the FETCH-FUNCTION, return a stream that decodes the READ-CAPABILITY. +This stream implements the Gray streams protocol. Fetch-function must be a function with one argument, the reference octet, which returns a (simple-array (unsigned-byte 8)) containing the block. The block will 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. +gethash. The keyword argument CACHE-CAPACITY indicates the amount of blocks stored in the cache." diff --git a/src/eris.lisp b/src/eris.lisp index 5e3ed2a..0509ecb 100644 --- a/src/eris.lisp +++ b/src/eris.lisp @@ -194,14 +194,18 @@ read-capability object. Returns the read-capability." (defgeneric eris-encode (input block-size output-function &key secret hash-output) (:documentation - "Encode an input into block-size (32kib or 1kib) blocks, that are output using -the function output-function. This function wil be called with two arguments: an -encoded block and a 32-byte reference octet vector. + "Encode an INPUT into BLOCK-SIZE (32kib or 1kib) blocks, that are output using +the function OUTPUT-FUNCTION. This function wil be called with two arguments: an +encoded block and a 32-byte reference octet vector. Returns a read-capability +object. An optional 32-byte secret can be passed for additional encryption using the -:secret keyword.")) +SECRET keyword argument. -(defmethod eris-encode ((input simple-array) block-size output-function &key (secret null-secret) hash-output) +The HASH-OUTPUT keyword argument controls whether a hash-table is used to +guarantee that a reference is only output once.")) + +(defmethod eris-encode ((input simple-array) block-size output-function &key (secret null-secret) (hash-output t)) (declare (type block-size block-size) (type function output-function) (type (simple-array (unsigned-byte 8) (32)) secret)) diff --git a/src/parallel-decoder.lisp b/src/parallel-decoder.lisp index 9af1ceb..8b4f568 100644 --- a/src/parallel-decoder.lisp +++ b/src/parallel-decoder.lisp @@ -88,7 +88,10 @@ be destructively modified, so you MUST provide a fresh array every time. In addition, the function MUST be thread-safe. CACHE-CAPACITY indicates the total amount of blocks stored for all threads. Each -thread has its own cache." +thread has its own cache. + +INITIAL-BINDINGS is passed to make-thread. This is only useful if you are +locally binding a special variable to some value." (declare (type read-capability read-capability) (type function fetch-function) (type integer cache-capacity)) |