@synonymdev/pubky
    Preparing search index...

    Class StorageLock

    An exclusive write lock on one file path, granted by the homeserver.

    While the lock lives, only writes that present it are accepted on the path; every other write, and every other SessionStorage.lock, rejects with 423 Locked. The lock ends when it is unlocked or when its StorageLock.timeoutSeconds runs out without a refresh, so a client that disappears never blocks a path for long.

    The lock is a bearer token: whoever holds this value, and may write the path, can use and release the lock.

    Calls that take the lock may overlap: a refresh can run while a locked write is in flight.

    const lock = await session.storage.lock("/pub/my.app/state.json", 30);
    const state = await session.storage.getText(lock.path);
    await session.storage.putTextLocked(lock, state);
    await session.storage.unlock(lock);
    Index
    path: Path

    The locked path.

    timeoutSeconds: number

    Lifetime the homeserver granted at the last lock or refreshLock, in seconds, counted from when that call resolved. It may be shorter than what was asked for. It is not the time remaining: note when the call resolved to know when to refresh.

    token: string

    The lock token URL, opaquelocktoken:<uuid>.

    • Returns void

    • Returns void

    • Value of the If header that presents this lock on a write.

      Returns string