Skip to content

Commit 7472926

Browse files
committed
Add a io.podman.v1.Noop GRPC service to the podman system service
Add a bare minimum GRPC service to the podman system service socket. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
1 parent 9d5aca3 commit 7472926

File tree

7 files changed

+386
-3
lines changed

7 files changed

+386
-3
lines changed

pkg/api/grpcpb/build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
cd $(dirname ${BASH_SOURCE[0]})
4+
TOP=../../..
5+
PATH=${TOP}/test/tools/build:${PATH}
6+
set -x
7+
for proto in *.proto ; do
8+
protoc \
9+
--go_opt=paths=source_relative --go_out . \
10+
--go-grpc_opt=paths=source_relative --go-grpc_out . \
11+
${proto}
12+
done

pkg/api/grpcpb/noop.pb.go

Lines changed: 174 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/grpcpb/noop.proto

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
syntax = "proto3";
2+
3+
package io.podman.v1;
4+
5+
option go_package = "github.com/containers/podman/v6/pkg/api/grpcpb";
6+
7+
service Noop {
8+
rpc Noop(NoopRequest) returns (NoopResponse);
9+
}
10+
11+
message NoopRequest {
12+
string ignored = 1;
13+
}
14+
15+
message NoopResponse {
16+
string ignored = 1;
17+
}

pkg/api/grpcpb/noop_grpc.pb.go

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/handlers/grpc/noop.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//go:build !remote
2+
3+
package grpc
4+
5+
import (
6+
"context"
7+
8+
"github.com/containers/podman/v6/libpod"
9+
"github.com/containers/podman/v6/pkg/api/grpcpb"
10+
)
11+
12+
type noopServer struct {
13+
grpcpb.UnimplementedNoopServer
14+
runtime *libpod.Runtime
15+
}
16+
17+
func (noopServer) Noop(_ context.Context, req *grpcpb.NoopRequest) (*grpcpb.NoopResponse, error) {
18+
resp := &grpcpb.NoopResponse{
19+
Ignored: req.GetIgnored(),
20+
}
21+
return resp, nil
22+
}
23+
24+
func NewNoopServer(runtime *libpod.Runtime) grpcpb.NoopServer {
25+
return &noopServer{runtime: runtime}
26+
}

0 commit comments

Comments
 (0)