aboutsummaryrefslogtreecommitdiff

Guile-ERIS

Guile implementation of the Encoding for Robust Immutable Storage (ERIS).

This library can be used to encoded and decode content with ERIS. Features include:

  • Streaming encoding
  • Random-access decoder
  • Cross-platform support

Usage

A short message can be encoded as such:

(use-modules (eris)
             (rnrs bytevectors)
             (srfi srfi-71))

(let ((read-capability blocks
               (eris-encode "Hello world!"
                    #:block-size 'small
                    #:convergence-secret null-convergence-secret)))
  read-capability)

;; "urn:eris:BIAD77QDJMFAKZYH2DXBUZYAP3MXZ3DJZVFYQ5DFWC6T65WSFCU5S2IT4YZGJ7AC4SYQMP2DM2ANS2ZTCP3DJJIRV733CRAAHOSWIYZM3M"

The eris-encode procedure returns two values: the read capability and a list of blocks.

The content can be decoded with the blocks:

(use-modules (eris)
             (rnrs bytevectors)
             (srfi srfi-71))

(let ((read-capability blocks
               (eris-encode "Hello world!"
                    #:block-size 'small
                    #:convergence-secret null-convergence-secret)))
  (utf8->string
   (eris-decode read-capability
        #:block-ref (lambda (ref) (assoc-ref blocks ref)))))

;; "Hello world!"

Blocks are by default stored in an alist. This can be changed by providing an alternative block reducer to eris-encode. Block reducers are 3-arity reducing functions (see SRFI 171).

For example we can use the rcount reducer that just counts the number of blocks:

(use-modules (eris)
             (rnrs bytevectors)
             (srfi srfi-71)
             (srfi srfi-171))

(let ((read-capability blocks
               (eris-encode "Hello world!"
                    #:block-size 'small
                    #:block-reducer rcount
                    #:convergence-secret null-convergence-secret)))
  blocks)

;; 1

See the reference manual for more information and features such as streaming encoding and random-access decoding.

Documentation

TODO

Hacking

A suitable development environment can be provisioned with Guix:

guix shell -D -f guix.scm

To build and run the tests:

autoreconv -vif
./configure
make
make check

Acknowledgments

guile-eris was initially developed as part of the openEngiadina project and has been supported by the NLnet Foundation trough the NGI0 Discovery Fund. Further development has been supported by the NLnet Foundation trough NGI Assure.

License

GPL-3.0-or-later