@archildata/client 0.1.0 → 0.1.2
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/README.md +50 -19
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @archildata/client
|
|
2
2
|
|
|
3
3
|
High-performance Node.js bindings for the Archil distributed filesystem client.
|
|
4
4
|
|
|
@@ -9,33 +9,44 @@ This package provides low-level N-API bindings to the Archil client library, exp
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @
|
|
12
|
+
npm install @archildata/client
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Supported Platforms
|
|
16
|
+
|
|
17
|
+
This package includes pre-built binaries for:
|
|
18
|
+
|
|
19
|
+
- **macOS** (Apple Silicon) - `darwin-arm64`
|
|
20
|
+
- **Linux** (x86_64) - `linux-x64-gnu`
|
|
21
|
+
- **Linux** (ARM64) - `linux-arm64-gnu`
|
|
22
|
+
|
|
23
|
+
Other platforms are not currently supported.
|
|
24
|
+
|
|
15
25
|
## Usage
|
|
16
26
|
|
|
17
27
|
```typescript
|
|
18
|
-
import { ArchilClient } from '@
|
|
28
|
+
import { ArchilClient } from '@archildata/client';
|
|
19
29
|
|
|
20
|
-
// Connect to Archil
|
|
21
|
-
const client = await ArchilClient.
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
// Connect to Archil
|
|
31
|
+
const client = await ArchilClient.connect({
|
|
32
|
+
region: 'aws-us-east-1',
|
|
33
|
+
diskName: 'myaccount/mydisk',
|
|
34
|
+
authToken: process.env.ARCHIL_TOKEN, // optional, uses IAM if not provided
|
|
24
35
|
});
|
|
25
36
|
|
|
26
37
|
// Get root directory attributes
|
|
27
|
-
const rootAttrs = await client.getAttributes(
|
|
38
|
+
const rootAttrs = await client.getAttributes(1);
|
|
28
39
|
console.log('Root size:', rootAttrs.size);
|
|
29
40
|
|
|
30
41
|
// List directory contents
|
|
31
|
-
const entries = await client.readDirectory(
|
|
42
|
+
const entries = await client.readDirectory(1);
|
|
32
43
|
for (const entry of entries) {
|
|
33
44
|
console.log(`${entry.name} (inode: ${entry.inodeId})`);
|
|
34
45
|
}
|
|
35
46
|
|
|
36
47
|
// Read a file
|
|
37
|
-
const lookup = await client.lookupInode(
|
|
38
|
-
const data = await client.readInode(lookup.inodeId,
|
|
48
|
+
const lookup = await client.lookupInode(1, 'myfile.txt');
|
|
49
|
+
const data = await client.readInode(lookup.inodeId, 0, 1024);
|
|
39
50
|
console.log('File content:', data.toString());
|
|
40
51
|
|
|
41
52
|
// Close when done
|
|
@@ -50,8 +61,8 @@ The main client class for interacting with Archil filesystems.
|
|
|
50
61
|
|
|
51
62
|
#### Connection Methods
|
|
52
63
|
|
|
64
|
+
- `connect(config)` - Connect using region and disk name (recommended)
|
|
53
65
|
- `connectDirect(config)` - Connect directly to a server (for testing)
|
|
54
|
-
- `connectAuthenticated(config)` - Connect via mount server with authentication
|
|
55
66
|
|
|
56
67
|
#### Metadata Operations
|
|
57
68
|
|
|
@@ -64,34 +75,45 @@ The main client class for interacting with Archil filesystems.
|
|
|
64
75
|
#### Data Operations
|
|
65
76
|
|
|
66
77
|
- `readInode(inodeId, offset, length, user?)` - Read file data
|
|
78
|
+
- `writeData(inodeId, offset, data, user?)` - Write file data (requires delegation)
|
|
79
|
+
- `sync()` - Sync all pending writes to server
|
|
67
80
|
|
|
68
81
|
#### Delegation Operations
|
|
69
82
|
|
|
70
83
|
- `checkout(inodeId, force?, user?)` - Acquire write delegation
|
|
71
84
|
- `checkin(inodeId, user?)` - Release delegation
|
|
72
85
|
- `checkinAll()` - Release all delegations
|
|
86
|
+
- `listDelegations()` - List currently held delegations
|
|
73
87
|
|
|
74
88
|
#### Mutation Operations
|
|
75
89
|
|
|
76
|
-
- `
|
|
90
|
+
- `create(parentInodeId, name, attributes, user?)` - Create file/directory
|
|
91
|
+
- `unlink(parentInodeId, name, user?)` - Delete file or empty directory
|
|
92
|
+
- `rename(parentInodeId, name, newParentInodeId, newName, user?)` - Move/rename
|
|
93
|
+
- `setattr(inodeId, options, user)` - Update file attributes
|
|
77
94
|
- `setImmutable(inodeId)` - Mark subtree as immutable
|
|
78
95
|
- `setMutable(inodeId)` - Mark subtree as mutable
|
|
79
96
|
- `listImmutableSubtrees()` - List immutable roots
|
|
80
97
|
|
|
81
98
|
### Types
|
|
82
99
|
|
|
83
|
-
All inode IDs and file offsets use JavaScript `bigint` for 64-bit support:
|
|
84
|
-
|
|
85
100
|
```typescript
|
|
101
|
+
interface SimpleConnectionConfig {
|
|
102
|
+
region: string; // e.g., "aws-us-east-1"
|
|
103
|
+
diskName: string; // e.g., "myaccount/mydisk"
|
|
104
|
+
authToken?: string; // optional, uses IAM if not provided
|
|
105
|
+
logLevel?: string; // optional: "trace", "debug", "info", "warn", "error"
|
|
106
|
+
}
|
|
107
|
+
|
|
86
108
|
interface UnixUser {
|
|
87
109
|
uid: number;
|
|
88
110
|
gid: number;
|
|
89
111
|
}
|
|
90
112
|
|
|
91
113
|
interface InodeAttributes {
|
|
92
|
-
inodeId:
|
|
114
|
+
inodeId: number;
|
|
93
115
|
inodeType: 'File' | 'Directory' | 'Symlink' | ...;
|
|
94
|
-
size:
|
|
116
|
+
size: number;
|
|
95
117
|
uid: number;
|
|
96
118
|
gid: number;
|
|
97
119
|
mode: number;
|
|
@@ -100,15 +122,24 @@ interface InodeAttributes {
|
|
|
100
122
|
atimeMs: number;
|
|
101
123
|
mtimeMs: number;
|
|
102
124
|
btimeMs: number;
|
|
103
|
-
rdev?:
|
|
125
|
+
rdev?: number;
|
|
104
126
|
symlinkTarget?: string;
|
|
105
127
|
}
|
|
106
128
|
|
|
107
129
|
interface DirectoryEntry {
|
|
108
130
|
name: string;
|
|
109
|
-
inodeId:
|
|
131
|
+
inodeId: number;
|
|
110
132
|
inodeType: string;
|
|
111
133
|
}
|
|
134
|
+
|
|
135
|
+
interface SetAttrOptions {
|
|
136
|
+
mode?: number;
|
|
137
|
+
uid?: number;
|
|
138
|
+
gid?: number;
|
|
139
|
+
size?: number;
|
|
140
|
+
atimeMs?: number; // use -1 for current time
|
|
141
|
+
mtimeMs?: number; // use -1 for current time
|
|
142
|
+
}
|
|
112
143
|
```
|
|
113
144
|
|
|
114
145
|
## Building
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archildata/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "High-performance Node.js client for Archil distributed filesystem",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"native"
|
|
50
50
|
],
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"@archildata/client-win32-x64-msvc": "0.1.
|
|
53
|
-
"@archildata/client-darwin-x64": "0.1.
|
|
54
|
-
"@archildata/client-linux-x64-gnu": "0.1.
|
|
55
|
-
"@archildata/client-darwin-arm64": "0.1.
|
|
56
|
-
"@archildata/client-linux-arm64-gnu": "0.1.
|
|
52
|
+
"@archildata/client-win32-x64-msvc": "0.1.2",
|
|
53
|
+
"@archildata/client-darwin-x64": "0.1.2",
|
|
54
|
+
"@archildata/client-linux-x64-gnu": "0.1.2",
|
|
55
|
+
"@archildata/client-darwin-arm64": "0.1.2",
|
|
56
|
+
"@archildata/client-linux-arm64-gnu": "0.1.2"
|
|
57
57
|
}
|
|
58
58
|
}
|