feat: Added resourceExists method to ResourceStore

* feat: added resourceExists method to ResourceStore

* Merge remote-tracking branch 'origin/main' into feat/add-resourceExists-method-to-ResourceStore

* fix: adapted to review

* fix: adapted to review
This commit is contained in:
Arne Vandoorslaer
2021-02-25 13:43:58 +01:00
committed by GitHub
parent e5b7d99da4
commit b3f292d718
24 changed files with 136 additions and 67 deletions

View File

@@ -4,7 +4,6 @@ import { BasicRepresentation } from '../ldp/representation/BasicRepresentation';
import type { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
import { getLoggerFor } from '../logging/LogUtil';
import type { ResourceStore } from '../storage/ResourceStore';
import { containsResource } from '../storage/StoreUtil';
import { TEXT_TURTLE } from '../util/ContentTypes';
import { ensureTrailingSlash, joinFilePath } from '../util/PathUtil';
import { Initializer } from './Initializer';
@@ -39,7 +38,7 @@ export class AclInitializer extends Initializer {
// https://solid.github.io/specification/protocol#storage
public async handle(): Promise<void> {
const rootAcl = this.aclStrategy.getAuxiliaryIdentifier(this.root);
if (await containsResource(this.store, rootAcl)) {
if (await this.store.resourceExists(rootAcl)) {
this.logger.debug(`Existing root ACL document found at ${rootAcl.path}`);
} else {
this.logger.debug(`Installing root ACL document at ${rootAcl.path}`);

View File

@@ -4,7 +4,6 @@ import { RepresentationMetadata } from '../ldp/representation/RepresentationMeta
import type { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
import { getLoggerFor } from '../logging/LogUtil';
import type { ResourceStore } from '../storage/ResourceStore';
import { containsResource } from '../storage/StoreUtil';
import { TEXT_TURTLE } from '../util/ContentTypes';
import { ensureTrailingSlash } from '../util/PathUtil';
import { generateResourceQuads } from '../util/ResourceUtil';
@@ -32,7 +31,7 @@ export class RootContainerInitializer extends Initializer {
public async handle(): Promise<void> {
this.logger.debug(`Checking for root container at ${this.baseId.path}`);
if (!await containsResource(this.store, this.baseId)) {
if (!await this.store.resourceExists(this.baseId)) {
await this.createRootContainer();
} else {
this.logger.debug(`Existing root container found at ${this.baseId.path}`);