github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/services/dispatch/server.go (about)

     1  package dispatch
     2  
     3  import (
     4  	"github.com/authzed/grpcutil"
     5  	"google.golang.org/grpc"
     6  	healthpb "google.golang.org/grpc/health/grpc_health_v1"
     7  	"google.golang.org/grpc/reflection"
     8  
     9  	"github.com/authzed/spicedb/internal/dispatch"
    10  	dispatch_v1 "github.com/authzed/spicedb/internal/services/dispatch/v1"
    11  	dispatchv1 "github.com/authzed/spicedb/pkg/proto/dispatch/v1"
    12  )
    13  
    14  // RegisterGrpcServices registers an internal dispatch service with the specified server.
    15  func RegisterGrpcServices(
    16  	srv *grpc.Server,
    17  	d dispatch.Dispatcher,
    18  ) {
    19  	srv.RegisterService(&dispatchv1.DispatchService_ServiceDesc, dispatch_v1.NewDispatchServer(d))
    20  	healthSrv := grpcutil.NewAuthlessHealthServer()
    21  	healthSrv.SetServicesHealthy(&dispatchv1.DispatchService_ServiceDesc)
    22  	healthpb.RegisterHealthServer(srv, healthSrv)
    23  	reflection.Register(srv)
    24  }