Skip to content

Commit

Permalink
feat: add proto
Browse files Browse the repository at this point in the history
Signed-off-by: PoAn Yang <poan.yang@suse.com>
  • Loading branch information
FrankYang0529 committed Feb 22, 2024
1 parent ac48c9c commit 73127c2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 548 deletions.
7 changes: 4 additions & 3 deletions app/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"github.com/sirupsen/logrus"
"github.com/urfave/cli"

"github.com/longhorn/types/pkg/smrpc"
"google.golang.org/grpc"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"

smrpc "github.com/longhorn/longhorn-share-manager/pkg/rpc"
"github.com/longhorn/longhorn-share-manager/pkg/rpc"
"github.com/longhorn/longhorn-share-manager/pkg/server"
"github.com/longhorn/longhorn-share-manager/pkg/util"
"github.com/longhorn/longhorn-share-manager/pkg/volume"
Expand Down Expand Up @@ -126,9 +127,9 @@ func start(vol volume.Volume) error {
}

s := grpc.NewServer()
srv := smrpc.NewShareManagerServer(manager)
srv := rpc.NewShareManagerServer(manager)
smrpc.RegisterShareManagerServiceServer(s, srv)
healthpb.RegisterHealthServer(s, smrpc.NewShareManagerHealthCheckServer(srv))
healthpb.RegisterHealthServer(s, rpc.NewShareManagerHealthCheckServer(srv))
reflection.Register(s)

logrus.Infof("Listening on share manager gRPC server %s", listenPort)
Expand Down
30 changes: 0 additions & 30 deletions generate_grpc.sh

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/client/share_manager_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package client
import (
"context"

rpc "github.com/longhorn/types/pkg/smrpc"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"

rpc "github.com/longhorn/longhorn-share-manager/pkg/rpc"
"github.com/longhorn/longhorn-share-manager/pkg/types"
)

Expand Down
15 changes: 7 additions & 8 deletions pkg/rpc/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package smrpc
package rpc

import (
"fmt"
Expand All @@ -8,19 +8,17 @@ import (
"time"

"github.com/google/fscrypt/filesystem"
lhexec "github.com/longhorn/go-common-libs/exec"
lhtypes "github.com/longhorn/go-common-libs/types"
"github.com/longhorn/types/pkg/smrpc"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"

"k8s.io/mount-utils"

grpccodes "google.golang.org/grpc/codes"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
grpcstatus "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"

lhexec "github.com/longhorn/go-common-libs/exec"
lhtypes "github.com/longhorn/go-common-libs/types"
"k8s.io/mount-utils"

"github.com/longhorn/longhorn-share-manager/pkg/server"
"github.com/longhorn/longhorn-share-manager/pkg/server/nfs"
Expand All @@ -37,6 +35,7 @@ const (
)

type ShareManagerServer struct {
smrpc.UnimplementedShareManagerServiceServer
sync.RWMutex

logger logrus.FieldLogger
Expand All @@ -50,7 +49,7 @@ func NewShareManagerServer(manager *server.ShareManager) *ShareManagerServer {
}
}

func (s *ShareManagerServer) FilesystemTrim(ctx context.Context, req *FilesystemTrimRequest) (resp *emptypb.Empty, err error) {
func (s *ShareManagerServer) FilesystemTrim(ctx context.Context, req *smrpc.FilesystemTrimRequest) (resp *emptypb.Empty, err error) {
s.Lock()
defer s.Unlock()

Expand Down
Loading

0 comments on commit 73127c2

Please sign in to comment.