Skip to content

Commit 739dcbc

Browse files
committed
chipingress: add noop implementation
1 parent d611017 commit 739dcbc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

pkg/chipingress/client.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"google.golang.org/grpc/metadata"
1818

1919
ceformat "github.com/cloudevents/sdk-go/binding/format/protobuf/v2"
20+
cepb "github.com/cloudevents/sdk-go/binding/format/protobuf/v2/pb"
2021
ce "github.com/cloudevents/sdk-go/v2"
2122

2223
"github.com/smartcontractkit/chainlink-common/pkg/chipingress/pb"
@@ -281,3 +282,36 @@ func EventsToBatch(events []CloudEvent) (*CloudEventBatch, error) {
281282
}
282283
return batch, nil
283284
}
285+
286+
// NoopChipIngressClient is a no-op implementation of the ChipIngressClient interface.
287+
type NoopChipIngressClient struct{}
288+
289+
// Ping is a no-op
290+
func (NoopChipIngressClient) Ping(ctx context.Context, in *pb.EmptyRequest, opts ...grpc.CallOption) (*pb.PingResponse, error) {
291+
return &pb.PingResponse{Message: "pong"}, nil
292+
}
293+
294+
// Publish is a no-op
295+
func (NoopChipIngressClient) Publish(ctx context.Context, in *cepb.CloudEvent, opts ...grpc.CallOption) (*pb.PublishResponse, error) {
296+
return &pb.PublishResponse{}, nil
297+
}
298+
299+
// PublishBatch is a no-op
300+
func (NoopChipIngressClient) PublishBatch(ctx context.Context, in *pb.CloudEventBatch, opts ...grpc.CallOption) (*pb.PublishResponse, error) {
301+
return &pb.PublishResponse{}, nil
302+
}
303+
304+
// StreamEvents is a no-op
305+
func (NoopChipIngressClient) StreamEvents(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[pb.StreamEventsRequest, pb.StreamEventsResponse], error) {
306+
return nil, nil
307+
}
308+
309+
// RegisterSchema is a no-op
310+
func (NoopChipIngressClient) RegisterSchema(ctx context.Context, in *pb.RegisterSchemaRequest, opts ...grpc.CallOption) (*pb.RegisterSchemaResponse, error) {
311+
return &pb.RegisterSchemaResponse{}, nil
312+
}
313+
314+
// Close is a no-op
315+
func (NoopChipIngressClient) Close() error {
316+
return nil
317+
}

0 commit comments

Comments
 (0)