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

Breadcrumb

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

function DeltaStorage::collect

File

vendor/open-telemetry/sdk/Metrics/Stream/DeltaStorage.php, line 42

Class

DeltaStorage
@internal @phan-file-suppress PhanUndeclaredTypeParameter, PhanUndeclaredTypeProperty

Namespace

OpenTelemetry\SDK\Metrics\Stream

Code

public function collect(int $reader, bool $retain = false) : ?Metric {
    $n = null;
    for ($d = $this->head; $d->prev; $d = $d->prev) {
        if (($d->prev->readers >> $reader & 1) != 0) {
            if ($n !== null) {
                assert($n->prev !== null);
                $n->prev->readers ^= $d->prev->readers;
                $this->mergeInto($d->prev->metric, $n->prev->metric);
                $this->tryUnlink($n);
                if ($n->prev === $d->prev) {
                    continue;
                }
            }
            $n = $d;
        }
    }
    $metric = $n->prev->metric ?? null;
    if (!$retain && $n) {
        assert($n->prev !== null);
        $n->prev->readers ^= ($n->prev->readers & 1 | 1) << $reader;
        $this->tryUnlink($n);
    }
    return $metric;
}

API Navigation

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