Skip to content

Commit

Permalink
Document locker option and fix dead links in README's (#584)
Browse files Browse the repository at this point in the history
* Document `locker` option and fix dead links in README's

* Add changeset

* Improve changesets
  • Loading branch information
Murderlon authored Feb 20, 2024
1 parent 9007471 commit 79985fc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-cars-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tus/server': patch
---

Document `locker` option and fix dead links in README
6 changes: 6 additions & 0 deletions .changeset/nervous-timers-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@tus/file-store': patch
'@tus/s3-store': patch
---

Fix dead links in README
2 changes: 1 addition & 1 deletion packages/file-store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions packages/s3-store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
26 changes: 16 additions & 10 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand All @@ -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`)

Expand Down Expand Up @@ -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

0 comments on commit 79985fc

Please sign in to comment.