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

Breadcrumb

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

class ConsensusStrategy

ConsensusStrategy is a StrategyInterface implementation where strictly more than 50% items should be successful.

@author Jérémy Derussé <jeremy@derusse.com>

Hierarchy

  • class \Symfony\Component\Lock\Strategy\ConsensusStrategy implements \Symfony\Component\Lock\Strategy\StrategyInterface

Expanded class hierarchy of ConsensusStrategy

File

vendor/symfony/lock/Strategy/ConsensusStrategy.php, line 19

Namespace

Symfony\Component\Lock\Strategy
View source
class ConsensusStrategy implements StrategyInterface {
    public function isMet(int $numberOfSuccess, int $numberOfItems) : bool {
        return $numberOfSuccess > $numberOfItems / 2;
    }
    public function canBeMet(int $numberOfFailure, int $numberOfItems) : bool {
        return $numberOfFailure < $numberOfItems / 2;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ConsensusStrategy::canBeMet public function Returns whether or not the quorum *could* be met. Overrides StrategyInterface::canBeMet
ConsensusStrategy::isMet public function Returns whether or not the quorum is met. Overrides StrategyInterface::isMet

API Navigation

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