diff --git a/.changeset/curly-cars-cry.md b/.changeset/curly-cars-cry.md new file mode 100644 index 00000000..070723c9 --- /dev/null +++ b/.changeset/curly-cars-cry.md @@ -0,0 +1,5 @@ +--- +'@tus/server': patch +--- + +Document `locker` option and fix dead links in README diff --git a/.changeset/nervous-timers-stare.md b/.changeset/nervous-timers-stare.md new file mode 100644 index 00000000..0b8122f3 --- /dev/null +++ b/.changeset/nervous-timers-stare.md @@ -0,0 +1,6 @@ +--- +'@tus/file-store': patch +'@tus/s3-store': patch +--- + +Fix dead links in README diff --git a/packages/file-store/README.md b/packages/file-store/README.md index f3e876b4..1e7debe4 100644 --- a/packages/file-store/README.md +++ b/packages/file-store/README.md @@ -142,4 +142,4 @@ See [`contributing.md`](https://github.com/tus/tus-node-server/blob/main/.github [concatenation]: https://tus.io/protocols/resumable-upload.html#concatenation [`cleanUpExpiredUploads`]: https://github.com/tus/tus-node-server/tree/main/packages/server#cleanupexpireduploads [kvstores]: https://github.com/tus/tus-node-server/tree/main/packages/server#kvstores -[`KvStore`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/kvstores/Types.ts +[`KvStore`]: https://github.com/tus/tus-node-server/blob/main/packages/utils/src/kvstores/Types.ts diff --git a/packages/s3-store/README.md b/packages/s3-store/README.md index b0f1afda..3a54030f 100644 --- a/packages/s3-store/README.md +++ b/packages/s3-store/README.md @@ -101,10 +101,8 @@ The ideal value for `maxConcurrentPartUploads` varies based on your `partSize` a - **Lowering the Value**: Reducing `maxConcurrentPartUploads` decreases the number of simultaneous upload requests to S3. This can be beneficial for conserving memory, CPU, and disk I/O resources, especially in environments with limited system resources or where the upload speed it low or the part size is large. - - **Increasing the Value**: A higher value potentially enhances the data transfer rate to the server, but at the cost of increased resource usage (memory, CPU, and disk I/O). This can be advantageous when the goal is to maximize throughput, and sufficient system resources are available. - - **Bandwidth Considerations**: It's important to note that if your upload bandwidth to S3 is a limiting factor, increasing `maxConcurrentPartUploads` won’t lead to higher throughput. Instead, it will result in additional resource consumption without proportional gains in transfer speed. ## Extensions @@ -202,4 +200,4 @@ See [`contributing.md`](https://github.com/tus/tus-node-server/blob/main/.github [cleanExpiredUploads]: https://github.com/tus/tus-node-server/tree/main/packages/server#servercleanupexpireduploads [lifecyle]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html [kvstores]: https://github.com/tus/tus-node-server/tree/main/packages/server#kvstores -[`KvStore`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/kvstores/Types.ts +[`KvStore`]: https://github.com/tus/tus-node-server/blob/main/packages/utils/src/kvstores/Types.ts diff --git a/packages/server/README.md b/packages/server/README.md index dd6c626d..cf1f768b 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -91,16 +91,14 @@ If you change that you have to use `getFileIdFromRequest` as well. A common use case of this function and `getFileIdFromRequest` is to base65 encode a complex id into the URL. -> [!TIP] -> Checkout the example how to [store files in custom nested directories](#example-store-files-in-custom-nested-directories). +Checkout the example how to [store files in custom nested directories](#example-store-files-in-custom-nested-directories). #### `options.getFileIdFromRequest` Control how the Upload-ID is extracted from the request (`(req) => string | void`) By default, it expects everything in the path after the last `/` to be the upload id. -> [!TIP] -> Checkout the example how to [store files in custom nested directories](#example-store-files-in-custom-nested-directories). +Checkout the example how to [store files in custom nested directories](#example-store-files-in-custom-nested-directories). #### `options.namingFunction` @@ -113,10 +111,16 @@ and result in a different file name in storage. It is important to make these unique to prevent data loss. Only use it if you need to. Default uses `crypto.randomBytes(16).toString('hex')`. -> [!TIP] -> Checkout the example how to [store files in custom nested directories](#example-store-files-in-custom-nested-directories). +Checkout the example how to [store files in custom nested directories](#example-store-files-in-custom-nested-directories). -#### `disableTerminationForFinishedUploads` +#### `options.locker` + +The locker interface to manage locks for exclusive access control over resources ([`Locker`][]). + +By default it uses an in-memory locker ([`MemoryLocker`][]) for safe concurrent access to uploads using a single server. +When running multiple instances of the server, you need to provide a locker implementation that is shared between all instances (such as a `RedisLocker`). + +#### `options.disableTerminationForFinishedUploads` Disallow the [termination extension](https://tus.io/protocols/resumable-upload#termination) for finished uploads. (`boolean`) @@ -517,8 +521,10 @@ See [`contributing.md`](https://github.com/tus/tus-node-server/blob/main/.github [`@tus/file-store`]: https://github.com/tus/tus-node-server/tree/main/packages/file-store [`@tus/s3-store`]: https://github.com/tus/tus-node-server/tree/main/packages/s3-store [`@tus/gcs-store`]: https://github.com/tus/tus-node-server/tree/main/packages/gcs-store -[`constants`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/constants.ts +[`constants`]: https://github.com/tus/tus-node-server/blob/main/packages/utils/src/constants.ts [`types`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/types.ts -[`models`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/models/index.ts -[`kvstores`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/kvstores/index.ts +[`models`]: https://github.com/tus/tus-node-server/blob/main/packages/utils/src/models/index.ts +[`kvstores`]: https://github.com/tus/tus-node-server/blob/main/packages/utils/src/kvstores/index.ts [expiration]: https://tus.io/protocols/resumable-upload.html#expiration +[`Locker`]: https://github.com/tus/tus-node-server/blob/main/packages/utils/src/models/Locker.ts +[`MemoryLocker`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/lockers/MemoryLocker.ts