Sha256: e80571fc3837613e6ab5762f99b60c89b97a2af8c9ebc1bfbfb31779a55f7837

Contents?: true

Size: 1.61 KB

Versions: 24

Compression:

Stored size: 1.61 KB

Contents

/*
 *
 * Copyright 2016 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <grpc/support/port_platform.h>

#include "src/core/lib/surface/channel_init.h"

#include <algorithm>

namespace grpc_core {

void ChannelInit::Builder::RegisterStage(grpc_channel_stack_type type,
                                         int priority, Stage stage) {
  slots_[type].emplace_back(std::move(stage), priority);
}

ChannelInit ChannelInit::Builder::Build() {
  ChannelInit result;
  for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) {
    auto& slots = slots_[i];
    std::stable_sort(
        slots.begin(), slots.end(),
        [](const Slot& a, const Slot& b) { return a.priority < b.priority; });
    auto& result_slots = result.slots_[i];
    result_slots.reserve(slots.size());
    for (auto& slot : slots) {
      result_slots.emplace_back(std::move(slot.stage));
    }
  }
  return result;
}

bool ChannelInit::CreateStack(ChannelStackBuilder* builder) const {
  for (const auto& stage : slots_[builder->channel_stack_type()]) {
    if (!stage(builder)) return false;
  }
  return true;
}

}  // namespace grpc_core

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/core/lib/surface/channel_init.cc
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/core/lib/surface/channel_init.cc
grpc-1.51.0-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.51.0 src/core/lib/surface/channel_init.cc
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/core/lib/surface/channel_init.cc
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/grpc-1.50.0-x86_64-linux/src/core/lib/surface/channel_init.cc
grpc-1.50.0 src/core/lib/surface/channel_init.cc
grpc-1.50.0-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.50.0.pre1 src/core/lib/surface/channel_init.cc
grpc-1.50.0.pre1-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.49.1 src/core/lib/surface/channel_init.cc
grpc-1.49.1-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.49.0.pre1 src/core/lib/surface/channel_init.cc
grpc-1.49.0.pre1-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.48.0-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.48.0 src/core/lib/surface/channel_init.cc
grpc-1.48.0.pre1 src/core/lib/surface/channel_init.cc
grpc-1.48.0.pre1-x86_64-linux src/core/lib/surface/channel_init.cc
grpc-1.47.0 src/core/lib/surface/channel_init.cc
grpc-1.47.0-x86_64-linux src/core/lib/surface/channel_init.cc