Skip to content

Commit 8a9875b

Browse files
docs(block-fs): update readme (diagrams)
1 parent b5416bd commit 8a9875b

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

packages/block-fs/README.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,33 @@ entries/sizes. The default [`Entry`
9696
implementation](https://docs.thi.ng/umbrella/block-fs/classes/Entry.html)
9797
requires 64 bytes.
9898

99-
TODO diagram
99+
![Memory layout diagram for a single directory entry](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/direntry-01.png)
100100

101101
#### File blocks
102102

103103
Files are stored as linked lists of blocks, with the first few bytes of each
104-
block reserved for linkage and number of data bytes in the block. The number of
105-
bytes effectively available for data depends on the configured block size and
106-
the max. number of blocks in the storage backend.
104+
block reserved for linkage and number of data bytes in the block.
107105

108-
TODO diagram
106+
![Memory layout diagram for a single file block](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-01.png)
107+
108+
The number of bytes effectively available for data depends on the configured
109+
block size and the max. number of blocks in the storage backend. For example, a
110+
max. block count of 65536 and a block size of 256 bytes only requires a two
111+
bytes for linkage and a third byte for storing the number of data bytes used in
112+
the block. Hence, in this configuration 253 bytes per block are available for
113+
data.
114+
115+
The following diagram shows a block which links to block ID 0x1234 and uses the
116+
full 253 (0xfd in hex) bytes of data available:
117+
118+
![Memory layout diagram for a single file block](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-02.png)
119+
120+
The last block of a file uses a special sentinel marker to indicate that no
121+
other blocks follow. This sentinel value again depends on the configured max.
122+
block count, and in this example is 0xffff. This example block only stores 64
123+
(0x40 in hex) bytes of data, with the remainder zeroed out.
124+
125+
![Memory layout diagram for a sentinel file block](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-03.png)
109126

110127
### Command line app
111128

packages/block-fs/tpl.readme.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,33 @@ entries/sizes. The default [`Entry`
6565
implementation](https://docs.thi.ng/umbrella/block-fs/classes/Entry.html)
6666
requires 64 bytes.
6767

68-
TODO diagram
68+
![Memory layout diagram for a single directory entry](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/direntry-01.png)
6969

7070
#### File blocks
7171

7272
Files are stored as linked lists of blocks, with the first few bytes of each
73-
block reserved for linkage and number of data bytes in the block. The number of
74-
bytes effectively available for data depends on the configured block size and
75-
the max. number of blocks in the storage backend.
73+
block reserved for linkage and number of data bytes in the block.
7674

77-
TODO diagram
75+
![Memory layout diagram for a single file block](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-01.png)
76+
77+
The number of bytes effectively available for data depends on the configured
78+
block size and the max. number of blocks in the storage backend. For example, a
79+
max. block count of 65536 and a block size of 256 bytes only requires a two
80+
bytes for linkage and a third byte for storing the number of data bytes used in
81+
the block. Hence, in this configuration 253 bytes per block are available for
82+
data.
83+
84+
The following diagram shows a block which links to block ID 0x1234 and uses the
85+
full 253 (0xfd in hex) bytes of data available:
86+
87+
![Memory layout diagram for a single file block](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-02.png)
88+
89+
The last block of a file uses a special sentinel marker to indicate that no
90+
other blocks follow. This sentinel value again depends on the configured max.
91+
block count, and in this example is 0xffff. This example block only stores 64
92+
(0x40 in hex) bytes of data, with the remainder zeroed out.
93+
94+
![Memory layout diagram for a sentinel file block](https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-03.png)
7895

7996
### Command line app
8097

0 commit comments

Comments
 (0)