Block type and constructor functions.
Blocks have two primary attributes, :id
and :size
. The block identifier
is a Multihash
with the digest identifying the content. The size is the
number of bytes in the block content.
Internally, blocks either have in-memory content holding the data, or a reader function which returns new input streams for the block data. A block with in-memory content is a loaded block, while a block with a reader function is a lazy block.
A block's id, size, content, and reader cannot be changed after construction, so clients can be relatively certain that the block's id is valid. Blocks may have additional attributes associated with them and support metadata, similar to records.
Block type and constructor functions. Blocks have two primary attributes, `:id` and `:size`. The block identifier is a `Multihash` with the digest identifying the content. The size is the number of bytes in the block content. Internally, blocks either have in-memory content holding the data, or a reader function which returns new input streams for the block data. A block with in-memory content is a _loaded block_, while a block with a reader function is a _lazy block_. A block's id, size, content, and reader cannot be changed after construction, so clients can be relatively certain that the block's id is valid. Blocks _may_ have additional attributes associated with them and support metadata, similar to records.
(checked-hasher algorithm)
Constructs a function for the given hash algorithm or function which checks
that the result is a Multihash
.
Constructs a function for the given hash algorithm or function which checks that the result is a `Multihash`.
(clean-block block)
Creates a version of the given block without extra attributes or metadata.
Creates a version of the given block without extra attributes or metadata.
(content-stream block start end)
Opens an input stream to read the contents of the block.
Opens an input stream to read the contents of the block.
(lazy-block id size reader)
Creates a block from a reader function. Each time the function is called, it
should return a new InputStream
to read the block contents. The block is
given the id and size directly, without being checked.
Creates a block from a reader function. Each time the function is called, it should return a new `InputStream` to read the block contents. The block is given the id and size directly, without being checked.
(load-block id source)
Creates a block by reading a source into memory. The block is given the id directly, without being checked.
Creates a block by reading a source into memory. The block is given the id directly, without being checked.
(merge-blocks a b)
Creates a new block by merging together two blocks representing the same content. Block ids and sizes must match. The new block's content or reader comes from the second block, and any extra attributes and metadata are merged together.
Creates a new block by merging together two blocks representing the same content. Block ids and sizes must match. The new block's content or reader comes from the second block, and any extra attributes and metadata are merged together.
(read-block algorithm source)
Creates a block by reading the source into memory and hashing it.
Creates a block by reading the source into memory and hashing it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close