sliftutils 1.7.10 → 1.7.12

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 (84) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/examplestorage/exampleserver.ts +0 -2
  3. package/index.d.ts +301 -54
  4. package/misc/dist/environment.ts.cache +3 -3
  5. package/misc/dist/getSecret.ts.cache +139 -0
  6. package/misc/dist/strings.ts.cache +13 -0
  7. package/misc/dist/zip.ts.cache +9 -0
  8. package/misc/getSecret.ts +38 -16
  9. package/misc/https/cloudflareHelpers.d.ts +19 -0
  10. package/misc/https/cloudflareHelpers.ts +69 -0
  11. package/misc/https/dist/certs.ts.cache +115 -179
  12. package/misc/https/dist/cloudflareHelpers.ts.cache +68 -0
  13. package/misc/https/dist/dns.ts.cache +112 -100
  14. package/misc/https/dist/hostServer.ts.cache +130 -0
  15. package/misc/https/dist/httpsCerts.ts.cache +24 -5
  16. package/misc/https/dist/persistentLocalStorage.ts.cache +3 -2
  17. package/misc/https/dns.d.ts +41 -12
  18. package/misc/https/dns.ts +104 -101
  19. package/misc/https/hostServer.d.ts +0 -6
  20. package/misc/https/hostServer.ts +9 -5
  21. package/package.json +2 -2
  22. package/render-utils/dist/observer.tsx.cache +3 -2
  23. package/spec.txt +0 -90
  24. package/storage/ArchivesDisk.d.ts +2 -0
  25. package/storage/ArchivesDisk.ts +7 -3
  26. package/storage/BulkDatabase2/dist/BulkDatabaseBase.ts.cache +1242 -0
  27. package/storage/BulkDatabase2/dist/BulkDatabaseFormat.ts.cache +513 -0
  28. package/storage/BulkDatabase2/dist/BulkDatabaseMerge.ts.cache +352 -0
  29. package/storage/BulkDatabase2/dist/BulkDatabaseReader.ts.cache +306 -0
  30. package/storage/BulkDatabase2/dist/LoadedIndex.ts.cache +435 -0
  31. package/storage/BulkDatabase2/dist/WriteOverlay.ts.cache +58 -0
  32. package/storage/BulkDatabase2/dist/blockCache.ts.cache +179 -0
  33. package/storage/BulkDatabase2/dist/mergeLock.ts.cache +149 -0
  34. package/storage/BulkDatabase2/dist/mergeMarkers.ts.cache +101 -0
  35. package/storage/BulkDatabase2/dist/streamLog.ts.cache +227 -0
  36. package/storage/BulkDatabase2/dist/syncClient.ts.cache +104 -0
  37. package/storage/IArchives.d.ts +47 -15
  38. package/storage/IArchives.ts +86 -31
  39. package/storage/backblaze.d.ts +15 -0
  40. package/storage/backblaze.ts +199 -79
  41. package/storage/dist/ArchivesDisk.ts.cache +373 -0
  42. package/storage/dist/FileFolderAPI.tsx.cache +508 -65
  43. package/storage/dist/IArchives.ts.cache +44 -0
  44. package/storage/dist/IndexedDBFileFolderAPI.ts.cache +8 -2
  45. package/storage/dist/JSONStorage.ts.cache +6 -2
  46. package/storage/dist/PendingManager.tsx.cache +1 -1
  47. package/storage/dist/TransactionStorage.ts.cache +231 -92
  48. package/storage/dist/backblaze.ts.cache +797 -0
  49. package/storage/dist/fileSystemPointer.ts.cache +36 -3
  50. package/storage/dist/remoteFileStorage.ts.cache +495 -0
  51. package/storage/remoteStorage/ArchivesRemote.d.ts +5 -1
  52. package/storage/remoteStorage/ArchivesRemote.ts +28 -8
  53. package/storage/remoteStorage/ArchivesUrl.d.ts +2 -0
  54. package/storage/remoteStorage/ArchivesUrl.ts +16 -4
  55. package/storage/remoteStorage/blobStore.d.ts +63 -3
  56. package/storage/remoteStorage/blobStore.ts +419 -101
  57. package/storage/remoteStorage/createArchives.d.ts +31 -10
  58. package/storage/remoteStorage/createArchives.ts +470 -253
  59. package/storage/remoteStorage/dist/ArchivesRemote.ts.cache +197 -0
  60. package/storage/remoteStorage/dist/ArchivesUrl.ts.cache +85 -0
  61. package/storage/remoteStorage/dist/accessPage.tsx.cache +222 -0
  62. package/storage/remoteStorage/dist/blobStore.ts.cache +837 -0
  63. package/storage/remoteStorage/dist/cliArgs.ts.cache +16 -0
  64. package/storage/remoteStorage/dist/createArchives.ts.cache +610 -0
  65. package/storage/remoteStorage/dist/remoteConfig.ts.cache +206 -0
  66. package/storage/remoteStorage/dist/sourceWrapper.ts.cache +223 -0
  67. package/storage/remoteStorage/dist/storageController.ts.cache +500 -0
  68. package/storage/remoteStorage/dist/storageServer.ts.cache +106 -0
  69. package/storage/remoteStorage/dist/storageServerCli.ts.cache +39 -0
  70. package/storage/remoteStorage/dist/storageServerState.ts.cache +518 -0
  71. package/storage/remoteStorage/remoteConfig.d.ts +8 -0
  72. package/storage/remoteStorage/remoteConfig.ts +105 -5
  73. package/storage/remoteStorage/sourceWrapper.d.ts +41 -0
  74. package/storage/remoteStorage/sourceWrapper.ts +223 -0
  75. package/storage/remoteStorage/spec.md +31 -0
  76. package/storage/remoteStorage/storageController.d.ts +11 -0
  77. package/storage/remoteStorage/storageController.ts +109 -40
  78. package/storage/remoteStorage/storageServer.d.ts +0 -5
  79. package/storage/remoteStorage/storageServer.ts +17 -10
  80. package/storage/remoteStorage/storageServerCli.ts +0 -3
  81. package/storage/remoteStorage/storageServerState.d.ts +7 -1
  82. package/storage/remoteStorage/storageServerState.ts +230 -48
  83. package/testsite/server.ts +0 -2
  84. package/yarn.lock +11 -6
