forked from yarpc/yarpc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
45 lines (38 loc) · 1.31 KB
/
server.go
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
// Code generated by thriftrw-plugin-yarpc
// @generated
package readonlystorefx
import (
fx "go.uber.org/fx"
transport "go.uber.org/yarpc/api/transport"
thrift "go.uber.org/yarpc/encoding/thrift"
readonlystoreserver "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic/readonlystoreserver"
)
// ServerParams defines the dependencies for the ReadOnlyStore server.
type ServerParams struct {
fx.In
Handler readonlystoreserver.Interface
}
// ServerResult defines the output of ReadOnlyStore server module. It provides the
// procedures of a ReadOnlyStore handler to an Fx application.
//
// The procedures are provided to the "yarpcfx" value group. Dig 1.2 or newer
// must be used for this feature to work.
type ServerResult struct {
fx.Out
Procedures []transport.Procedure `group:"yarpcfx"`
}
// Server provides procedures for ReadOnlyStore to an Fx application. It expects a
// readonlystorefx.Interface to be present in the container.
//
// fx.Provide(
// func(h *MyReadOnlyStoreHandler) readonlystoreserver.Interface {
// return h
// },
// readonlystorefx.Server(),
// )
func Server(opts ...thrift.RegisterOption) interface{} {
return func(p ServerParams) ServerResult {
procedures := readonlystoreserver.New(p.Handler, opts...)
return ServerResult{Procedures: procedures}
}
}