@thi.ng/block-fs 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/README.md +22 -5
- package/entry.d.ts +4 -4
- package/entry.js +18 -18
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-04-
|
|
3
|
+
- **Last updated**: 2025-04-16T11:11:14Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
### [0.4.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/block-fs@0.4.1) (2025-04-16)
|
|
15
|
+
|
|
16
|
+
#### ♻️ Refactoring
|
|
17
|
+
|
|
18
|
+
- update Entry memory layout ([b5416bd](https://github.com/thi-ng/umbrella/commit/b5416bd))
|
|
19
|
+
- move block start & end ID locations
|
|
20
|
+
|
|
14
21
|
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/block-fs@0.4.0) (2025-04-06)
|
|
15
22
|
|
|
16
23
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -96,16 +96,33 @@ entries/sizes. The default [`Entry`
|
|
|
96
96
|
implementation](https://docs.thi.ng/umbrella/block-fs/classes/Entry.html)
|
|
97
97
|
requires 64 bytes.
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+

|
|
100
100
|
|
|
101
101
|
#### File blocks
|
|
102
102
|
|
|
103
103
|
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.
|
|
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.
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+

|
|
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
|
+

|
|
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
|
+

|
|
109
126
|
|
|
110
127
|
### Command line app
|
|
111
128
|
|
package/entry.d.ts
CHANGED
|
@@ -20,16 +20,16 @@ export declare class Entry implements IEntry {
|
|
|
20
20
|
set owner(owner: number);
|
|
21
21
|
get name(): string;
|
|
22
22
|
set name(name: string);
|
|
23
|
+
get start(): number;
|
|
24
|
+
set start(block: number);
|
|
25
|
+
get end(): number;
|
|
26
|
+
set end(block: number);
|
|
23
27
|
get size(): bigint;
|
|
24
28
|
set size(size: bigint);
|
|
25
29
|
get ctime(): number;
|
|
26
30
|
set ctime(epoch: number);
|
|
27
31
|
get mtime(): number;
|
|
28
32
|
set mtime(epoch: number);
|
|
29
|
-
get start(): number;
|
|
30
|
-
set start(block: number);
|
|
31
|
-
get end(): number;
|
|
32
|
-
set end(block: number);
|
|
33
33
|
set(spec: EntrySpec): void;
|
|
34
34
|
release(): void;
|
|
35
35
|
save(): Promise<void>;
|
package/entry.js
CHANGED
|
@@ -66,35 +66,35 @@ class Entry {
|
|
|
66
66
|
this.data.subarray(offset, offset + Entry.NAME_MAX_LENGTH)
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
+
get start() {
|
|
70
|
+
return this.view.getUint32(32, true);
|
|
71
|
+
}
|
|
72
|
+
set start(block) {
|
|
73
|
+
this.view.setUint32(32, block, true);
|
|
74
|
+
}
|
|
75
|
+
get end() {
|
|
76
|
+
return this.view.getUint32(36, true);
|
|
77
|
+
}
|
|
78
|
+
set end(block) {
|
|
79
|
+
this.view.setUint32(36, block, true);
|
|
80
|
+
}
|
|
69
81
|
get size() {
|
|
70
|
-
return this.view.getBigUint64(
|
|
82
|
+
return this.view.getBigUint64(40, true);
|
|
71
83
|
}
|
|
72
84
|
set size(size) {
|
|
73
|
-
this.view.setBigUint64(
|
|
85
|
+
this.view.setBigUint64(40, size, true);
|
|
74
86
|
}
|
|
75
87
|
get ctime() {
|
|
76
|
-
return Number(this.view.getBigUint64(
|
|
88
|
+
return Number(this.view.getBigUint64(48, true));
|
|
77
89
|
}
|
|
78
90
|
set ctime(epoch) {
|
|
79
|
-
this.view.setBigUint64(
|
|
91
|
+
this.view.setBigUint64(48, BigInt(epoch), true);
|
|
80
92
|
}
|
|
81
93
|
get mtime() {
|
|
82
|
-
return Number(this.view.getBigUint64(
|
|
94
|
+
return Number(this.view.getBigUint64(56, true));
|
|
83
95
|
}
|
|
84
96
|
set mtime(epoch) {
|
|
85
|
-
this.view.setBigUint64(
|
|
86
|
-
}
|
|
87
|
-
get start() {
|
|
88
|
-
return this.view.getUint32(56, true);
|
|
89
|
-
}
|
|
90
|
-
set start(block) {
|
|
91
|
-
this.view.setUint32(56, block, true);
|
|
92
|
-
}
|
|
93
|
-
get end() {
|
|
94
|
-
return this.view.getUint32(60, true);
|
|
95
|
-
}
|
|
96
|
-
set end(block) {
|
|
97
|
-
this.view.setUint32(60, block, true);
|
|
97
|
+
this.view.setBigUint64(56, BigInt(epoch), true);
|
|
98
98
|
}
|
|
99
99
|
set(spec) {
|
|
100
100
|
this.type = spec.type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/block-fs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Customizable block-based storage, adapters & file system layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@thi.ng/api": "^8.11.
|
|
46
|
-
"@thi.ng/args": "^2.3.
|
|
47
|
-
"@thi.ng/binary": "^3.4.
|
|
48
|
-
"@thi.ng/bitfield": "^2.4.
|
|
49
|
-
"@thi.ng/checks": "^3.7.
|
|
50
|
-
"@thi.ng/errors": "^2.5.
|
|
51
|
-
"@thi.ng/file-io": "^2.1.
|
|
52
|
-
"@thi.ng/logger": "^3.1.
|
|
53
|
-
"@thi.ng/mime": "^2.7.
|
|
54
|
-
"@thi.ng/random": "^4.1.
|
|
55
|
-
"@thi.ng/strings": "^3.9.
|
|
45
|
+
"@thi.ng/api": "^8.11.26",
|
|
46
|
+
"@thi.ng/args": "^2.3.67",
|
|
47
|
+
"@thi.ng/binary": "^3.4.49",
|
|
48
|
+
"@thi.ng/bitfield": "^2.4.1",
|
|
49
|
+
"@thi.ng/checks": "^3.7.6",
|
|
50
|
+
"@thi.ng/errors": "^2.5.32",
|
|
51
|
+
"@thi.ng/file-io": "^2.1.35",
|
|
52
|
+
"@thi.ng/logger": "^3.1.7",
|
|
53
|
+
"@thi.ng/mime": "^2.7.8",
|
|
54
|
+
"@thi.ng/random": "^4.1.17",
|
|
55
|
+
"@thi.ng/strings": "^3.9.11"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/node": "^22.
|
|
58
|
+
"@types/node": "^22.14.1",
|
|
59
59
|
"esbuild": "^0.25.2",
|
|
60
|
-
"typedoc": "^0.28.
|
|
61
|
-
"typescript": "^5.8.
|
|
60
|
+
"typedoc": "^0.28.2",
|
|
61
|
+
"typescript": "^5.8.3"
|
|
62
62
|
},
|
|
63
63
|
"keywords": [
|
|
64
64
|
"async",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"status": "alpha",
|
|
133
133
|
"year": 2024
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "c464b6948f92cba90c2ea75b59203dad894fb450\n"
|
|
136
136
|
}
|