Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add longhorn/types #139

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/generated/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.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ replace (
require (
github.com/google/fscrypt v0.3.5
github.com/longhorn/go-common-libs v0.0.0-20240411093823-b8862efb8e03
github.com/longhorn/types v0.0.0-20240417064442-e7df610ea802
github.com/mitchellh/go-ps v1.0.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
Expand All @@ -52,7 +53,6 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
Expand Down
89 changes: 3 additions & 86 deletions go.sum

Large diffs are not rendered by default.

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/generated/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/generated/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