ingest_grpc.pb.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.6.2
  4. // - protoc (unknown)
  5. // source: broadannounce/v1/ingest.proto
  6. package broadannouncev1
  7. import (
  8. context "context"
  9. grpc "google.golang.org/grpc"
  10. codes "google.golang.org/grpc/codes"
  11. status "google.golang.org/grpc/status"
  12. )
  13. // This is a compile-time assertion to ensure that this generated file
  14. // is compatible with the grpc package it is being compiled against.
  15. // Requires gRPC-Go v1.64.0 or later.
  16. const _ = grpc.SupportPackageIsVersion9
  17. const (
  18. Ingest_StreamAlerts_FullMethodName = "/broadannounce.v1.Ingest/StreamAlerts"
  19. )
  20. // IngestClient is the client API for Ingest service.
  21. //
  22. // 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.
  23. //
  24. // Ingest is the gRPC service for first-party, high-volume alert sources.
  25. // It runs on a dedicated port (default :9090) inside the tenant's VPC;
  26. // external webhook sources continue to use HTTP POST on :8800.
  27. type IngestClient interface {
  28. // StreamAlerts is a bidirectional stream: the client sends zero or more
  29. // Alerts, the server sends exactly one Ack for each Alert received.
  30. //
  31. // Flow:
  32. // 1. Client opens stream (auth metadata required on the call)
  33. // 2. Client streams Alerts; server processes each concurrently
  34. // 3. Server streams back Acks as they are ready (order not guaranteed)
  35. // 4. Client reads Acks and adjusts send rate accordingly
  36. //
  37. // Backpressure: if the server's in-flight buffer (256 msgs) fills up,
  38. // it sends Error.RATE_LIMITED with retry_after_ms > 0. The client MUST
  39. // honour that delay before resuming.
  40. StreamAlerts(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Alert, Ack], error)
  41. }
  42. type ingestClient struct {
  43. cc grpc.ClientConnInterface
  44. }
  45. func NewIngestClient(cc grpc.ClientConnInterface) IngestClient {
  46. return &ingestClient{cc}
  47. }
  48. func (c *ingestClient) StreamAlerts(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Alert, Ack], error) {
  49. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  50. stream, err := c.cc.NewStream(ctx, &Ingest_ServiceDesc.Streams[0], Ingest_StreamAlerts_FullMethodName, cOpts...)
  51. if err != nil {
  52. return nil, err
  53. }
  54. x := &grpc.GenericClientStream[Alert, Ack]{ClientStream: stream}
  55. return x, nil
  56. }
  57. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  58. type Ingest_StreamAlertsClient = grpc.BidiStreamingClient[Alert, Ack]
  59. // IngestServer is the server API for Ingest service.
  60. // All implementations must embed UnimplementedIngestServer
  61. // for forward compatibility.
  62. //
  63. // Ingest is the gRPC service for first-party, high-volume alert sources.
  64. // It runs on a dedicated port (default :9090) inside the tenant's VPC;
  65. // external webhook sources continue to use HTTP POST on :8800.
  66. type IngestServer interface {
  67. // StreamAlerts is a bidirectional stream: the client sends zero or more
  68. // Alerts, the server sends exactly one Ack for each Alert received.
  69. //
  70. // Flow:
  71. // 1. Client opens stream (auth metadata required on the call)
  72. // 2. Client streams Alerts; server processes each concurrently
  73. // 3. Server streams back Acks as they are ready (order not guaranteed)
  74. // 4. Client reads Acks and adjusts send rate accordingly
  75. //
  76. // Backpressure: if the server's in-flight buffer (256 msgs) fills up,
  77. // it sends Error.RATE_LIMITED with retry_after_ms > 0. The client MUST
  78. // honour that delay before resuming.
  79. StreamAlerts(grpc.BidiStreamingServer[Alert, Ack]) error
  80. mustEmbedUnimplementedIngestServer()
  81. }
  82. // UnimplementedIngestServer must be embedded to have
  83. // forward compatible implementations.
  84. //
  85. // NOTE: this should be embedded by value instead of pointer to avoid a nil
  86. // pointer dereference when methods are called.
  87. type UnimplementedIngestServer struct{}
  88. func (UnimplementedIngestServer) StreamAlerts(grpc.BidiStreamingServer[Alert, Ack]) error {
  89. return status.Error(codes.Unimplemented, "method StreamAlerts not implemented")
  90. }
  91. func (UnimplementedIngestServer) mustEmbedUnimplementedIngestServer() {}
  92. func (UnimplementedIngestServer) testEmbeddedByValue() {}
  93. // UnsafeIngestServer may be embedded to opt out of forward compatibility for this service.
  94. // Use of this interface is not recommended, as added methods to IngestServer will
  95. // result in compilation errors.
  96. type UnsafeIngestServer interface {
  97. mustEmbedUnimplementedIngestServer()
  98. }
  99. func RegisterIngestServer(s grpc.ServiceRegistrar, srv IngestServer) {
  100. // If the following call panics, it indicates UnimplementedIngestServer was
  101. // embedded by pointer and is nil. This will cause panics if an
  102. // unimplemented method is ever invoked, so we test this at initialization
  103. // time to prevent it from happening at runtime later due to I/O.
  104. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
  105. t.testEmbeddedByValue()
  106. }
  107. s.RegisterService(&Ingest_ServiceDesc, srv)
  108. }
  109. func _Ingest_StreamAlerts_Handler(srv interface{}, stream grpc.ServerStream) error {
  110. return srv.(IngestServer).StreamAlerts(&grpc.GenericServerStream[Alert, Ack]{ServerStream: stream})
  111. }
  112. // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
  113. type Ingest_StreamAlertsServer = grpc.BidiStreamingServer[Alert, Ack]
  114. // Ingest_ServiceDesc is the grpc.ServiceDesc for Ingest service.
  115. // It's only intended for direct use with grpc.RegisterService,
  116. // and not to be introspected or modified (even as a copy)
  117. var Ingest_ServiceDesc = grpc.ServiceDesc{
  118. ServiceName: "broadannounce.v1.Ingest",
  119. HandlerType: (*IngestServer)(nil),
  120. Methods: []grpc.MethodDesc{},
  121. Streams: []grpc.StreamDesc{
  122. {
  123. StreamName: "StreamAlerts",
  124. Handler: _Ingest_StreamAlerts_Handler,
  125. ServerStreams: true,
  126. ClientStreams: true,
  127. },
  128. },
  129. Metadata: "broadannounce/v1/ingest.proto",
  130. }