summaryrefslogtreecommitdiff
path: root/plugins/grpc/plugin.go
blob: b424c5d0c7a305f33bada506a84b04cb11c75ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package grpc

import (
	"github.com/spiral/errors"
	"github.com/spiral/roadrunner/v2/plugins/config"
	"github.com/spiral/roadrunner/v2/plugins/logger"
	"google.golang.org/grpc"
	"google.golang.org/grpc/encoding"
)

const (
	name string = "grpc"
)

type Plugin struct {
	config *Config
	opts   []grpc.ServerOption

	cfg config.Configurer
	log logger.Logger
}

func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
	const op = errors.Op("grpc_plugin_init")

	// register the codec
	encoding.RegisterCodec(&codec{})

	return nil
}

func (p *Plugin) Serve() chan error {
	const op = errors.Op("grpc_plugin_serve")
	errCh := make(chan error, 1)

	return errCh
}

func (p *Plugin) Stop() error {
	return nil
}

func (p *Plugin) Available() {}

func (p *Plugin) Name() string {
	return name
}