Skip to content

Commit

Permalink
feat: remove 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 28, 2024
1 parent 3bd089d commit 38eaf64
Show file tree
Hide file tree
Showing 40 changed files with 94 additions and 10,770 deletions.
5 changes: 2 additions & 3 deletions app/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ import (
helperutil "github.com/longhorn/go-spdk-helper/pkg/util"
spdk "github.com/longhorn/longhorn-spdk-engine/pkg/spdk"
spdkutil "github.com/longhorn/longhorn-spdk-engine/pkg/util"
spdkrpc "github.com/longhorn/longhorn-spdk-engine/proto/spdkrpc"
rpc "github.com/longhorn/types/pkg/imrpc"
spdkrpc "github.com/longhorn/types/pkg/spdkrpc"

"github.com/longhorn/longhorn-instance-manager/pkg/disk"
"github.com/longhorn/longhorn-instance-manager/pkg/health"
rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/instance"
"github.com/longhorn/longhorn-instance-manager/pkg/process"
"github.com/longhorn/longhorn-instance-manager/pkg/proxy"

"github.com/longhorn/longhorn-instance-manager/pkg/types"
"github.com/longhorn/longhorn-instance-manager/pkg/util"
)
Expand Down
42 changes: 0 additions & 42 deletions generate_grpc.sh

This file was deleted.

5 changes: 2 additions & 3 deletions pkg/api/instance.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package api

