summaryrefslogtreecommitdiff
path: root/website/src/index.html
diff options
context:
space:
mode:
authorNicolas Paul <n@nc0.fr>2023-04-16 20:32:08 +0200
committerNicolas Paul <n@nc0.fr>2023-04-16 20:32:08 +0200
commitc5d4eab7ca8e01c404149309d545f088ed574b74 (patch)
tree337b26feeb655840f5c95768085e50f50a27c210 /website/src/index.html
parentefc9e73404efc108c69b4498acb312d760cf8e5d (diff)
New documentation site
Diffstat (limited to 'website/src/index.html')
-rw-r--r--website/src/index.html191
1 files changed, 0 insertions, 191 deletions
diff --git a/website/src/index.html b/website/src/index.html
deleted file mode 100644
index 4be66a0..0000000
--- a/website/src/index.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="robots" content="index, follow">
- <link rel="apple-touch-icon" sizes="180x180" href="/assets/img/crab.png">
- <link rel="icon" type="image/png" sizes="32x32" href="/assets/img/crab.png">
- <title>Clawflake | Distributed ID Generator</title>
- <!-- OpenGraph -->
- <meta property="og:title" content="Clawflake" />
- <meta property="og:type" content="website" />
- <meta property="og:description" content="Clawflake is a distributed ID generator system." />
- <meta property="og:determiner" content="" />
- <meta property="og:site_name" content="Nicolas Paul" />
- <meta property="og:locale" content="en_US" />
- <!-- Twitter Cards -->
- <meta name="twitter:card" content="summary">
- <meta name="twitter:site" content="@ncs_pl">
- <meta name="twitter:title" content="Clawflake">
- <meta name="twitter:description" content="Clawflake is a distributed ID generator system.">
- <!-- Hypermedia -->
- <link rel="stylesheet" href="assets/css/pico.min.css">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/github-dark.min.css">
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
- <!-- and it's easy to individually load additional languages -->
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/languages/bash.min.js"></script>
- <script>hljs.highlightAll();</script>
-</head>
-
-<body>
- <nav class="container">
- <ul>
- <li><img src="/assets/img/crab.png" alt="crab" height="80" width="80"></li>
- </ul>
- <ul>
- <li><a href="https://nicolaspl.com" role="button">Nicolas Paul</a></li>
- <li><a href="/license.txt" role="button">
- License</a></li>
- <li><a href="https://github.com/n1c00o/clawflake" role="button">Source</a></li>
- </ul>
- </nav>
-
- <main class="container">
- <h1>Clawflake</h1>
-
- <p>Clawflake is a distributed ID number generation system inspired from
- <a href="https://github.com/twitter-archive/snowflake/tree/snowflake-2010">
- Twitter's Snowflake</a>.
- </p>
-
- <p> The goal of Clawflake is to be hosted as a distributed system with
- all workers being isolated from each others apart from the machine ID.
- </p>
-
- <h2>Format</h2>
-
- <p>
- Unlike Snowflake, the composition of a Clawflake uses all 64 bits.
- </p>
-
- <table>
- <thead>
- <tr>
- <th scope="col">#</th>
- <th scope="col">Name</th>
- <th scope="col">Bits</th>
- <th scope="col">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th scope="row">1</th>
- <td><code>time</code></td>
- <td><code>45</code></td>
- <td><code>The number of milliseconds passed from a configured epoch.</code></td>
- </tr>
- <tr>
- <th scope="row">2</th>
- <td><code>sequence</code></td>
- <td><code>12</code></td>
- <td><code>A sequence number rolling out whenever required.</code></td>
- </tr>
- <tr>
- <th scope="row">3</th>
- <td><code>machine</code></td>
- <td><code>7</code></td>
- <td><code>An identifier for the worker, between 0 and 127.</code></td>
- </tr>
- </tbody>
- </table>
-
- <p>
- Therefore, Clawflake ID numbers gives <mark>2<sup>45</sup> - 1 = 1115.7</mark> years
- of safety from the configured epoch.
- Thanks to the sequence number, a worker can handle <mark>2<sup>12</sup> = 4069</mark>
- generations per milliseconds at peak.
- The system can accept a maximum of <mark>2<sup>7</sup> = 128</mark> machines for a
- given epoch.
- </p>
-
- <cite>
- Since Clawflake uses the most significant bit, converting a Clawflake ID
- from <i>uint64</i> to <i>int64</i> is not safe.
- </cite>
-
- <h2>Usage</h2>
-
- <p>
- Before launching any worker, you need to determine the following
- information:
-
- <ul>
- <li><i>epoch</i>: corresponds to the epoch workers will be using to
- generate IDs.</li>
- <li><i>machine</i>: the identifier for the machine.</li>
- </ul>
- </p>
-
- <p>
- Due to the format of a Clawflake, you can only have 128 workers (machine IDs
- between 0 and 127).
- </p>
-
- <p>
- You can compile the worker by running
-
- <pre><code lang="language-bash">make generator</code></pre>
-
- This will generate an executable named <code>generator</code> inside the
- <code>bin</code> directory.
- </p>
-
- <p>
- You can then start the worker by running:
-
- <pre><code class="language-bash">
- export MACHINE_ID= # Worker ID, between 0 and 127
- export EPOCH= # Epoch to use in ID generation
- ./bin/generator -machine_id=$MACHINE_ID -epoch=$EPOCH -grpc_host=":5000"
- </code></pre>
-
- <strong>TIP:</strong> Use the flag <code>-help</code> to view the
- documentation for the flags.
- </p>
-
- <p>
- A worker should be running on port <code>5000</code>. You can try generating some
- Clawflake ID numbers using the
- <a href="https://github.com/n1c00o/clawflake/blob/master/api/nicolaspl/clawflake/generator/v3/generator.proto">
- Generator API
- </a>.
- </p>
-
- <p>A test client is available in <a
- href="https://github.com/n1c00o/clawflake/blob/master/cmd/testclient/main.go">cmd/testclient/main.go</a>.</p>
-
- <h2>License</h2>
-
- <p>
- Clawflake is governed by a BSD-style license that can be found in the
- <a href="https://github.com/n1c00o/clawflake/blob/master/LICENSE"><code>LICENSE</code></a> file.
- </p>
-
- <p>
- Older codebase was licensed by the Apache License, Version 2.0, however
- none of the old code still exists.
- </p>
- </main>
-
- <footer class="container">
- <div class="grid">
- <div>
- <p><strong>© 2022. Nicolas "nc0" P.</strong></p>
- </div>
- <div>
- <h3>Links</h3>
- <ul>
- <li><a href="https://nicolaspl.com">Nicolas Paul</a></li>
- <li><a href="/">Site</a></li>
- <li><a href="https://github.com/n1c00o/clawflake">Source</a></li>
- <li><a href="/license.txt">License</a></li>
- </ul>
- </div>
- </div>
- </footer>
-</body>
-
-</html> \ No newline at end of file