Skip to content

Commit

Permalink
feat: add a Redis based Read-Write Locker
Browse files Browse the repository at this point in the history
refactor: more elegant way of providing default attemptSettings to constructor

style(jsdoc): rewording of jsdoc comment

fix: RegExp(/regex/) => /regex/

fix: Replace Error with InternalServerError

docs: jsdoc for RedisReadWriteLocker class

feat: make RedisReadWriteLocker a ResourceLocker too

test: coverage back to 100%

refactor: linting fix

style(jsdoc): Add explanation to tryRedisFn() method

refactor: remove RedisResourceLocker

fix: bug in lua script

chore(deps): update ioredis, remove redlock

refactor: removed RedisResourceLocker in favor of generic RedisLocker class

test: add redis lua scripts tests and integrate all 3 redis integration tests in 1

refactor: remove .vscode folder from index

refactor: Add some typing and  change redis references to Redis in comments

refactor: more changes after PR review

refactor: remove redis.json

refactor: rename redis-rw.json to redis.json

docs: added readme and release notes
  • Loading branch information
Falx committed Apr 19, 2022
1 parent 570e167 commit 16631ab
Show file tree
Hide file tree
Showing 15 changed files with 1,357 additions and 705 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- A new default configuration `config/https-file-cli.json`
that can set the HTTPS parameters through the CLI has been added.
This is also an example of how to add CLI parameters through a custom configuration.
- A new RedisLocker has been added to replace the old RedisResourceLocker class.
It allows for true threadsafe read/write locking.

### Configuration changes
You might need to make changes to your v3 configuration if you use a custom config.
Expand Down Expand Up @@ -39,6 +41,8 @@ These changes are relevant if you wrote custom modules for the server that depen
- `RepresentationMetadata` no longer accepts strings for predicates in any of its functions.
- `CombinedSettingsResolver` parameter `computers` has been renamed to `resolvers`.
- `IdentityProviderFactory` requires an additional `credentialStorage` parameter.
- The `RedisResourceLocker` class has been removed and the `RedisLocker`class was added instead.
`RedisLocker` implements both the `ResourceLocker` and `ReadWriteLocker` interface.

## v3.0.0
### New features
Expand Down
2 changes: 1 addition & 1 deletion config/util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ to the ChainedConverter list.
Which locking mechanism to use to for example prevent 2 write simultaneous write requests.
* *debug-void*: No locking mechanism, does not prevent simultaneous read/writes.
* *memory*: Uses an in-memory locking mechanism.
* *redis*: Uses a Redis store for locking.
* *redis*: Uses a Redis store for locking that supports threadsafe read-write locking.

## Variables
Various variables used by other options.
Expand Down
22 changes: 9 additions & 13 deletions config/util/resource-locker/redis.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^3.0.0/components/context.jsonld",
"@graph": [
{
"comment": "Allows multiple simultaneous read operations. Locks are stored in memory. Locks expire after inactivity.",
"comment": "Allows multiple simultaneous read operations. All locks are threadsafe.",
"@id": "urn:solid-server:default:ResourceLocker",
"@type": "WrappedExpiringReadWriteLocker",
"locker": {
"@type": "GreedyReadWriteLocker",
"locker": {
"@id": "urn:solid-server:default:RedisResourceLocker",
"@type": "RedisResourceLocker",
"redisClients": [ "6379" ]
},
"storage": { "@id": "urn:solid-server:default:LockStorage" },
"suffixes_count": "count",
"suffixes_read": "read",
"suffixes_write": "write"
"@id": "urn:solid-server:default:RedisLocker",
"@type": "RedisLocker"
},
"expiration": 3000
},
{
"comment": "Makes sure the redis connection is closed when the application needs to stop.",
"comment": "Makes sure the redis connection is closed when the application needs to stop. Also deletes still-existing locks and counters.",
"@id": "urn:solid-server:default:Finalizer",
"ParallelFinalizer:_finalizers": [ { "@id": "urn:solid-server:default:RedisResourceLocker" } ]
"ParallelFinalizer:_finalizers": [
{
"@id": "urn:solid-server:default:RedisLocker"
}
]
}
]
}
Loading

0 comments on commit 16631ab

Please sign in to comment.