Skip to content

Commit

Permalink
api-sketch
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Dec 12, 2024
1 parent 2296ca2 commit 89cd9a2
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/core/ext/transport/chaotic_good/frame_transport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2024 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.

#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHAOTIC_GOOD_FRAME_TRANSPORT_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_CHAOTIC_GOOD_FRAME_TRANSPORT_H

#include "src/core/ext/transport/chaotic_good/frame.h"
#include "src/core/lib/promise/mpsc.h"
#include "src/core/lib/promise/party.h"

namespace grpc_core {
namespace chaotic_good {

class FrameTransport {
public:
virtual void StartReading(Party* party, MpscSender<Frame> frames) = 0;
virtual void StartWriting(Party* party, MpscReceiver<Frame> frames) = 0;
};

} // namespace chaotic_good
} // namespace grpc_core

#endif
39 changes: 39 additions & 0 deletions src/core/ext/transport/chaotic_good/tcp_frame_transport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2024 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.

#ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHAOTIC_GOOD_TCP_FRAME_TRANSPORT_H
#define GRPC_SRC_CORE_EXT_TRANSPORT_CHAOTIC_GOOD_TCP_FRAME_TRANSPORT_H

#include <vector>

#include "pending_connection.h"
#include "src/core/ext/transport/chaotic_good/frame_transport.h"

namespace grpc_core {
namespace chaotic_good {

class TcpFrameTransport final : public FrameTransport {
public:
TcpFrameTransport(PromiseEndpoint control_endpoint,
std::vector<PendingConnection> pending_data_endpoints);

private:
Poll<StatusFlag> PollWrite(Frame& frame) override;
Poll<ValueOrFailure<Frame>> PollRead() override;
};

} // namespace chaotic_good
} // namespace grpc_core

#endif

0 comments on commit 89cd9a2

Please sign in to comment.