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
  • Loading branch information
Falx committed Apr 16, 2022
1 parent c0bc150 commit 121d612
Show file tree
Hide file tree
Showing 16 changed files with 1,572 additions and 696 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jest.jestCommandLine": "jest --detectOpenHandles"
}
24 changes: 24 additions & 0 deletions config/util/resource-locker/redis-rw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^3.0.0/components/context.jsonld",
"@graph": [
{
"comment": "Allows threadsafe multiple simultaneous read operations.",
"@id": "urn:solid-server:default:ResourceLocker",
"@type": "WrappedExpiringReadWriteLocker",
"locker": {
"@id": "urn:solid-server:default:RedisLocker",
"@type": "RedisLocker"
},
"expiration": 3000
},
{
"comment": "Makes sure the redis connection is closed when the application needs to stop.",
"@id": "urn:solid-server:default:Finalizer",
"ParallelFinalizer:_finalizers": [
{
"@id": "urn:solid-server:default:RedisLocker"
}
]
}
]
}
15 changes: 10 additions & 5 deletions config/util/resource-locker/redis.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
"locker": {
"@type": "GreedyReadWriteLocker",
"locker": {
"@id": "urn:solid-server:default:RedisResourceLocker",
"@type": "RedisResourceLocker",
"redisClients": [ "6379" ]
"@id": "urn:solid-server:default:RedisLocker",
"@type": "RedisLocker"
},
"storage": {
"@id": "urn:solid-server:default:LockStorage"
},
"storage": { "@id": "urn:solid-server:default:LockStorage" },
"suffixes_count": "count",
"suffixes_read": "read",
"suffixes_write": "write"
Expand All @@ -22,7 +23,11 @@
{
"comment": "Makes sure the redis connection is closed when the application needs to stop.",
"@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 121d612

Please sign in to comment.