Skip to content

Commit

Permalink
deploy: 133345a
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Jan 20, 2024
1 parent 3673caa commit 3fa2f83
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 19 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/deno.html"><strong aria-hidden="true">2.1.</strong> Deno</a></li></ol></li></ol>
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/typescript.html"><strong aria-hidden="true">2.1.</strong> Typescript</a></li><li class="chapter-item expanded "><a href="reducers/rust.html"><strong aria-hidden="true">2.2.</strong> Rust</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html" class="active"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/deno.html"><strong aria-hidden="true">2.1.</strong> Deno</a></li></ol></li></ol>
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html" class="active"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/typescript.html"><strong aria-hidden="true">2.1.</strong> Typescript</a></li><li class="chapter-item expanded "><a href="reducers/rust.html"><strong aria-hidden="true">2.2.</strong> Rust</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down
2 changes: 1 addition & 1 deletion introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html" class="active"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/deno.html"><strong aria-hidden="true">2.1.</strong> Deno</a></li></ol></li></ol>
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html" class="active"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/typescript.html"><strong aria-hidden="true">2.1.</strong> Typescript</a></li><li class="chapter-item expanded "><a href="reducers/rust.html"><strong aria-hidden="true">2.2.</strong> Rust</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down
47 changes: 43 additions & 4 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/deno.html"><strong aria-hidden="true">2.1.</strong> Deno</a></li></ol></li></ol>
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reducers/typescript.html"><strong aria-hidden="true">2.1.</strong> Typescript</a></li><li class="chapter-item expanded "><a href="reducers/rust.html"><strong aria-hidden="true">2.2.</strong> Rust</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down Expand Up @@ -181,10 +181,49 @@ <h2 id="motivation"><a class="header" href="#motivation">Motivation</a></h2>
<p>Scroll Reducers are Map/Reduce algorithms that turn block data into a relevant information to be queried by end-users.</p>
<p>There are several ways to implement reducers in Scrolls:</p>
<ul>
<li><a href="reducers/typescript.html">Typescript</a>: using custom Typescript code to implement the map/reduce logic</li>
<li><a href="reducers/rust.html">Rust</a>: using custom Rust code to implement the map/reduce logic</li>
<li><a href="reducers/./typescript.html">Typescript</a>: using custom Typescript code to implement the map/reduce logic</li>
<li><a href="reducers/./rust.html">Rust</a>: using custom Rust code to implement the map/reduce logic</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div><h1 id="deno"><a class="header" href="#deno">Deno</a></h1>
<div style="break-before: page; page-break-before: always;"></div><h1 id="using-typescript-to-build-custom-reducers"><a class="header" href="#using-typescript-to-build-custom-reducers">Using Typescript to build custom reducers</a></h1>
<p>With the Typescript reducer is possible to create a custom reducer for logics that the builtin reducers don't have support. This reducer is only enable with the deno feature on build.</p>
<p>To build reducer using Typescript, we need to code our custom logic as any other Typescript module and transpile it into JS code using Deno. The resulting file (.js) can then be referenced by Scrolls configuration so that it's loaded dynamically at the moment of execution.</p>
<p>To transpile your Typescript code using Deno, run the following command:</p>
<pre><code>deno bundle reducer.ts reducer.js
</code></pre>
<h2 id="configuration"><a class="header" href="#configuration">Configuration</a></h2>
<p>Example of a configuration</p>
<pre><code class="language-toml">[reducer]
type = &quot;Deno&quot;
main_module = &quot;./examples/deno/reducer.js&quot;
use_async = true
</code></pre>
<h3 id="section-reducer"><a class="header" href="#section-reducer">Section: <code>reducer</code></a></h3>
<ul>
<li><code>type</code>: the literal value <code>Deno</code>.</li>
<li><code>main_module</code>: the js file with the reducer logic</li>
<li><code>use_async</code>: run the js in async mode</li>
</ul>
<h2 id="run-code"><a class="header" href="#run-code">Run code</a></h2>
<p>To run the code with the deno will be necessary to use deno feature</p>
<pre><code class="language-sh">cargo run --features=deno -- daemon --config ./examples/deno/daemon.toml
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="using-rust-to-build-custom-reducers"><a class="header" href="#using-rust-to-build-custom-reducers">Using Rust to build custom reducers</a></h1>
<p>To build reducer using Rust, we need to code our custom logic as any other Rust-based program and compile it with a WASM target. The resulting file (.wasm) can then be referenced by Scrolls configuration so that it's loaded dynamically at the moment of execution.</p>
<h2 id="configuration-1"><a class="header" href="#configuration-1">Configuration</a></h2>
<p>Example of a configuration</p>
<pre><code class="language-toml">[reducer]
type = &quot;Wasm&quot;
main_module = &quot;./examples/wasm/enrich.wasm&quot;
</code></pre>
<h3 id="section-reducer-1"><a class="header" href="#section-reducer-1">Section: <code>reducer</code></a></h3>
<ul>
<li><code>type</code>: the literal value <code>Wasm</code>.</li>
<li><code>main_module</code>: the wasm file containing the reducer logic</li>
</ul>
<h2 id="run-code-1"><a class="header" href="#run-code-1">Run code</a></h2>
<p>To run a custom WASM reducer, it will be necessary to trigger scrolls enabling the <code>wasm</code> feature</p>
<pre><code class="language-sh">cargo run --features=wasm -- daemon --config ./examples/wasm/daemon.toml
</code></pre>

