Files
grafana/pkg/services/authz/zanzana/client.go
T
Alexander Zobnin 4bc9203cf6 Zanzana: Perform shadow requests (#103444)
* Zanzana: Execute checks in the background

* add metrics

* collect metrics

* cleanup

* shadow compile checker

* add time metrics for compiler

* run compile in parallel

* prevent deadlock
2025-04-08 10:03:35 +02:00

34 lines
1.0 KiB
Go

package zanzana
import (
"context"
"google.golang.org/grpc"
authlib "github.com/grafana/authlib/types"
"github.com/prometheus/client_golang/prometheus"
authzextv1 "github.com/grafana/grafana/pkg/services/authz/proto/v1"
"github.com/grafana/grafana/pkg/services/authz/zanzana/client"
)
// Client is a wrapper around [openfgav1.OpenFGAServiceClient]
type Client interface {
authlib.AccessClient
Read(ctx context.Context, req *authzextv1.ReadRequest) (*authzextv1.ReadResponse, error)
Write(ctx context.Context, req *authzextv1.WriteRequest) error
BatchCheck(ctx context.Context, req *authzextv1.BatchCheckRequest) (*authzextv1.BatchCheckResponse, error)
}
func NewClient(cc grpc.ClientConnInterface) (*client.Client, error) {
return client.New(cc)
}
func WithShadowClient(accessClient authlib.AccessClient, zanzanaClient authlib.AccessClient, reg prometheus.Registerer) (authlib.AccessClient, error) {
return client.WithShadowClient(accessClient, zanzanaClient, reg), nil
}
func NewNoopClient() *client.NoopClient {
return client.NewNoop()
}