import (
rpc "github.com/longhorn/types/pkg/imrpc"
"github.com/longhorn/types/pkg/spdkrpc"
"google.golang.org/protobuf/types/known/emptypb"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-spdk-engine/proto/spdkrpc"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/process.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package api

import (
rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
rpc "github.com/longhorn/types/pkg/imrpc"
)

type Process struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"crypto/tls"
"fmt"

rpc "github.com/longhorn/types/pkg/imrpc"
"github.com/pkg/errors"
"google.golang.org/grpc"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/longhorn/longhorn-instance-manager/pkg/api"
rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/meta"
"github.com/longhorn/longhorn-instance-manager/pkg/types"
"github.com/longhorn/longhorn-instance-manager/pkg/util"
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"crypto/tls"
"fmt"

rpc "github.com/longhorn/types/pkg/imrpc"
"github.com/pkg/errors"
"google.golang.org/grpc"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/longhorn/longhorn-instance-manager/pkg/api"
rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/meta"
"github.com/longhorn/longhorn-instance-manager/pkg/types"
"github.com/longhorn/longhorn-instance-manager/pkg/util"
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/process_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"crypto/tls"
"fmt"

rpc "github.com/longhorn/types/pkg/imrpc"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/longhorn/longhorn-instance-manager/pkg/api"
rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/meta"
"github.com/longhorn/longhorn-instance-manager/pkg/types"
"github.com/longhorn/longhorn-instance-manager/pkg/util"
Expand Down
7 changes: 3 additions & 4 deletions pkg/client/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ import (
"crypto/tls"
"fmt"

emeta "github.com/longhorn/longhorn-engine/pkg/meta"
eclient "github.com/longhorn/longhorn-engine/pkg/replica/client"
rpc "github.com/longhorn/types/pkg/imrpc"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
healthpb "google.golang.org/grpc/health/grpc_health_v1"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/meta"
"github.com/longhorn/longhorn-instance-manager/pkg/util"

emeta "github.com/longhorn/longhorn-engine/pkg/meta"
eclient "github.com/longhorn/longhorn-engine/pkg/replica/client"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions pkg/client/proxy_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"encoding/json"
"fmt"

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

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
)

func (c *ProxyClient) CleanupBackupMountPoints() (err error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/proxy_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"github.com/pkg/errors"

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

func (c *ProxyClient) MetricsGet(engineName, volumeName, serviceAddress string) (metrics *Metrics, err error) {
Expand Down
11 changes: 4 additions & 7 deletions pkg/client/proxy_replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ package client
import (
"fmt"

"github.com/pkg/errors"

etypes "github.com/longhorn/longhorn-engine/pkg/types"
eptypes "github.com/longhorn/longhorn-engine/proto/ptypes"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
rpc "github.com/longhorn/types/pkg/imrpc"
"github.com/pkg/errors"
)

func (c *ProxyClient) ReplicaAdd(dataEngine, engineName, volumeName, serviceAddress, replicaName,
Expand Down Expand Up @@ -99,7 +96,7 @@ func (c *ProxyClient) ReplicaList(dataEngine, engineName, volumeName,
for _, cr := range resp.ReplicaList.Replicas {
rInfoList = append(rInfoList, &etypes.ControllerReplicaInfo{
Address: cr.Address.Address,
Mode: eptypes.GRPCReplicaModeToReplicaMode(cr.Mode),
Mode: etypes.GRPCReplicaModeToReplicaMode(cr.Mode),
})
}

Expand Down Expand Up @@ -258,7 +255,7 @@ func (c *ProxyClient) ReplicaModeUpdate(dataEngine, serviceAddress, replicaAddre
DataEngine: rpc.DataEngine(driver),
},
ReplicaAddress: replicaAddress,
Mode: eptypes.ReplicaModeToGRPCReplicaMode(etypes.Mode(mode)),
Mode: etypes.ReplicaModeToGRPCReplicaMode(etypes.Mode(mode)),
}
_, err = c.service.ReplicaModeUpdate(getContextWithGRPCTimeout(c.ctx), req)
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/client/proxy_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (

etypes "github.com/longhorn/longhorn-engine/pkg/types"
eutil "github.com/longhorn/longhorn-engine/pkg/util"
eptypes "github.com/longhorn/longhorn-engine/proto/ptypes"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/types/pkg/enginerpc"
rpc "github.com/longhorn/types/pkg/imrpc"
)

func (c *ProxyClient) VolumeSnapshot(dataEngine, engineName, volumeName, serviceAddress,
Expand Down Expand Up @@ -55,7 +54,7 @@ func (c *ProxyClient) VolumeSnapshot(dataEngine, engineName, volumeName, service
DataEngine: rpc.DataEngine(driver),
VolumeName: volumeName,
},
SnapshotVolume: &eptypes.VolumeSnapshotRequest{
SnapshotVolume: &enginerpc.VolumeSnapshotRequest{
Name: volumeSnapshotName,
Labels: labels,
},
Expand Down
15 changes: 7 additions & 8 deletions pkg/client/proxy_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"github.com/pkg/errors"

etypes "github.com/longhorn/longhorn-engine/pkg/types"
eptypes "github.com/longhorn/longhorn-engine/proto/ptypes"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/types/pkg/enginerpc"
rpc "github.com/longhorn/types/pkg/imrpc"
)

func (c *ProxyClient) VolumeGet(dataEngine, engineName, volumeName, serviceAddress string) (info *etypes.VolumeInfo, err error) {
Expand Down Expand Up @@ -90,7 +89,7 @@ func (c *ProxyClient) VolumeExpand(dataEngine, engineName, volumeName, serviceAd
DataEngine: rpc.DataEngine(driver),
VolumeName: volumeName,
},
Expand: &eptypes.VolumeExpandRequest{
Expand: &enginerpc.VolumeExpandRequest{
Size: size,
},
}
Expand Down Expand Up @@ -131,7 +130,7 @@ func (c *ProxyClient) VolumeFrontendStart(dataEngine, engineName, volumeName, se
DataEngine: rpc.DataEngine(driver),
VolumeName: volumeName,
},
FrontendStart: &eptypes.VolumeFrontendStartRequest{
FrontendStart: &enginerpc.VolumeFrontendStartRequest{
Frontend: frontendName,
},
}
Expand Down Expand Up @@ -207,7 +206,7 @@ func (c *ProxyClient) VolumeUnmapMarkSnapChainRemovedSet(dataEngine, engineName,
DataEngine: rpc.DataEngine(driver),
VolumeName: volumeName,
},
UnmapMarkSnap: &eptypes.VolumeUnmapMarkSnapChainRemovedSetRequest{Enabled: enabled},
UnmapMarkSnap: &enginerpc.VolumeUnmapMarkSnapChainRemovedSetRequest{Enabled: enabled},
}
_, err = c.service.VolumeUnmapMarkSnapChainRemovedSet(getContextWithGRPCTimeout(c.ctx), req)
if err != nil {
Expand Down Expand Up @@ -247,7 +246,7 @@ func (c *ProxyClient) VolumeSnapshotMaxCountSet(dataEngine, engineName, volumeNa
DataEngine: rpc.DataEngine(driver),
VolumeName: volumeName,
},
Count: &eptypes.VolumeSnapshotMaxCountSetRequest{Count: int32(count)},
Count: &enginerpc.VolumeSnapshotMaxCountSetRequest{Count: int32(count)},
}
_, err = c.service.VolumeSnapshotMaxCountSet(getContextWithGRPCTimeout(c.ctx), req)
if err != nil {
Expand Down Expand Up @@ -287,7 +286,7 @@ func (c *ProxyClient) VolumeSnapshotMaxSizeSet(dataEngine, engineName, volumeNam
DataEngine: rpc.DataEngine(driver),
VolumeName: volumeName,
},
Size: &eptypes.VolumeSnapshotMaxSizeSetRequest{Size: size},
Size: &enginerpc.VolumeSnapshotMaxSizeSetRequest{Size: size},
}
_, err = c.service.VolumeSnapshotMaxSizeSet(getContextWithGRPCTimeout(c.ctx), req)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

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

const (
Expand Down
9 changes: 5 additions & 4 deletions pkg/disk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import (
"sync"
"time"

"github.com/longhorn/longhorn-spdk-engine/pkg/api"
spdkclient "github.com/longhorn/longhorn-spdk-engine/pkg/client"
rpc "github.com/longhorn/types/pkg/imrpc"
spdkrpc "github.com/longhorn/types/pkg/spdkrpc"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
grpccodes "google.golang.org/grpc/codes"
grpcstatus "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
"github.com/longhorn/longhorn-instance-manager/pkg/meta"
"github.com/longhorn/longhorn-instance-manager/pkg/types"
"github.com/longhorn/longhorn-instance-manager/pkg/util"
"github.com/longhorn/longhorn-spdk-engine/pkg/api"
spdkclient "github.com/longhorn/longhorn-spdk-engine/pkg/client"
spdkrpc "github.com/longhorn/longhorn-spdk-engine/proto/spdkrpc"
)

const (
Expand All @@ -39,6 +39,7 @@ type BlockDiskOps struct {
}

type Server struct {
rpc.UnimplementedDiskServiceServer
sync.RWMutex

ctx context.Context
Expand Down
Loading

0 comments on commit 38eaf64

Please sign in to comment.