mirror of https://github.com/grafana/grafana
parent
1857690bd0
commit
40829d645c
@ -1,30 +0,0 @@ |
|||||||
package resource |
|
||||||
|
|
||||||
import ( |
|
||||||
"github.com/fullstorydev/grpchan" |
|
||||||
"github.com/fullstorydev/grpchan/inprocgrpc" |
|
||||||
grpcAuth "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth" |
|
||||||
"google.golang.org/grpc" |
|
||||||
|
|
||||||
grpcUtils "github.com/grafana/grafana/pkg/services/store/entity/grpc" |
|
||||||
) |
|
||||||
|
|
||||||
func NewResourceStoreClientLocal(server ResourceStoreServer) ResourceStoreClient { |
|
||||||
channel := &inprocgrpc.Channel{} |
|
||||||
|
|
||||||
auth := &grpcUtils.Authenticator{} |
|
||||||
|
|
||||||
channel.RegisterService( |
|
||||||
grpchan.InterceptServer( |
|
||||||
&ResourceStore_ServiceDesc, |
|
||||||
grpcAuth.UnaryServerInterceptor(auth.Authenticate), |
|
||||||
grpcAuth.StreamServerInterceptor(auth.Authenticate), |
|
||||||
), |
|
||||||
server, |
|
||||||
) |
|
||||||
return NewResourceStoreClient(grpchan.InterceptClientConn(channel, grpcUtils.UnaryClientInterceptor, grpcUtils.StreamClientInterceptor)) |
|
||||||
} |
|
||||||
|
|
||||||
func NewEntityStoreClientGRPC(channel *grpc.ClientConn) ResourceStoreClient { |
|
||||||
return NewResourceStoreClient(grpchan.InterceptClientConn(channel, grpcUtils.UnaryClientInterceptor, grpcUtils.StreamClientInterceptor)) |
|
||||||
} |
|
||||||
Loading…
Reference in new issue