@archildata/client 0.1.0 → 0.1.3

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