docs: refine gRPC guide section numbers and add CloseAndRecv & fileStore explanations

This commit is contained in:
2026-07-17 22:15:58 +09:00
parent d90553ecdf
commit 50f63633ea
23 changed files with 2964 additions and 130 deletions
+154
View File
@@ -0,0 +1,154 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v3.21.12
// source: protoapi.proto
package protoapi
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Http3Service_Ping_FullMethodName = "/Http3Service/Ping"
Http3Service_StreamPing_FullMethodName = "/Http3Service/StreamPing"
)
// Http3ServiceClient is the client API for Http3Service service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type Http3ServiceClient interface {
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
StreamPing(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PingRequest, PingResponse], error)
}
type http3ServiceClient struct {
cc grpc.ClientConnInterface
}
func NewHttp3ServiceClient(cc grpc.ClientConnInterface) Http3ServiceClient {
return &http3ServiceClient{cc}
}
func (c *http3ServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PingResponse)
err := c.cc.Invoke(ctx, Http3Service_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *http3ServiceClient) StreamPing(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PingRequest, PingResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Http3Service_ServiceDesc.Streams[0], Http3Service_StreamPing_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[PingRequest, PingResponse]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Http3Service_StreamPingClient = grpc.BidiStreamingClient[PingRequest, PingResponse]
// Http3ServiceServer is the server API for Http3Service service.
// All implementations must embed UnimplementedHttp3ServiceServer
// for forward compatibility.
type Http3ServiceServer interface {
Ping(context.Context, *PingRequest) (*PingResponse, error)
StreamPing(grpc.BidiStreamingServer[PingRequest, PingResponse]) error
mustEmbedUnimplementedHttp3ServiceServer()
}
// UnimplementedHttp3ServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedHttp3ServiceServer struct{}
func (UnimplementedHttp3ServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedHttp3ServiceServer) StreamPing(grpc.BidiStreamingServer[PingRequest, PingResponse]) error {
return status.Error(codes.Unimplemented, "method StreamPing not implemented")
}
func (UnimplementedHttp3ServiceServer) mustEmbedUnimplementedHttp3ServiceServer() {}
func (UnimplementedHttp3ServiceServer) testEmbeddedByValue() {}
// UnsafeHttp3ServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to Http3ServiceServer will
// result in compilation errors.
type UnsafeHttp3ServiceServer interface {
mustEmbedUnimplementedHttp3ServiceServer()
}
func RegisterHttp3ServiceServer(s grpc.ServiceRegistrar, srv Http3ServiceServer) {
// If the following call panics, it indicates UnimplementedHttp3ServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Http3Service_ServiceDesc, srv)
}
func _Http3Service_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(Http3ServiceServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Http3Service_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(Http3ServiceServer).Ping(ctx, req.(*PingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Http3Service_StreamPing_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(Http3ServiceServer).StreamPing(&grpc.GenericServerStream[PingRequest, PingResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Http3Service_StreamPingServer = grpc.BidiStreamingServer[PingRequest, PingResponse]
// Http3Service_ServiceDesc is the grpc.ServiceDesc for Http3Service service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Http3Service_ServiceDesc = grpc.ServiceDesc{
ServiceName: "Http3Service",
HandlerType: (*Http3ServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _Http3Service_Ping_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamPing",
Handler: _Http3Service_StreamPing_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "protoapi.proto",
}