package/spec.txt CHANGED
@@ -1,95 +1,5 @@
1
1
 
2
2
 
3
- IMPORTANT! modified time PLUS size is what's important. Store both!
4
3
 
5
4
 
6
- 1) Tests locally, running it in Slift utils and running some code in CYOA to access it.
7
- 2) Set up a bootstrapper that we can chain with another command that will set up secrets, cloudflare key, etc
8
- yarn exposesecrets && yarn storageserver --url https://storage.vidgridweb.com:4446 --folder ~/storagetest
9
- - The bootstrapper needs to write to "cloudflare.json" and "backblaze.json"
10
- - Using our sync server secrets. Not sure if they're stored in there, but, you know, easy enough...
11
5
 
12
- 3) Verify backblaze works, verify basically all the features work.
13
-
14
-
15
-
16
-
17
- 3) Support sharding in synchronization sources as well, adding new field
18
- route: {
19
- range: [number, number];
20
- level: number;
21
- }
22
- - Route level is required as if two things have different route ranges, they obviously aren't going to be pulling from each other. So we need another way to stack redundancy, and the route level can do that. If two things are at the same route level, it means they aren't using each other for redundancy. We could automatically detect this, but it's more clear if it's explicit.
23
-
24
- 3.1) We will almost always set up copy files on our different shards, but of course, these will only be considered depending on the valid window.
25
- 3.2) Of course, having our site configuration support sharding as well. So you don't need to fiddle with the shards. You kind of just say there are a certain number of shards. And if you want to change the shards, it will automatically set them up in the future, applying a default switch time of a day that you can also configure yourself, etc.
26
-
27
-
28
-
29
-
30
- 5) Shard retry writes - Basically, they give us part of a path, and part of it we can fill in ourselves. We try to keep track of which shards are down and if a shard is down, we will keep changing that random value until we find something that doesn't match that shard Until we hit a certain percentage of shards being down, probably greater than 99%. And then we return the path that we ended up using.
31
- - This solves the problem of not being able to write to the backup sources. As it'll mean you'll be able to read if a shard is down, and you'll also be able to write if a shard is down. So it'll be like everything's fine.
32
- - We only need to use this for certain important things like uploading images. pretty much all of the AI stuff, we can probably use it.
33
- HMMM!!! This causes problems if we want it to be an image or a video. So we should probably have it so by default we try to put nothing there, So it'll be the exact path the user requested. That way, if they try to do the same right multiple times, it'll clobber itself.
34
- - Although realistically, I don't think it'll really matter. because we're not generating the same content most of the time.
35
- 6) geographical sharding as well. Which tries to change the hash so it's the server that we're closest to
36
- - This can massively reduce the write latency, Which is important because we don't want to have to send the data around all the time, we just want to send around the URLs. Well then this requires waiting for the remote to confirm that we can read back. which will be purely limited really on latency if it's close to us.
37
-
38
- 7) readerDiskLimit. Only when our first sync source has copyFiles is false and cacheReads is true (and required true). Once we copy over a certain amount, we start deleting the least recently used from our local cache. This allows us to cache large sources without getting overwhelmed.
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
- 2) Use our machine configuration to setup a storage service
50
-
51
- 2.1) cyoa page to setup services + VIEW their storagerouting.JSON
52
- WE DO NOT want to configure it via the interface! We want the configuration to always be in code. That way, we can update one place and all of our buckets will update!
53
- OH! Make something that will import all of our code just like in a deploy, and then we'll gather all of the bucket configurations that we created using our helper functions so we register them all, and then we'll touch them all to make sure the configuration is updated on all of them!
54
- - We should probably make a factory so we can easily create buckets without having to find the full chain every single time, and so we can change the full chain easily in one place.
55
- - We should allow easily chaining them for redundancy
56
- - We might even have some UI that shows all of the storage services together, allowing you to easily configure how they chain, etc.
57
- - We should also have it poll for the status of like scanning file stats, etc.
58
-
59
- 2.2) Test some of these custom buckets on CYOA (local dev), testing redundancy, speed, etc.
60
- - If we run into a lot of issues that we need to debug, we can always host the storage server locally.
61
-
62
- custom => backblaze
63
- - So internal redundancy and then also backblaze at the very end
64
- 2.3) Test using our thing as a front end for back plays with no copy, which should mean there's really no setup.
65
- - Just test reading images or something.
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
- ArchivesRemote
74
- bucketName
75
- public
76
- fast
77
- writeDelay
78
-
79
- ArchivesFactory
80
- host: https://storage.vidgridweb.com:4444/storagerouting.json
81
- redundantHosts:
82
- - https://storage2.vidgridweb.com:4445/storagerouting.json
83
- - https://f002.backblazeb2.com/file/querysubtest-com-public-immutable/storage/storagerouting.json
84
-
85
- HostStorageServerConfig
86
- host: https://storage.vidgridweb.com:4444/storagerouting.json
87
- redundantHosts:
88
- - https://storage.vidgridweb.com:4444/storagerouting.json
89
- - https://storage2.vidgridweb.com:4445/storagerouting.json
90
- - https://f002.backblazeb2.com/file/querysubtest-com-public-immutable/storage/storagerouting.json
91
- folder: os.homedir() + "/storage"
92
- cloudflareApiToken: ...
93
-
94
-
95
- https://f002.backblazeb2.com/file/querysubtest-com-public-immutable/image/img_00BloAFyIevA_1024x1536.jpg
@@ -16,6 +16,7 @@ export declare class ArchivesDisk implements IArchives {
16
16
  };
