Skip to content
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
This repository was archived by the owner on Aug 25, 2023. It is now read-only.

clean up interfaces between pod-server, websockets-pubsub, and wac-ldp #3

Description

@michielbdejong

The pod-server requires both websockets-pubsub's Hub object and wac-ldp's App object.

Currently wac-ldp's Server constructor does this:

constructor (port: number, aud: string, skipWac: boolean) {
    this.port = port
    this.storage = new BlobTreeInMem() // singleton in-memory storage
    const handler = makeHandler(this.storage, aud, new URL('wss://localhost:8443'), skipWac)
    this.server = http.createServer(handler)
  }

And wac-ldp exposes BlobTree and makeHandler, but I'm thinking of changing this to:

constructor (port: number, aud: string, skipWac: boolean) {
    this.port = port
    this.storage = new BlobTreeInMem() // singleton in-memory storage
    const wacLdp = new WacLdp(this.storage, aud, new URL('wss://localhost:8443'), skipWac)
    this.server = http.createServer(wacLdp.handler.bind(wacLdp))
  }

The advantage would be:

  • websockets-pubsub would subscribe to events from WacLdp rather than from BlobTree, so they would contain URLs instead of storage paths.
  • websockets-pubsub can then call WacLdp.checkAccess(webId: URL, origin: string, resource: URL, mode: URL) instead of having to pass a BlobTree and checking access on a storage path of that BlobTree.
  • in general, cleaner separation between the storage layer which thinks in terms of storage paths, and the WacLdp module as a whole, which exposes interfaces (its http request handler but also its change event and accessCheck function) that think in terms of URLs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions