@@ -12,9 +12,11 @@ import (
12
12
13
13
type AdminServer struct {
14
14
roxy_v0.UnimplementedAdminServer
15
+
16
+ ref * Ref
15
17
}
16
18
17
- func (AdminServer ) Ping (ctx context.Context , req * roxy_v0.PingRequest ) (* roxy_v0.PingResponse , error ) {
19
+ func (s AdminServer ) Ping (ctx context.Context , req * roxy_v0.PingRequest ) (* roxy_v0.PingResponse , error ) {
18
20
log .Logger .Info ().
19
21
Str ("rpcService" , "roxy.v0.Admin" ).
20
22
Str ("rpcMethod" , "Ping" ).
@@ -24,7 +26,7 @@ func (AdminServer) Ping(ctx context.Context, req *roxy_v0.PingRequest) (*roxy_v0
24
26
return & roxy_v0.PingResponse {}, nil
25
27
}
26
28
27
- func (AdminServer ) Reload (ctx context.Context , req * roxy_v0.ReloadRequest ) (* roxy_v0.ReloadResponse , error ) {
29
+ func (s AdminServer ) Reload (ctx context.Context , req * roxy_v0.ReloadRequest ) (* roxy_v0.ReloadResponse , error ) {
28
30
log .Logger .Info ().
29
31
Str ("rpcService" , "roxy.v0.Admin" ).
30
32
Str ("rpcMethod" , "Reload" ).
@@ -34,10 +36,27 @@ func (AdminServer) Reload(ctx context.Context, req *roxy_v0.ReloadRequest) (*rox
34
36
if err := gMultiServer .Reload (); err != nil {
35
37
return nil , status .Error (codes .Internal , err .Error ())
36
38
}
39
+
40
+ if err := s .ref .Load (ctx , req .Rev ); err != nil {
41
+ return nil , status .Error (codes .Internal , err .Error ())
42
+ }
43
+
37
44
return & roxy_v0.ReloadResponse {}, nil
38
45
}
39
46
40
- func (AdminServer ) Shutdown (ctx context.Context , req * roxy_v0.ShutdownRequest ) (* roxy_v0.ShutdownResponse , error ) {
47
+ func (s AdminServer ) Flip (ctx context.Context , req * roxy_v0.FlipRequest ) (* roxy_v0.FlipResponse , error ) {
48
+ log .Logger .Info ().
49
+ Str ("rpcService" , "roxy.v0.Admin" ).
50
+ Str ("rpcMethod" , "Flip" ).
51
+ Str ("rpcInterface" , "admin" ).
52
+ Msg ("RPC" )
53
+
54
+ s .ref .Flip ()
55
+
56
+ return & roxy_v0.FlipResponse {}, nil
57
+ }
58
+
59
+ func (s AdminServer ) Shutdown (ctx context.Context , req * roxy_v0.ShutdownRequest ) (* roxy_v0.ShutdownResponse , error ) {
41
60
log .Logger .Info ().
42
61
Str ("rpcService" , "roxy.v0.Admin" ).
43
62
Str ("rpcMethod" , "Shutdown" ).
@@ -50,7 +69,7 @@ func (AdminServer) Shutdown(ctx context.Context, req *roxy_v0.ShutdownRequest) (
50
69
return & roxy_v0.ShutdownResponse {}, nil
51
70
}
52
71
53
- func (AdminServer ) SetHealth (ctx context.Context , req * roxy_v0.SetHealthRequest ) (* roxy_v0.SetHealthResponse , error ) {
72
+ func (s AdminServer ) SetHealth (ctx context.Context , req * roxy_v0.SetHealthRequest ) (* roxy_v0.SetHealthResponse , error ) {
54
73
log .Logger .Info ().
55
74
Str ("rpcService" , "roxy.v0.Admin" ).
56
75
Str ("rpcMethod" , "SetHealth" ).
0 commit comments