mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Create new interface for lockers with only 1 kind of lock
This commit is contained in:
@@ -8,10 +8,11 @@ import type { ResourceStore } from '../../src/storage/ResourceStore';
|
||||
import { APPLICATION_OCTET_STREAM } from '../../src/util/ContentTypes';
|
||||
import { InternalServerError } from '../../src/util/errors/InternalServerError';
|
||||
import { SingleRootIdentifierStrategy } from '../../src/util/identifiers/SingleRootIdentifierStrategy';
|
||||
import type { ExpiringResourceLocker } from '../../src/util/locking/ExpiringResourceLocker';
|
||||
import type { ResourceLocker } from '../../src/util/locking/ResourceLocker';
|
||||
import { EqualReadWriteLocker } from '../../src/util/locking/EqualReadWriteLocker';
|
||||
import type { ExpiringReadWriteLocker } from '../../src/util/locking/ExpiringReadWriteLocker';
|
||||
import type { ReadWriteLocker } from '../../src/util/locking/ReadWriteLocker';
|
||||
import { SingleThreadedResourceLocker } from '../../src/util/locking/SingleThreadedResourceLocker';
|
||||
import { WrappedExpiringResourceLocker } from '../../src/util/locking/WrappedExpiringResourceLocker';
|
||||
import { WrappedExpiringReadWriteLocker } from '../../src/util/locking/WrappedExpiringReadWriteLocker';
|
||||
import { guardedStreamFrom } from '../../src/util/StreamUtil';
|
||||
import { BASE } from './Config';
|
||||
|
||||
@@ -20,8 +21,8 @@ jest.useFakeTimers();
|
||||
describe('A LockingResourceStore', (): void => {
|
||||
let path: string;
|
||||
let store: LockingResourceStore;
|
||||
let locker: ResourceLocker;
|
||||
let expiringLocker: ExpiringResourceLocker;
|
||||
let locker: ReadWriteLocker;
|
||||
let expiringLocker: ExpiringReadWriteLocker;
|
||||
let source: ResourceStore;
|
||||
let getRepresentationSpy: jest.SpyInstance;
|
||||
|
||||
@@ -36,8 +37,8 @@ describe('A LockingResourceStore', (): void => {
|
||||
const initializer = new RootContainerInitializer({ store: source, baseUrl: BASE });
|
||||
await initializer.handleSafe();
|
||||
|
||||
locker = new SingleThreadedResourceLocker();
|
||||
expiringLocker = new WrappedExpiringResourceLocker(locker, 1000);
|
||||
locker = new EqualReadWriteLocker(new SingleThreadedResourceLocker());
|
||||
expiringLocker = new WrappedExpiringReadWriteLocker(locker, 1000);
|
||||
|
||||
store = new LockingResourceStore(source, expiringLocker);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user