</main>

Expand Down
10 changes: 5 additions & 5 deletions reducers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="../introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="../reducers/index.html" class="active"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../reducers/deno.html"><strong aria-hidden="true">2.1.</strong> Deno</a></li></ol></li></ol>
<ol class="chapter"><li class="chapter-item expanded "><a href="../introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="../reducers/index.html" class="active"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../reducers/typescript.html"><strong aria-hidden="true">2.1.</strong> Typescript</a></li><li class="chapter-item expanded "><a href="../reducers/rust.html"><strong aria-hidden="true">2.2.</strong> Rust</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down Expand Up @@ -177,8 +177,8 @@ <h1 id="reducers"><a class="header" href="#reducers">Reducers</a></h1>
<p>Scroll Reducers are Map/Reduce algorithms that turn block data into a relevant information to be queried by end-users.</p>
<p>There are several ways to implement reducers in Scrolls:</p>
<ul>
<li><a href="typescript.html">Typescript</a>: using custom Typescript code to implement the map/reduce logic</li>
<li><a href="rust.html">Rust</a>: using custom Rust code to implement the map/reduce logic</li>
<li><a href="./typescript.html">Typescript</a>: using custom Typescript code to implement the map/reduce logic</li>
<li><a href="./rust.html">Rust</a>: using custom Rust code to implement the map/reduce logic</li>
</ul>

</main>
Expand All @@ -189,7 +189,7 @@ <h1 id="reducers"><a class="header" href="#reducers">Reducers</a></h1>
<i class="fa fa-angle-left"></i>
</a>

<a rel="next prefetch" href="../reducers/deno.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<a rel="next prefetch" href="../reducers/typescript.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>

Expand All @@ -203,7 +203,7 @@ <h1 id="reducers"><a class="header" href="#reducers">Reducers</a></h1>
<i class="fa fa-angle-left"></i>
</a>

<a rel="next prefetch" href="../reducers/deno.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<a rel="next prefetch" href="../reducers/typescript.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
Expand Down
26 changes: 21 additions & 5 deletions reducers/deno.html → reducers/rust.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Deno - Scrolls</title>
<title>Rust - Scrolls</title>


<!-- Custom HTML head -->
Expand Down Expand Up @@ -88,7 +88,7 @@

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="../introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="../reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../reducers/deno.html" class="active"><strong aria-hidden="true">2.1.</strong> Deno</a></li></ol></li></ol>
<ol class="chapter"><li class="chapter-item expanded "><a href="../introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="../reducers/index.html"><strong aria-hidden="true">2.</strong> Reducers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../reducers/typescript.html"><strong aria-hidden="true">2.1.</strong> Typescript</a></li><li class="chapter-item expanded "><a href="../reducers/rust.html" class="active"><strong aria-hidden="true">2.2.</strong> Rust</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
Expand Down Expand Up @@ -173,13 +173,29 @@ <h1 class="menu-title">Scrolls</h1>

<div id="content" class="content">
<main>
<h1 id="deno"><a class="header" href="#deno">Deno</a></h1>
<h1 id="using-rust-to-build-custom-reducers"><a class="header" href="#using-rust-to-build-custom-reducers">Using Rust to build custom reducers</a></h1>
<p>To build reducer using Rust, we need to code our custom logic as any other Rust-based program and compile it with a WASM target. The resulting file (.wasm) can then be referenced by Scrolls configuration so that it's loaded dynamically at the moment of execution.</p>
<h2 id="configuration"><a class="header" href="#configuration">Configuration</a></h2>
<p>Example of a configuration</p>
<pre><code class="language-toml">[reducer]
type = &quot;Wasm&quot;
main_module = &quot;./examples/wasm/enrich.wasm&quot;
</code></pre>
<h3 id="section-reducer"><a class="header" href="#section-reducer">Section: <code>reducer</code></a></h3>
<ul>
<li><code>type</code>: the literal value <code>Wasm</code>.</li>
<li><code>main_module</code>: the wasm file containing the reducer logic</li>
</ul>
<h2 id="run-code"><a class="header" href="#run-code">Run code</a></h2>
<p>To run a custom WASM reducer, it will be necessary to trigger scrolls enabling the <code>wasm</code> feature</p>
<pre><code class="language-sh">cargo run --features=wasm -- daemon --config ./examples/wasm/daemon.toml
</code></pre>

</main>

<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../reducers/index.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<a rel="prev" href="../reducers/typescript.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>

Expand All @@ -190,7 +206,7 @@ <h1 id="deno"><a class="header" href="#deno">Deno</a></h1>
</div>

<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../reducers/index.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<a rel="prev" href="../reducers/typescript.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>

Expand Down
Loading

0 comments on commit 3fa2f83

Please sign in to comment.