// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: services/diff/v1/diff.proto
package diff

import (
	context "context"
	ttrpc "github.com/containerd/ttrpc"
)

type TTRPCDiffService interface {
	Apply(context.Context, *ApplyRequest) (*ApplyResponse, error)
	Diff(context.Context, *DiffRequest) (*DiffResponse, error)
}

func RegisterTTRPCDiffService(srv *ttrpc.Server, svc TTRPCDiffService) {
	srv.RegisterService("containerd.services.diff.v1.Diff", &ttrpc.ServiceDesc{
		Methods: map[string]ttrpc.Method{
			"Apply": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req ApplyRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Apply(ctx, &req)
			},
			"Diff": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req DiffRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Diff(ctx, &req)
			},
		},
	})
}

type ttrpcdiffClient struct {
	client *ttrpc.Client
}

func NewTTRPCDiffClient(client *ttrpc.Client) TTRPCDiffService {
	return &ttrpcdiffClient{
		client: client,
	}
}

func (c *ttrpcdiffClient) Apply(ctx context.Context, req *ApplyRequest) (*ApplyResponse, error) {
	var resp ApplyResponse
	if err := c.client.Call(ctx, "containerd.services.diff.v1.Diff", "Apply", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcdiffClient) Diff(ctx context.Context, req *DiffRequest) (*DiffResponse, error) {
	var resp DiffResponse
	if err := c.client.Call(ctx, "containerd.services.diff.v1.Diff", "Diff", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}
