// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: github.com/containerd/containerd/api/services/ttrpc/events/v1/events.proto
package events

import (
	context "context"
	ttrpc "github.com/containerd/ttrpc"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

type EventsService interface {
	Forward(context.Context, *ForwardRequest) (*emptypb.Empty, error)
}

func RegisterEventsService(srv *ttrpc.Server, svc EventsService) {
	srv.RegisterService("containerd.services.events.ttrpc.v1.Events", &ttrpc.ServiceDesc{
		Methods: map[string]ttrpc.Method{
			"Forward": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req ForwardRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Forward(ctx, &req)
			},
		},
	})
}

type eventsClient struct {
	client *ttrpc.Client
}

func NewEventsClient(client *ttrpc.Client) EventsService {
	return &eventsClient{
		client: client,
	}
}

func (c *eventsClient) Forward(ctx context.Context, req *ForwardRequest) (*emptypb.Empty, error) {
	var resp emptypb.Empty
	if err := c.client.Call(ctx, "containerd.services.events.ttrpc.v1.Events", "Forward", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}
