@@ -6,21 +6,11 @@ package stacksplugin1
6
6
import (
7
7
"context"
8
8
"errors"
9
- "fmt"
10
9
"net/rpc"
11
10
12
11
"github.com/hashicorp/go-plugin"
13
- svchost "github.com/hashicorp/terraform-svchost"
14
- "github.com/hashicorp/terraform-svchost/auth"
15
- "github.com/hashicorp/terraform-svchost/disco"
16
- "github.com/hashicorp/terraform/internal/command/cliconfig"
17
- pluginDiscovery "github.com/hashicorp/terraform/internal/plugin/discovery"
18
- "github.com/hashicorp/terraform/internal/stacksplugin/dynrpcserver"
12
+ "github.com/hashicorp/terraform/internal/stacksplugin"
19
13
"github.com/hashicorp/terraform/internal/stacksplugin/stacksproto1"
20
- "github.com/hashicorp/terraform/internal/stacksplugin/stacksproto1/dependencies"
21
- "github.com/hashicorp/terraform/internal/stacksplugin/stacksproto1/packages"
22
- "github.com/hashicorp/terraform/internal/stacksplugin/stacksproto1/setup"
23
- "github.com/hashicorp/terraform/internal/stacksplugin/stacksproto1/stacks"
24
14
"google.golang.org/grpc"
25
15
"google.golang.org/grpc/metadata"
26
16
)
@@ -30,6 +20,14 @@ import (
30
20
type GRPCStacksPlugin struct {
31
21
plugin.GRPCPlugin
32
22
Metadata metadata.MD
23
+ Impl stacksplugin.Stacks1
24
+ }
25
+
26
+ type GRPCStacksServer struct {
27
+ // This is the real implementation
28
+ Impl stacksplugin.Stacks1
29
+
30
+ broker * plugin.GRPCBroker
33
31
}
34
32
35
33
// Server always returns an error; we're only implementing the GRPCPlugin
@@ -49,34 +47,34 @@ func (p *GRPCStacksPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBr
49
47
ctx = metadata .NewOutgoingContext (ctx , p .Metadata )
50
48
return & GRPCStacksClient {
51
49
client : stacksproto1 .NewCommandServiceClient (c ),
50
+ broker : broker ,
52
51
context : ctx ,
53
52
}, nil
54
53
}
55
54
56
55
// GRPCServer always returns an error; we're only implementing the client
57
56
// interface, not the server.
58
57
func (p * GRPCStacksPlugin ) GRPCServer (broker * plugin.GRPCBroker , s * grpc.Server ) error {
59
-
58
+ /**
59
+ stacksproto1.RegisterCommandServiceServer(s, &GRPCStacksServer{
60
+ Impl: p.Impl,
61
+ broker: broker,
62
+ })
63
+ return nil
64
+ */
60
65
return nil
61
66
}
62
67
63
- func SetupStacksPluginServices () (dependenciesServer , stacksServer , packagesServer ) {
64
- handles := newHandleTable ()
65
- dependenciesServer := newDependenciesServer (handles )
66
- packagesServer := newPackagesServer (handles )
67
- stacksServer := newStacksServer (handles )
68
- return dependenciesServer , stacksServer , packagesServer
69
- }
70
-
71
- func registerGRPCServices (s * grpc.Server , opts * serviceOpts ) {
68
+ /**
69
+ func registerGRPCServices(s *grpc.Server) {
72
70
// We initially only register the setup server, because the registration
73
71
// of other services can vary depending on the capabilities negotiated
74
72
// during handshake.
75
- server := newSetupServer (serverHandshake (s , opts ))
73
+ server := newSetupServer(serverHandshake(s))
76
74
setup.RegisterSetupServer(s, server)
77
75
}
78
76
79
- func serverHandshake (s * grpc.Server , opts * serviceOpts ) func (context.Context , * setup.Handshake_Request , * stopper ) (* setup.ServerCapabilities , error ) {
77
+ func serverHandshake(s *grpc.Server) func(context.Context, *setup.Handshake_Request, *stopper) (*setup.ServerCapabilities, error) {
80
78
dependenciesStub := dynrpcserver.NewDependenciesStub()
81
79
dependencies.RegisterDependenciesServer(s, dependenciesStub)
82
80
stacksStub := dynrpcserver.NewStacksStub()
@@ -159,3 +157,4 @@ func newServiceDisco(config *setup.Config) (*disco.Disco, error) {
159
157
160
158
return services, nil
161
159
}
160
+ **/
0 commit comments