Skip to content

Commit

Permalink
use generated types for ingester
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Fiedorowicz <[email protected]>
  • Loading branch information
mfiedorowicz committed Aug 27, 2024
1 parent 6532aea commit e063b81
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions diode/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ type Client interface {
Close() error

// Ingest sends an ingest request to the ingester service
Ingest(context.Context, []*diodepb.Entity) (*diodepb.IngestResponse, error)
Ingest(context.Context, []Entity) (*diodepb.IngestResponse, error)
}

// GRPCClient is a gRPC implementation of the ingester service
Expand Down Expand Up @@ -227,12 +227,17 @@ func (g *GRPCClient) Close() error {
}

// Ingest sends an ingest request to the ingester service
func (g *GRPCClient) Ingest(ctx context.Context, entities []*diodepb.Entity) (*diodepb.IngestResponse, error) {
func (g *GRPCClient) Ingest(ctx context.Context, entities []Entity) (*diodepb.IngestResponse, error) {
stream := defaultStreamName

protoEntities := make([]*diodepb.Entity, 0)
for _, entity := range entities {
protoEntities = append(protoEntities, entity.ConvertToProtoEntity())
}

req := &diodepb.IngestRequest{
Id: uuid.NewString(),
Entities: entities,
Entities: protoEntities,
Stream: stream,
ProducerAppName: g.appName,
ProducerAppVersion: g.appVersion,
Expand Down

0 comments on commit e063b81

Please sign in to comment.