| 1 |
// Copyright 2016 gRPC authors. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_IMPL_H |
| 16 |
#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_IMPL_H |
| 17 |
|
| 18 |
#include <grpc/support/port_platform.h> |
| 19 |
|
| 20 |
#include "absl/status/statusor.h" |
| 21 |
|
| 22 |
#include "src/core/lib/channel/channel_fwd.h" |
| 23 |
#include "src/core/lib/channel/channel_stack_builder.h" |
| 24 |
#include "src/core/lib/gprpp/ref_counted_ptr.h" |
| 25 |
|
| 26 |
namespace grpc_core { |
| 27 |
|
| 28 |
// Build a channel stack. |
| 29 |
// Allows interested parties to add filters to the stack, and to query an |
| 30 |
// in-progress build. |
| 31 |
// Carries some useful context for the channel stack, such as a target string |
| 32 |
// and a transport. |
| 33 |
class ChannelStackBuilderImpl final : public ChannelStackBuilder { |
| 34 |
public: |
| 35 |
using ChannelStackBuilder::ChannelStackBuilder; |
| 36 |
|
| 37 |
bool IsPromising() const override; |
| 38 |
|
| 39 |
// Build the channel stack. |
| 40 |
// After success, *result holds the new channel stack, |
| 41 |
// prefix_bytes are allocated before the channel stack, |
| 42 |
// initial_refs, destroy, destroy_arg are as per grpc_channel_stack_init |
| 43 |
// On failure, *result is nullptr. |
| 44 |
absl::StatusOr<RefCountedPtr<grpc_channel_stack>> Build() override; |
| 45 |
}; |
| 46 |
} // namespace grpc_core |
| 47 |
|
| 48 |
#endif // GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_IMPL_H |