17
17
  getDebugName(): string;
18
18
  getConfig(): Promise<ArchivesConfig>;
19
+ hasWriteAccess(): Promise<boolean>;
19
20
  private filePath;
20
21
  set(key: string, data: Buffer, config?: {
21
22
  lastModified?: number;
@@ -35,6 +36,7 @@ export declare class ArchivesDisk implements IArchives {
35
36
  }): Promise<{
36
37
  data: Buffer;
37
38
  writeTime: number;
39
+ size: number;
38
40
  } | undefined>;
39
41
  getInfo(key: string): Promise<{
40
42
  writeTime: number;
@@ -132,6 +132,10 @@ export class ArchivesDisk implements IArchives {
132
132
  return {};
133
133
  }
134
134
 
135
+ public async hasWriteAccess(): Promise<boolean> {
136
+ return true;
137
+ }
138
+
135
139
  private filePath(key: string): string {
136
140
  let result = path.join(this.filesDir, key);
137
141
  if (!result.startsWith(this.filesDir + path.sep)) {
@@ -181,7 +185,7 @@ export class ArchivesDisk implements IArchives {
181
185
  return result && result.data || undefined;
182
186
  }
183
187
 
184
- public async get2(key: string, config?: { range?: { start: number; end: number } }): Promise<{ data: Buffer; writeTime: number } | undefined> {
188
+ public async get2(key: string, config?: { range?: { start: number; end: number } }): Promise<{ data: Buffer; writeTime: number; size: number } | undefined> {
185
189
  await this.init();
186
190
  let range = config?.range;
187
191
  let filePath = this.filePath(key);
@@ -197,13 +201,13 @@ export class ArchivesDisk implements IArchives {
197
201
  let size = stats.size;
198
202
  let start = range && Math.min(range.start, size) || 0;
199
203
  let end = range && Math.min(range.end, size) || size;
200
- if (end <= start) return { data: Buffer.alloc(0), writeTime: stats.mtimeMs };
204
+ if (end <= start) return { data: Buffer.alloc(0), writeTime: stats.mtimeMs, size };
201
205
  let buffer = Buffer.alloc(end - start);
202
206
  let { bytesRead } = await handle.read(buffer, 0, buffer.length, start);
203
207
  if (bytesRead !== buffer.length) {
204
208
  throw new Error(`Expected ${buffer.length} bytes at ${filePath}:${start}, read ${bytesRead}`);
205
209
  }
206
- return { data: buffer, writeTime: stats.mtimeMs };
210
+ return { data: buffer, writeTime: stats.mtimeMs, size };
207
211
  });
208
212
  }
209
213