starpc 0.41.2 → 0.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -20
- package/dist/mock/mock.pb.d.ts +1 -1
- package/dist/mock/mock.pb.js +4 -5
- package/dist/mock/mock_srpc.pb.d.ts +3 -3
- package/dist/mock/mock_srpc.pb.js +5 -5
- package/echo/Cargo.toml +21 -0
- package/echo/build.rs +15 -0
- package/echo/echo.pb.cc +405 -0
- package/echo/echo.pb.go +9 -27
- package/echo/echo.pb.h +364 -0
- package/echo/echo_srpc.pb.go +1 -1
- package/echo/gen/mod.rs +3 -0
- package/echo/main.rs +162 -0
- package/go.mod +18 -10
- package/go.sum +28 -18
- package/mock/mock.pb.cc +394 -0
- package/mock/mock.pb.go +9 -27
- package/mock/mock.pb.h +366 -0
- package/mock/mock.pb.ts +11 -13
- package/mock/mock_srpc.pb.go +1 -1
- package/mock/mock_srpc.pb.ts +12 -9
- package/package.json +27 -25
- package/srpc/Cargo.toml +26 -0
- package/srpc/build.rs +15 -0
- package/srpc/client.rs +356 -0
- package/srpc/codec.rs +225 -0
- package/srpc/error.rs +177 -0
- package/srpc/handler.rs +163 -0
- package/srpc/invoker.rs +192 -0
- package/srpc/lib.rs +107 -0
- package/srpc/message.rs +9 -0
- package/srpc/mux.rs +353 -0
- package/srpc/packet.rs +334 -0
- package/srpc/proto/mod.rs +10 -0
- package/srpc/rpc.rs +777 -0
- package/srpc/rpcproto.pb.cc +1381 -0
- package/srpc/rpcproto.pb.go +75 -183
- package/srpc/rpcproto.pb.h +1451 -0
- package/srpc/server.rs +337 -0
- package/srpc/stream.rs +304 -0
- package/srpc/testing.rs +290 -0
- package/srpc/tests/integration_test.rs +495 -0
- package/srpc/transport.rs +218 -0
- package/Makefile +0 -154
package/mock/mock.pb.h
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
//go:build deps_only && cgo
|
|
2
|
+
|
|
3
|
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
4
|
+
// NO CHECKED-IN PROTOBUF GENCODE
|
|
5
|
+
// source: github.com/aperturerobotics/starpc/mock/mock.proto
|
|
6
|
+
// Protobuf C++ Version: 6.33.4
|
|
7
|
+
|
|
8
|
+
#ifndef github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto_2epb_2eh
|
|
9
|
+
#define github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto_2epb_2eh
|
|
10
|
+
|
|
11
|
+
#include <limits>
|
|
12
|
+
#include <string>
|
|
13
|
+
#include <type_traits>
|
|
14
|
+
#include <utility>
|
|
15
|
+
|
|
16
|
+
#include "google/protobuf/runtime_version.h"
|
|
17
|
+
#if PROTOBUF_VERSION != 6033004
|
|
18
|
+
#error "Protobuf C++ gencode is built with an incompatible version of"
|
|
19
|
+
#error "Protobuf C++ headers/runtime. See"
|
|
20
|
+
#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
|
|
21
|
+
#endif
|
|
22
|
+
#include "google/protobuf/io/coded_stream.h"
|
|
23
|
+
#include "google/protobuf/arena.h"
|
|
24
|
+
#include "google/protobuf/arenastring.h"
|
|
25
|
+
#include "google/protobuf/generated_message_tctable_decl.h"
|
|
26
|
+
#include "google/protobuf/generated_message_util.h"
|
|
27
|
+
#include "google/protobuf/metadata_lite.h"
|
|
28
|
+
#include "google/protobuf/generated_message_reflection.h"
|
|
29
|
+
#include "google/protobuf/message.h"
|
|
30
|
+
#include "google/protobuf/message_lite.h"
|
|
31
|
+
#include "google/protobuf/repeated_field.h" // IWYU pragma: export
|
|
32
|
+
#include "google/protobuf/extension_set.h" // IWYU pragma: export
|
|
33
|
+
#include "google/protobuf/unknown_field_set.h"
|
|
34
|
+
// @@protoc_insertion_point(includes)
|
|
35
|
+
|
|
36
|
+
// Must be included last.
|
|
37
|
+
#include "google/protobuf/port_def.inc"
|
|
38
|
+
|
|
39
|
+
#define PROTOBUF_INTERNAL_EXPORT_github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto
|
|
40
|
+
|
|
41
|
+
namespace google {
|
|
42
|
+
namespace protobuf {
|
|
43
|
+
namespace internal {
|
|
44
|
+
template <typename T>
|
|
45
|
+
::absl::string_view GetAnyMessageName();
|
|
46
|
+
} // namespace internal
|
|
47
|
+
} // namespace protobuf
|
|
48
|
+
} // namespace google
|
|
49
|
+
|
|
50
|
+
// Internal implementation detail -- do not use these members.
|
|
51
|
+
struct TableStruct_github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto {
|
|
52
|
+
static const ::uint32_t offsets[];
|
|
53
|
+
};
|
|
54
|
+
extern "C" {
|
|
55
|
+
extern const ::google::protobuf::internal::DescriptorTable descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto;
|
|
56
|
+
} // extern "C"
|
|
57
|
+
namespace e2e {
|
|
58
|
+
namespace mock {
|
|
59
|
+
class MockMsg;
|
|
60
|
+
struct MockMsgDefaultTypeInternal;
|
|
61
|
+
extern MockMsgDefaultTypeInternal _MockMsg_default_instance_;
|
|
62
|
+
extern const ::google::protobuf::internal::ClassDataFull MockMsg_class_data_;
|
|
63
|
+
} // namespace mock
|
|
64
|
+
} // namespace e2e
|
|
65
|
+
namespace google {
|
|
66
|
+
namespace protobuf {
|
|
67
|
+
} // namespace protobuf
|
|
68
|
+
} // namespace google
|
|
69
|
+
|
|
70
|
+
namespace e2e {
|
|
71
|
+
namespace mock {
|
|
72
|
+
|
|
73
|
+
// ===================================================================
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
// -------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
class MockMsg final : public ::google::protobuf::Message
|
|
79
|
+
/* @@protoc_insertion_point(class_definition:e2e.mock.MockMsg) */ {
|
|
80
|
+
public:
|
|
81
|
+
inline MockMsg() : MockMsg(nullptr) {}
|
|
82
|
+
~MockMsg() PROTOBUF_FINAL;
|
|
83
|
+
|
|
84
|
+
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
|
85
|
+
void operator delete(MockMsg* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) {
|
|
86
|
+
SharedDtor(*msg);
|
|
87
|
+
::google::protobuf::internal::SizedDelete(msg, sizeof(MockMsg));
|
|
88
|
+
}
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
template <typename = void>
|
|
92
|
+
explicit PROTOBUF_CONSTEXPR MockMsg(::google::protobuf::internal::ConstantInitialized);
|
|
93
|
+
|
|
94
|
+
inline MockMsg(const MockMsg& from) : MockMsg(nullptr, from) {}
|
|
95
|
+
inline MockMsg(MockMsg&& from) noexcept
|
|
96
|
+
: MockMsg(nullptr, ::std::move(from)) {}
|
|
97
|
+
inline MockMsg& operator=(const MockMsg& from) {
|
|
98
|
+
CopyFrom(from);
|
|
99
|
+
return *this;
|
|
100
|
+
}
|
|
101
|
+
inline MockMsg& operator=(MockMsg&& from) noexcept {
|
|
102
|
+
if (this == &from) return *this;
|
|
103
|
+
if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) {
|
|
104
|
+
InternalSwap(&from);
|
|
105
|
+
} else {
|
|
106
|
+
CopyFrom(from);
|
|
107
|
+
}
|
|
108
|
+
return *this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
|
|
112
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
|
113
|
+
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
|
|
114
|
+
}
|
|
115
|
+
inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields()
|
|
116
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
|
117
|
+
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() {
|
|
121
|
+
return GetDescriptor();
|
|
122
|
+
}
|
|
123
|
+
static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() {
|
|
124
|
+
return default_instance().GetMetadata().descriptor;
|
|
125
|
+
}
|
|
126
|
+
static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() {
|
|
127
|
+
return default_instance().GetMetadata().reflection;
|
|
128
|
+
}
|
|
129
|
+
static const MockMsg& default_instance() {
|
|
130
|
+
return *reinterpret_cast<const MockMsg*>(
|
|
131
|
+
&_MockMsg_default_instance_);
|
|
132
|
+
}
|
|
133
|
+
static constexpr int kIndexInFileMessages = 0;
|
|
134
|
+
friend void swap(MockMsg& a, MockMsg& b) { a.Swap(&b); }
|
|
135
|
+
inline void Swap(MockMsg* PROTOBUF_NONNULL other) {
|
|
136
|
+
if (other == this) return;
|
|
137
|
+
if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) {
|
|
138
|
+
InternalSwap(other);
|
|
139
|
+
} else {
|
|
140
|
+
::google::protobuf::internal::GenericSwap(this, other);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
void UnsafeArenaSwap(MockMsg* PROTOBUF_NONNULL other) {
|
|
144
|
+
if (other == this) return;
|
|
145
|
+
ABSL_DCHECK(GetArena() == other->GetArena());
|
|
146
|
+
InternalSwap(other);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// implements Message ----------------------------------------------
|
|
150
|
+
|
|
151
|
+
MockMsg* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const {
|
|
152
|
+
return ::google::protobuf::Message::DefaultConstruct<MockMsg>(arena);
|
|
153
|
+
}
|
|
154
|
+
using ::google::protobuf::Message::CopyFrom;
|
|
155
|
+
void CopyFrom(const MockMsg& from);
|
|
156
|
+
using ::google::protobuf::Message::MergeFrom;
|
|
157
|
+
void MergeFrom(const MockMsg& from) { MockMsg::MergeImpl(*this, from); }
|
|
158
|
+
|
|
159
|
+
private:
|
|
160
|
+
static void MergeImpl(::google::protobuf::MessageLite& to_msg,
|
|
161
|
+
const ::google::protobuf::MessageLite& from_msg);
|
|
162
|
+
|
|
163
|
+
public:
|
|
164
|
+
bool IsInitialized() const {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL;
|
|
168
|
+
#if defined(PROTOBUF_CUSTOM_VTABLE)
|
|
169
|
+
private:
|
|
170
|
+
static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg);
|
|
171
|
+
static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
|
|
172
|
+
const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target,
|
|
173
|
+
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream);
|
|
174
|
+
|
|
175
|
+
public:
|
|
176
|
+
::size_t ByteSizeLong() const { return ByteSizeLong(*this); }
|
|
177
|
+
::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
|
|
178
|
+
::uint8_t* PROTOBUF_NONNULL target,
|
|
179
|
+
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const {
|
|
180
|
+
return _InternalSerialize(*this, target, stream);
|
|
181
|
+
}
|
|
182
|
+
#else // PROTOBUF_CUSTOM_VTABLE
|
|
183
|
+
::size_t ByteSizeLong() const final;
|
|
184
|
+
::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
|
|
185
|
+
::uint8_t* PROTOBUF_NONNULL target,
|
|
186
|
+
::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final;
|
|
187
|
+
#endif // PROTOBUF_CUSTOM_VTABLE
|
|
188
|
+
int GetCachedSize() const { return _impl_._cached_size_.Get(); }
|
|
189
|
+
|
|
190
|
+
private:
|
|
191
|
+
void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
|
192
|
+
static void SharedDtor(MessageLite& self);
|
|
193
|
+
void InternalSwap(MockMsg* PROTOBUF_NONNULL other);
|
|
194
|
+
private:
|
|
195
|
+
template <typename T>
|
|
196
|
+
friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)();
|
|
197
|
+
static ::absl::string_view FullMessageName() { return "e2e.mock.MockMsg"; }
|
|
198
|
+
|
|
199
|
+
explicit MockMsg(::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
|
200
|
+
MockMsg(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MockMsg& from);
|
|
201
|
+
MockMsg(
|
|
202
|
+
::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MockMsg&& from) noexcept
|
|
203
|
+
: MockMsg(arena) {
|
|
204
|
+
*this = ::std::move(from);
|
|
205
|
+
}
|
|
206
|
+
const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL;
|
|
207
|
+
static void* PROTOBUF_NONNULL PlacementNew_(
|
|
208
|
+
const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem,
|
|
209
|
+
::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
|
210
|
+
static constexpr auto InternalNewImpl_();
|
|
211
|
+
|
|
212
|
+
public:
|
|
213
|
+
static constexpr auto InternalGenerateClassData_();
|
|
214
|
+
|
|
215
|
+
::google::protobuf::Metadata GetMetadata() const;
|
|
216
|
+
// nested types ----------------------------------------------------
|
|
217
|
+
|
|
218
|
+
// accessors -------------------------------------------------------
|
|
219
|
+
enum : int {
|
|
220
|
+
kBodyFieldNumber = 1,
|
|
221
|
+
};
|
|
222
|
+
// string body = 1;
|
|
223
|
+
void clear_body() ;
|
|
224
|
+
const ::std::string& body() const;
|
|
225
|
+
template <typename Arg_ = const ::std::string&, typename... Args_>
|
|
226
|
+
void set_body(Arg_&& arg, Args_... args);
|
|
227
|
+
::std::string* PROTOBUF_NONNULL mutable_body();
|
|
228
|
+
[[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_body();
|
|
229
|
+
void set_allocated_body(::std::string* PROTOBUF_NULLABLE value);
|
|
230
|
+
|
|
231
|
+
private:
|
|
232
|
+
const ::std::string& _internal_body() const;
|
|
233
|
+
PROTOBUF_ALWAYS_INLINE void _internal_set_body(const ::std::string& value);
|
|
234
|
+
::std::string* PROTOBUF_NONNULL _internal_mutable_body();
|
|
235
|
+
|
|
236
|
+
public:
|
|
237
|
+
// @@protoc_insertion_point(class_scope:e2e.mock.MockMsg)
|
|
238
|
+
private:
|
|
239
|
+
class _Internal;
|
|
240
|
+
friend class ::google::protobuf::internal::TcParser;
|
|
241
|
+
static const ::google::protobuf::internal::TcParseTable<0, 1,
|
|
242
|
+
0, 29,
|
|
243
|
+
2>
|
|
244
|
+
_table_;
|
|
245
|
+
|
|
246
|
+
friend class ::google::protobuf::MessageLite;
|
|
247
|
+
friend class ::google::protobuf::Arena;
|
|
248
|
+
template <typename T>
|
|
249
|
+
friend class ::google::protobuf::Arena::InternalHelper;
|
|
250
|
+
using InternalArenaConstructable_ = void;
|
|
251
|
+
using DestructorSkippable_ = void;
|
|
252
|
+
struct Impl_ {
|
|
253
|
+
inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept;
|
|
254
|
+
inline explicit Impl_(
|
|
255
|
+
::google::protobuf::internal::InternalVisibility visibility,
|
|
256
|
+
::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
|
|
257
|
+
inline explicit Impl_(
|
|
258
|
+
::google::protobuf::internal::InternalVisibility visibility,
|
|
259
|
+
::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from,
|
|
260
|
+
const MockMsg& from_msg);
|
|
261
|
+
::google::protobuf::internal::HasBits<1> _has_bits_;
|
|
262
|
+
::google::protobuf::internal::CachedSize _cached_size_;
|
|
263
|
+
::google::protobuf::internal::ArenaStringPtr body_;
|
|
264
|
+
PROTOBUF_TSAN_DECLARE_MEMBER
|
|
265
|
+
};
|
|
266
|
+
union { Impl_ _impl_; };
|
|
267
|
+
friend struct ::TableStruct_github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
extern const ::google::protobuf::internal::ClassDataFull MockMsg_class_data_;
|
|
271
|
+
|
|
272
|
+
// ===================================================================
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
// ===================================================================
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
#ifdef __GNUC__
|
|
281
|
+
#pragma GCC diagnostic push
|
|
282
|
+
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
|
283
|
+
#endif // __GNUC__
|
|
284
|
+
// -------------------------------------------------------------------
|
|
285
|
+
|
|
286
|
+
// MockMsg
|
|
287
|
+
|
|
288
|
+
// string body = 1;
|
|
289
|
+
inline void MockMsg::clear_body() {
|
|
290
|
+
::google::protobuf::internal::TSanWrite(&_impl_);
|
|
291
|
+
_impl_.body_.ClearToEmpty();
|
|
292
|
+
ClearHasBit(_impl_._has_bits_[0],
|
|
293
|
+
0x00000001U);
|
|
294
|
+
}
|
|
295
|
+
inline const ::std::string& MockMsg::body() const
|
|
296
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
|
297
|
+
// @@protoc_insertion_point(field_get:e2e.mock.MockMsg.body)
|
|
298
|
+
return _internal_body();
|
|
299
|
+
}
|
|
300
|
+
template <typename Arg_, typename... Args_>
|
|
301
|
+
PROTOBUF_ALWAYS_INLINE void MockMsg::set_body(Arg_&& arg, Args_... args) {
|
|
302
|
+
::google::protobuf::internal::TSanWrite(&_impl_);
|
|
303
|
+
SetHasBit(_impl_._has_bits_[0], 0x00000001U);
|
|
304
|
+
_impl_.body_.Set(static_cast<Arg_&&>(arg), args..., GetArena());
|
|
305
|
+
// @@protoc_insertion_point(field_set:e2e.mock.MockMsg.body)
|
|
306
|
+
}
|
|
307
|
+
inline ::std::string* PROTOBUF_NONNULL MockMsg::mutable_body()
|
|
308
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
|
309
|
+
SetHasBit(_impl_._has_bits_[0], 0x00000001U);
|
|
310
|
+
::std::string* _s = _internal_mutable_body();
|
|
311
|
+
// @@protoc_insertion_point(field_mutable:e2e.mock.MockMsg.body)
|
|
312
|
+
return _s;
|
|
313
|
+
}
|
|
314
|
+
inline const ::std::string& MockMsg::_internal_body() const {
|
|
315
|
+
::google::protobuf::internal::TSanRead(&_impl_);
|
|
316
|
+
return _impl_.body_.Get();
|
|
317
|
+
}
|
|
318
|
+
inline void MockMsg::_internal_set_body(const ::std::string& value) {
|
|
319
|
+
::google::protobuf::internal::TSanWrite(&_impl_);
|
|
320
|
+
_impl_.body_.Set(value, GetArena());
|
|
321
|
+
}
|
|
322
|
+
inline ::std::string* PROTOBUF_NONNULL MockMsg::_internal_mutable_body() {
|
|
323
|
+
::google::protobuf::internal::TSanWrite(&_impl_);
|
|
324
|
+
return _impl_.body_.Mutable( GetArena());
|
|
325
|
+
}
|
|
326
|
+
inline ::std::string* PROTOBUF_NULLABLE MockMsg::release_body() {
|
|
327
|
+
::google::protobuf::internal::TSanWrite(&_impl_);
|
|
328
|
+
// @@protoc_insertion_point(field_release:e2e.mock.MockMsg.body)
|
|
329
|
+
if (!CheckHasBit(_impl_._has_bits_[0], 0x00000001U)) {
|
|
330
|
+
return nullptr;
|
|
331
|
+
}
|
|
332
|
+
ClearHasBit(_impl_._has_bits_[0], 0x00000001U);
|
|
333
|
+
auto* released = _impl_.body_.Release();
|
|
334
|
+
if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) {
|
|
335
|
+
_impl_.body_.Set("", GetArena());
|
|
336
|
+
}
|
|
337
|
+
return released;
|
|
338
|
+
}
|
|
339
|
+
inline void MockMsg::set_allocated_body(::std::string* PROTOBUF_NULLABLE value) {
|
|
340
|
+
::google::protobuf::internal::TSanWrite(&_impl_);
|
|
341
|
+
if (value != nullptr) {
|
|
342
|
+
SetHasBit(_impl_._has_bits_[0], 0x00000001U);
|
|
343
|
+
} else {
|
|
344
|
+
ClearHasBit(_impl_._has_bits_[0], 0x00000001U);
|
|
345
|
+
}
|
|
346
|
+
_impl_.body_.SetAllocated(value, GetArena());
|
|
347
|
+
if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.body_.IsDefault()) {
|
|
348
|
+
_impl_.body_.Set("", GetArena());
|
|
349
|
+
}
|
|
350
|
+
// @@protoc_insertion_point(field_set_allocated:e2e.mock.MockMsg.body)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
#ifdef __GNUC__
|
|
354
|
+
#pragma GCC diagnostic pop
|
|
355
|
+
#endif // __GNUC__
|
|
356
|
+
|
|
357
|
+
// @@protoc_insertion_point(namespace_scope)
|
|
358
|
+
} // namespace mock
|
|
359
|
+
} // namespace e2e
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
// @@protoc_insertion_point(global_scope)
|
|
363
|
+
|
|
364
|
+
#include "google/protobuf/port_undef.inc"
|
|
365
|
+
|
|
366
|
+
#endif // github_2ecom_2faperturerobotics_2fstarpc_2fmock_2fmock_2eproto_2epb_2eh
|
package/mock/mock.pb.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// @generated from file github.com/aperturerobotics/starpc/mock/mock.proto (package e2e.mock, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import type { MessageType, PartialFieldInfo } from
|
|
6
|
-
import { createMessageType, ScalarType } from
|
|
5
|
+
import type { MessageType, PartialFieldInfo } from '@aptre/protobuf-es-lite'
|
|
6
|
+
import { createMessageType, ScalarType } from '@aptre/protobuf-es-lite'
|
|
7
7
|
|
|
8
|
-
export const protobufPackage =
|
|
8
|
+
export const protobufPackage = 'e2e.mock'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* MockMsg is the mock message body.
|
|
@@ -16,16 +16,14 @@ export interface MockMsg {
|
|
|
16
16
|
/**
|
|
17
17
|
* @generated from field: string body = 1;
|
|
18
18
|
*/
|
|
19
|
-
body?: string
|
|
20
|
-
|
|
21
|
-
};
|
|
19
|
+
body?: string
|
|
20
|
+
}
|
|
22
21
|
|
|
23
22
|
// MockMsg contains the message type declaration for MockMsg.
|
|
24
23
|
export const MockMsg: MessageType<MockMsg> = createMessageType({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
24
|
+
typeName: 'e2e.mock.MockMsg',
|
|
25
|
+
fields: [
|
|
26
|
+
{ no: 1, name: 'body', kind: 'scalar', T: ScalarType.STRING },
|
|
27
|
+
] as readonly PartialFieldInfo[],
|
|
28
|
+
packedByDefault: true,
|
|
29
|
+
})
|
package/mock/mock_srpc.pb.go
CHANGED
package/mock/mock_srpc.pb.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// @generated from file github.com/aperturerobotics/starpc/mock/mock.proto (package e2e.mock, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { MockMsg } from
|
|
6
|
-
import { MethodKind } from
|
|
7
|
-
import { ProtoRpc } from
|
|
5
|
+
import { MockMsg } from './mock.pb.js'
|
|
6
|
+
import { MethodKind } from '@aptre/protobuf-es-lite'
|
|
7
|
+
import { ProtoRpc } from 'starpc'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Mock service mocks some RPCs for the e2e tests.
|
|
@@ -12,7 +12,7 @@ import { ProtoRpc } from "starpc";
|
|
|
12
12
|
* @generated from service e2e.mock.Mock
|
|
13
13
|
*/
|
|
14
14
|
export const MockDefinition = {
|
|
15
|
-
typeName:
|
|
15
|
+
typeName: 'e2e.mock.Mock',
|
|
16
16
|
methods: {
|
|
17
17
|
/**
|
|
18
18
|
* MockRequest runs a mock unary request.
|
|
@@ -20,13 +20,13 @@ export const MockDefinition = {
|
|
|
20
20
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
21
21
|
*/
|
|
22
22
|
MockRequest: {
|
|
23
|
-
name:
|
|
23
|
+
name: 'MockRequest',
|
|
24
24
|
I: MockMsg,
|
|
25
25
|
O: MockMsg,
|
|
26
26
|
kind: MethodKind.Unary,
|
|
27
27
|
},
|
|
28
|
-
}
|
|
29
|
-
} as const
|
|
28
|
+
},
|
|
29
|
+
} as const
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Mock service mocks some RPCs for the e2e tests.
|
|
@@ -39,7 +39,7 @@ export interface Mock {
|
|
|
39
39
|
*
|
|
40
40
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
41
41
|
*/
|
|
42
|
-
MockRequest(request: MockMsg, abortSignal?: AbortSignal): Promise<MockMsg
|
|
42
|
+
MockRequest(request: MockMsg, abortSignal?: AbortSignal): Promise<MockMsg>
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const MockServiceName = MockDefinition.typeName
|
|
@@ -57,7 +57,10 @@ export class MockClient implements Mock {
|
|
|
57
57
|
*
|
|
58
58
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
59
59
|
*/
|
|
60
|
-
async MockRequest(
|
|
60
|
+
async MockRequest(
|
|
61
|
+
request: MockMsg,
|
|
62
|
+
abortSignal?: AbortSignal,
|
|
63
|
+
): Promise<MockMsg> {
|
|
61
64
|
const requestMsg = MockMsg.create(request)
|
|
62
65
|
const result = await this.rpc.request(
|
|
63
66
|
this.service,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"!**/*.tsbuildinfo",
|
|
51
|
-
"Makefile",
|
|
52
51
|
"dist",
|
|
53
52
|
"mock",
|
|
54
53
|
"echo",
|
|
@@ -63,36 +62,38 @@
|
|
|
63
62
|
},
|
|
64
63
|
"scripts": {
|
|
65
64
|
"clean": "rimraf ./dist",
|
|
66
|
-
"build": "
|
|
67
|
-
"check": "
|
|
68
|
-
"typecheck": "
|
|
65
|
+
"build": "bun run clean && tsc --project tsconfig.build.json --outDir ./dist/",
|
|
66
|
+
"check": "bun run typecheck",
|
|
67
|
+
"typecheck": "tsgo --noEmit",
|
|
69
68
|
"deps": "depcheck --ignores 'bufferutil,utf-8-validate,rimraf,starpc,@aptre/protobuf-es-lite,tsx'",
|
|
70
|
-
"codegen": "
|
|
71
|
-
"ci": "
|
|
72
|
-
"format": "
|
|
69
|
+
"codegen": "bun run gen",
|
|
70
|
+
"ci": "bun run build && bun run lint:js && bun run lint:go",
|
|
71
|
+
"format": "bun run format:go && bun run format:js && bun run format:config",
|
|
73
72
|
"format:config": "prettier --write tsconfig.json package.json",
|
|
74
|
-
"format:go": "
|
|
73
|
+
"format:go": "bun run go:aptre -- format",
|
|
75
74
|
"format:js": "prettier --write './{srpc,echo,e2e,integration,rpcstream,cmd}/**/(*.ts|*.tsx|*.html|*.css)'",
|
|
76
|
-
"gen": "
|
|
77
|
-
"
|
|
78
|
-
"test
|
|
79
|
-
"
|
|
75
|
+
"gen": "bun run go:aptre -- generate && bun run format",
|
|
76
|
+
"gen:force": "bun run go:aptre -- generate --force && bun run format",
|
|
77
|
+
"test": "bun run test:js && bun run test:go",
|
|
78
|
+
"test:go": "bun run go:aptre -- test",
|
|
79
|
+
"build:e2e": "bun run build && cd e2e && esbuild e2e.ts --sourcemap --outfile=e2e.cjs --bundle --platform=node",
|
|
80
80
|
"test:js": "vitest run",
|
|
81
81
|
"test:js:watch": "vitest",
|
|
82
|
-
"debug:js": "
|
|
83
|
-
"test:integration": "
|
|
84
|
-
"integration": "
|
|
85
|
-
"lint": "
|
|
86
|
-
"lint:go": "
|
|
82
|
+
"debug:js": "bun run build:e2e && cd e2e && node --inspect --inspect-brk ./e2e.cjs",
|
|
83
|
+
"test:integration": "cd ./integration && bash ./integration.bash",
|
|
84
|
+
"integration": "bun run test:integration",
|
|
85
|
+
"lint": "bun run lint:go && bun run lint:js",
|
|
86
|
+
"lint:go": "bun run go:aptre -- lint",
|
|
87
87
|
"lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.cjs --ignore-pattern *.js --ignore-pattern *.d.ts ./",
|
|
88
88
|
"prepare": "husky",
|
|
89
|
+
"go:aptre": "go run -mod=mod github.com/aperturerobotics/common/cmd/aptre",
|
|
89
90
|
"precommit": "lint-staged",
|
|
90
91
|
"release": "npm run release:version && npm run release:commit",
|
|
91
92
|
"release:minor": "npm run release:version:minor && npm run release:commit",
|
|
92
93
|
"release:version": "npm version patch -m \"release: v%s\" --no-git-tag-version",
|
|
93
94
|
"release:version:minor": "npm version minor -m \"release: v%s\" --no-git-tag-version",
|
|
94
|
-
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$
|
|
95
|
-
"release:publish": "git push && git push --tags
|
|
95
|
+
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$(node -p \"require('./package.json').version\")\" && git tag v$(node -p \"require('./package.json').version\")",
|
|
96
|
+
"release:publish": "git push && git push --tags"
|
|
96
97
|
},
|
|
97
98
|
"preferUnplugged": true,
|
|
98
99
|
"lint-staged": {
|
|
@@ -100,20 +101,21 @@
|
|
|
100
101
|
"./{srpc,echo,e2e,integration,rpcstream,cmd}/**/(*.ts|*.tsx|*.html|*.css)": "prettier --config .prettierrc.yaml --write"
|
|
101
102
|
},
|
|
102
103
|
"devDependencies": {
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
104
|
-
"@typescript-eslint/parser": "^8.
|
|
104
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
105
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
105
106
|
"depcheck": "^1.4.6",
|
|
106
107
|
"esbuild": "^0.27.0",
|
|
107
108
|
"eslint": "^9.39.1",
|
|
108
109
|
"eslint-config-prettier": "^10.0.2",
|
|
109
|
-
"happy-dom": "^20.0
|
|
110
|
+
"happy-dom": "^20.4.0",
|
|
110
111
|
"husky": "^9.1.7",
|
|
111
112
|
"lint-staged": "^16.2.7",
|
|
112
|
-
"prettier": "^3.
|
|
113
|
+
"prettier": "^3.8.1",
|
|
113
114
|
"rimraf": "^6.1.2",
|
|
114
115
|
"tsx": "^4.20.4",
|
|
115
116
|
"typescript": "^5.8.2",
|
|
116
|
-
"
|
|
117
|
+
"@typescript/native-preview": "^7.0.0-dev.20260130.1",
|
|
118
|
+
"vitest": "^4.0.18"
|
|
117
119
|
},
|
|
118
120
|
"dependencies": {
|
|
119
121
|
"@aptre/it-ws": "^1.1.2",
|
package/srpc/Cargo.toml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "starpc"
|
|
3
|
+
version.workspace = true
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
rust-version.workspace = true
|
|
6
|
+
license.workspace = true
|
|
7
|
+
repository.workspace = true
|
|
8
|
+
description.workspace = true
|
|
9
|
+
keywords.workspace = true
|
|
10
|
+
categories.workspace = true
|
|
11
|
+
|
|
12
|
+
[lib]
|
|
13
|
+
path = "lib.rs"
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
prost = { workspace = true }
|
|
17
|
+
bytes = { workspace = true }
|
|
18
|
+
tokio = { workspace = true }
|
|
19
|
+
tokio-util = { workspace = true }
|
|
20
|
+
futures = { workspace = true }
|
|
21
|
+
thiserror = { workspace = true }
|
|
22
|
+
async-trait = { workspace = true }
|
|
23
|
+
pin-project-lite = { workspace = true }
|
|
24
|
+
|
|
25
|
+
[build-dependencies]
|
|
26
|
+
prost-build = { workspace = true }
|
package/srpc/build.rs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
use std::io::Result;
|
|
2
|
+
use std::path::PathBuf;
|
|
3
|
+
|
|
4
|
+
fn main() -> Result<()> {
|
|
5
|
+
// Get the path to the proto file in the same directory.
|
|
6
|
+
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
7
|
+
let proto_path = manifest_dir.join("rpcproto.proto");
|
|
8
|
+
|
|
9
|
+
println!("cargo:rerun-if-changed={}", proto_path.display());
|
|
10
|
+
|
|
11
|
+
prost_build::Config::new()
|
|
12
|
+
.compile_protos(&[proto_path], &[&manifest_dir])?;
|
|
13
|
+
|
|
14
|
+
Ok(())
|
|
15
|
+
}
|