Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ZookeeperStore.php

function ZookeeperStore::createNewLock

Creates a zookeeper node.

Parameters

string $node The node which needs to be created:

string $value The value to be assigned to a zookeeper node:

Throws

LockConflictedException

LockAcquiringException

1 call to ZookeeperStore::createNewLock()
ZookeeperStore::save in vendor/symfony/lock/Store/ZookeeperStore.php
Stores the resource if it's not locked by someone else.

File

vendor/symfony/lock/Store/ZookeeperStore.php, line 111

Class

ZookeeperStore
ZookeeperStore is a PersistingStoreInterface implementation using Zookeeper as store engine.

Namespace

Symfony\Component\Lock\Store

Code

private function createNewLock(string $node, string $value) : void {
    // Default Node Permissions
    $acl = [
        [
            'perms' => \Zookeeper::PERM_ALL,
            'scheme' => 'world',
            'id' => 'anyone',
        ],
    ];
    // This ensures that the nodes are deleted when the client session to zookeeper server ends.
    $type = \Zookeeper::EPHEMERAL;
    try {
        $this->zookeeper
            ->create($node, $value, $acl, $type);
    } catch (\ZookeeperException $ex) {
        if (\Zookeeper::NODEEXISTS === $ex->getCode()) {
            throw new LockConflictedException($ex);
        }
        throw new LockAcquiringException($ex);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal