Documentation
¶
Overview ¶
Code generated by github.com/ecordell/optgen. DO NOT EDIT.
Index ¶
- Variables
- func DefaultDispatchMiddleware(logger zerolog.Logger, authFunc grpcauth.AuthFunc, ds datastore.Datastore) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
- func DefaultMiddleware(logger zerolog.Logger, authFunc grpcauth.AuthFunc, enableVersionResponse bool, ...) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
- func DefaultPreRunE(programName string) cobrautil.CobraRunFunc
- func MetricsHandler(telemetryRegistry *prometheus.Registry) http.Handler
- func RegisterCacheConfigFlags(flags *pflag.FlagSet, config *CacheConfig, flagPrefix string)
- func ServeExample(programName string) string
- type CacheConfig
- type Config
- type ConfigOption
- func SetDispatchStreamingMiddleware(dispatchStreamingMiddleware []grpc.StreamServerInterceptor) ConfigOption
- func SetDispatchUnaryMiddleware(dispatchUnaryMiddleware []grpc.UnaryServerInterceptor) ConfigOption
- func SetHTTPGatewayCorsAllowedOrigins(hTTPGatewayCorsAllowedOrigins []string) ConfigOption
- func SetPresharedKey(presharedKey []string) ConfigOption
- func SetStreamingMiddleware(streamingMiddleware []grpc.StreamServerInterceptor) ConfigOption
- func SetUnaryMiddleware(unaryMiddleware []grpc.UnaryServerInterceptor) ConfigOption
- func WithClusterDispatchCacheConfig(clusterDispatchCacheConfig CacheConfig) ConfigOption
- func WithDashboardAPI(dashboardAPI util.HTTPServerConfig) ConfigOption
- func WithDatastore(datastore datastore1.Datastore) ConfigOption
- func WithDatastoreConfig(datastoreConfig datastore.Config) ConfigOption
- func WithDisableV1SchemaAPI(disableV1SchemaAPI bool) ConfigOption
- func WithDisableVersionResponse(disableVersionResponse bool) ConfigOption
- func WithDispatchCacheConfig(dispatchCacheConfig CacheConfig) ConfigOption
- func WithDispatchClientMetricsPrefix(dispatchClientMetricsPrefix string) ConfigOption
- func WithDispatchClusterMetricsPrefix(dispatchClusterMetricsPrefix string) ConfigOption
- func WithDispatchConcurrencyLimit(dispatchConcurrencyLimit uint16) ConfigOption
- func WithDispatchMaxDepth(dispatchMaxDepth uint32) ConfigOption
- func WithDispatchServer(dispatchServer util.GRPCServerConfig) ConfigOption
- func WithDispatchStreamingMiddleware(dispatchStreamingMiddleware grpc.StreamServerInterceptor) ConfigOption
- func WithDispatchUnaryMiddleware(dispatchUnaryMiddleware grpc.UnaryServerInterceptor) ConfigOption
- func WithDispatchUpstreamAddr(dispatchUpstreamAddr string) ConfigOption
- func WithDispatchUpstreamCAPath(dispatchUpstreamCAPath string) ConfigOption
- func WithDispatcher(dispatcher dispatch.Dispatcher) ConfigOption
- func WithGRPCAuthFunc(gRPCAuthFunc auth.AuthFunc) ConfigOption
- func WithGRPCServer(gRPCServer util.GRPCServerConfig) ConfigOption
- func WithHTTPGateway(hTTPGateway util.HTTPServerConfig) ConfigOption
- func WithHTTPGatewayCorsAllowedOrigins(hTTPGatewayCorsAllowedOrigins string) ConfigOption
- func WithHTTPGatewayCorsEnabled(hTTPGatewayCorsEnabled bool) ConfigOption
- func WithHTTPGatewayUpstreamAddr(hTTPGatewayUpstreamAddr string) ConfigOption
- func WithHTTPGatewayUpstreamTLSCertPath(hTTPGatewayUpstreamTLSCertPath string) ConfigOption
- func WithMetricsAPI(metricsAPI util.HTTPServerConfig) ConfigOption
- func WithNamespaceCacheConfig(namespaceCacheConfig CacheConfig) ConfigOption
- func WithPresharedKey(presharedKey string) ConfigOption
- func WithSchemaPrefixesRequired(schemaPrefixesRequired bool) ConfigOption
- func WithShutdownGracePeriod(shutdownGracePeriod time.Duration) ConfigOption
- func WithSilentlyDisableTelemetry(silentlyDisableTelemetry bool) ConfigOption
- func WithStreamingMiddleware(streamingMiddleware grpc.StreamServerInterceptor) ConfigOption
- func WithTelemetryCAOverridePath(telemetryCAOverridePath string) ConfigOption
- func WithTelemetryEndpoint(telemetryEndpoint string) ConfigOption
- func WithTelemetryInterval(telemetryInterval time.Duration) ConfigOption
- func WithUnaryMiddleware(unaryMiddleware grpc.UnaryServerInterceptor) ConfigOption
- type RunnableServer
Constants ¶
This section is empty.
Variables ¶
var DisableTelemetryHandler *prometheus.Registry
Functions ¶
func DefaultDispatchMiddleware ¶
func DefaultDispatchMiddleware(logger zerolog.Logger, authFunc grpcauth.AuthFunc, ds datastore.Datastore) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
func DefaultMiddleware ¶
func DefaultMiddleware(logger zerolog.Logger, authFunc grpcauth.AuthFunc, enableVersionResponse bool, dispatcher dispatch.Dispatcher, ds datastore.Datastore) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
func DefaultPreRunE ¶
func DefaultPreRunE(programName string) cobrautil.CobraRunFunc
DefaultPreRunE sets up viper, zerolog, and OpenTelemetry flag handling for a command.
func MetricsHandler ¶
func MetricsHandler(telemetryRegistry *prometheus.Registry) http.Handler
MetricsHandler sets up an HTTP server that handles serving Prometheus metrics and pprof endpoints.
func RegisterCacheConfigFlags ¶
func RegisterCacheConfigFlags(flags *pflag.FlagSet, config *CacheConfig, flagPrefix string)
RegisterCacheConfigFlags registers flags for a ristretto-based cache.
func ServeExample ¶
ServeExample creates an example usage string with the provided program name.
Types ¶
type CacheConfig ¶
CacheConfig defines configuration for a ristretto cache. See: https://github.com/dgraph-io/ristretto#Config
type Config ¶
type Config struct {
// API config
GRPCServer util.GRPCServerConfig
GRPCAuthFunc grpc_auth.AuthFunc
ShutdownGracePeriod time.Duration
DisableVersionResponse bool
// GRPC Gateway config
HTTPGateway util.HTTPServerConfig
HTTPGatewayUpstreamAddr string
HTTPGatewayUpstreamTLSCertPath string
HTTPGatewayCorsEnabled bool
HTTPGatewayCorsAllowedOrigins []string
// Datastore
DatastoreConfig datastorecfg.Config
Datastore datastore.Datastore
// Namespace cache
NamespaceCacheConfig CacheConfig
// Schema options
SchemaPrefixesRequired bool
// Dispatch options
DispatchServer util.GRPCServerConfig
DispatchMaxDepth uint32
DispatchConcurrencyLimit uint16
DispatchUpstreamAddr string
DispatchUpstreamCAPath string
DispatchClientMetricsPrefix string
DispatchClusterMetricsPrefix string
Dispatcher dispatch.Dispatcher
DispatchCacheConfig CacheConfig
ClusterDispatchCacheConfig CacheConfig
// API Behavior
DisableV1SchemaAPI bool
// Additional Services
DashboardAPI util.HTTPServerConfig
MetricsAPI util.HTTPServerConfig
// Middleware for grpc
UnaryMiddleware []grpc.UnaryServerInterceptor
StreamingMiddleware []grpc.StreamServerInterceptor
// Middleware for dispatch
DispatchUnaryMiddleware []grpc.UnaryServerInterceptor
DispatchStreamingMiddleware []grpc.StreamServerInterceptor
// Telemetry
SilentlyDisableTelemetry bool
TelemetryCAOverridePath string
TelemetryEndpoint string
TelemetryInterval time.Duration
}
func ConfigWithOptions ¶
func ConfigWithOptions(c *Config, opts ...ConfigOption) *Config
ConfigWithOptions configures an existing Config with the passed in options set
func NewConfigWithOptions ¶
func NewConfigWithOptions(opts ...ConfigOption) *Config
NewConfigWithOptions creates a new Config with the passed in options set
func (*Config) Complete ¶
func (c *Config) Complete() (RunnableServer, error)
Complete validates the config and fills out defaults. if there is no error, a completedServerConfig (with limited options for mutation) is returned.
func (*Config) ToOption ¶
func (c *Config) ToOption() ConfigOption
ToOption returns a new ConfigOption that sets the values from the passed in Config
type ConfigOption ¶
type ConfigOption func(c *Config)
func SetDispatchStreamingMiddleware ¶
func SetDispatchStreamingMiddleware(dispatchStreamingMiddleware []grpc.StreamServerInterceptor) ConfigOption
SetDispatchStreamingMiddleware returns an option that can set DispatchStreamingMiddleware on a Config
func SetDispatchUnaryMiddleware ¶
func SetDispatchUnaryMiddleware(dispatchUnaryMiddleware []grpc.UnaryServerInterceptor) ConfigOption
SetDispatchUnaryMiddleware returns an option that can set DispatchUnaryMiddleware on a Config
func SetHTTPGatewayCorsAllowedOrigins ¶
func SetHTTPGatewayCorsAllowedOrigins(hTTPGatewayCorsAllowedOrigins []string) ConfigOption
SetHTTPGatewayCorsAllowedOrigins returns an option that can set HTTPGatewayCorsAllowedOrigins on a Config
func SetPresharedKey ¶ added in v1.7.0
func SetPresharedKey(presharedKey []string) ConfigOption
SetPresharedKey returns an option that can set PresharedKey on a Config
func SetStreamingMiddleware ¶
func SetStreamingMiddleware(streamingMiddleware []grpc.StreamServerInterceptor) ConfigOption
SetStreamingMiddleware returns an option that can set StreamingMiddleware on a Config
func SetUnaryMiddleware ¶
func SetUnaryMiddleware(unaryMiddleware []grpc.UnaryServerInterceptor) ConfigOption
SetUnaryMiddleware returns an option that can set UnaryMiddleware on a Config
func WithClusterDispatchCacheConfig ¶
func WithClusterDispatchCacheConfig(clusterDispatchCacheConfig CacheConfig) ConfigOption
WithClusterDispatchCacheConfig returns an option that can set ClusterDispatchCacheConfig on a Config
func WithDashboardAPI ¶
func WithDashboardAPI(dashboardAPI util.HTTPServerConfig) ConfigOption
WithDashboardAPI returns an option that can set DashboardAPI on a Config
func WithDatastore ¶
func WithDatastore(datastore datastore1.Datastore) ConfigOption
WithDatastore returns an option that can set Datastore on a Config
func WithDatastoreConfig ¶
func WithDatastoreConfig(datastoreConfig datastore.Config) ConfigOption
WithDatastoreConfig returns an option that can set DatastoreConfig on a Config
func WithDisableV1SchemaAPI ¶
func WithDisableV1SchemaAPI(disableV1SchemaAPI bool) ConfigOption
WithDisableV1SchemaAPI returns an option that can set DisableV1SchemaAPI on a Config
func WithDisableVersionResponse ¶ added in v1.8.0
func WithDisableVersionResponse(disableVersionResponse bool) ConfigOption
WithDisableVersionResponse returns an option that can set DisableVersionResponse on a Config
func WithDispatchCacheConfig ¶
func WithDispatchCacheConfig(dispatchCacheConfig CacheConfig) ConfigOption
WithDispatchCacheConfig returns an option that can set DispatchCacheConfig on a Config
func WithDispatchClientMetricsPrefix ¶
func WithDispatchClientMetricsPrefix(dispatchClientMetricsPrefix string) ConfigOption
WithDispatchClientMetricsPrefix returns an option that can set DispatchClientMetricsPrefix on a Config
func WithDispatchClusterMetricsPrefix ¶ added in v1.6.0
func WithDispatchClusterMetricsPrefix(dispatchClusterMetricsPrefix string) ConfigOption
WithDispatchClusterMetricsPrefix returns an option that can set DispatchClusterMetricsPrefix on a Config
func WithDispatchConcurrencyLimit ¶ added in v1.11.0
func WithDispatchConcurrencyLimit(dispatchConcurrencyLimit uint16) ConfigOption
WithDispatchConcurrencyLimit returns an option that can set DispatchConcurrencyLimit on a Config
func WithDispatchMaxDepth ¶
func WithDispatchMaxDepth(dispatchMaxDepth uint32) ConfigOption
WithDispatchMaxDepth returns an option that can set DispatchMaxDepth on a Config
func WithDispatchServer ¶
func WithDispatchServer(dispatchServer util.GRPCServerConfig) ConfigOption
WithDispatchServer returns an option that can set DispatchServer on a Config
func WithDispatchStreamingMiddleware ¶
func WithDispatchStreamingMiddleware(dispatchStreamingMiddleware grpc.StreamServerInterceptor) ConfigOption
WithDispatchStreamingMiddleware returns an option that can append DispatchStreamingMiddlewares to Config.DispatchStreamingMiddleware
func WithDispatchUnaryMiddleware ¶
func WithDispatchUnaryMiddleware(dispatchUnaryMiddleware grpc.UnaryServerInterceptor) ConfigOption
WithDispatchUnaryMiddleware returns an option that can append DispatchUnaryMiddlewares to Config.DispatchUnaryMiddleware
func WithDispatchUpstreamAddr ¶
func WithDispatchUpstreamAddr(dispatchUpstreamAddr string) ConfigOption
WithDispatchUpstreamAddr returns an option that can set DispatchUpstreamAddr on a Config
func WithDispatchUpstreamCAPath ¶
func WithDispatchUpstreamCAPath(dispatchUpstreamCAPath string) ConfigOption
WithDispatchUpstreamCAPath returns an option that can set DispatchUpstreamCAPath on a Config
func WithDispatcher ¶
func WithDispatcher(dispatcher dispatch.Dispatcher) ConfigOption
WithDispatcher returns an option that can set Dispatcher on a Config
func WithGRPCAuthFunc ¶
func WithGRPCAuthFunc(gRPCAuthFunc auth.AuthFunc) ConfigOption
WithGRPCAuthFunc returns an option that can set GRPCAuthFunc on a Config
func WithGRPCServer ¶
func WithGRPCServer(gRPCServer util.GRPCServerConfig) ConfigOption
WithGRPCServer returns an option that can set GRPCServer on a Config
func WithHTTPGateway ¶
func WithHTTPGateway(hTTPGateway util.HTTPServerConfig) ConfigOption
WithHTTPGateway returns an option that can set HTTPGateway on a Config
func WithHTTPGatewayCorsAllowedOrigins ¶
func WithHTTPGatewayCorsAllowedOrigins(hTTPGatewayCorsAllowedOrigins string) ConfigOption
WithHTTPGatewayCorsAllowedOrigins returns an option that can append HTTPGatewayCorsAllowedOriginss to Config.HTTPGatewayCorsAllowedOrigins
func WithHTTPGatewayCorsEnabled ¶
func WithHTTPGatewayCorsEnabled(hTTPGatewayCorsEnabled bool) ConfigOption
WithHTTPGatewayCorsEnabled returns an option that can set HTTPGatewayCorsEnabled on a Config
func WithHTTPGatewayUpstreamAddr ¶
func WithHTTPGatewayUpstreamAddr(hTTPGatewayUpstreamAddr string) ConfigOption
WithHTTPGatewayUpstreamAddr returns an option that can set HTTPGatewayUpstreamAddr on a Config
func WithHTTPGatewayUpstreamTLSCertPath ¶
func WithHTTPGatewayUpstreamTLSCertPath(hTTPGatewayUpstreamTLSCertPath string) ConfigOption
WithHTTPGatewayUpstreamTLSCertPath returns an option that can set HTTPGatewayUpstreamTLSCertPath on a Config
func WithMetricsAPI ¶
func WithMetricsAPI(metricsAPI util.HTTPServerConfig) ConfigOption
WithMetricsAPI returns an option that can set MetricsAPI on a Config
func WithNamespaceCacheConfig ¶
func WithNamespaceCacheConfig(namespaceCacheConfig CacheConfig) ConfigOption
WithNamespaceCacheConfig returns an option that can set NamespaceCacheConfig on a Config
func WithPresharedKey ¶
func WithPresharedKey(presharedKey string) ConfigOption
WithPresharedKey returns an option that can append PresharedKeys to Config.PresharedKey
func WithSchemaPrefixesRequired ¶
func WithSchemaPrefixesRequired(schemaPrefixesRequired bool) ConfigOption
WithSchemaPrefixesRequired returns an option that can set SchemaPrefixesRequired on a Config
func WithShutdownGracePeriod ¶
func WithShutdownGracePeriod(shutdownGracePeriod time.Duration) ConfigOption
WithShutdownGracePeriod returns an option that can set ShutdownGracePeriod on a Config
func WithSilentlyDisableTelemetry ¶ added in v1.7.0
func WithSilentlyDisableTelemetry(silentlyDisableTelemetry bool) ConfigOption
WithSilentlyDisableTelemetry returns an option that can set SilentlyDisableTelemetry on a Config
func WithStreamingMiddleware ¶
func WithStreamingMiddleware(streamingMiddleware grpc.StreamServerInterceptor) ConfigOption
WithStreamingMiddleware returns an option that can append StreamingMiddlewares to Config.StreamingMiddleware
func WithTelemetryCAOverridePath ¶ added in v1.7.0
func WithTelemetryCAOverridePath(telemetryCAOverridePath string) ConfigOption
WithTelemetryCAOverridePath returns an option that can set TelemetryCAOverridePath on a Config
func WithTelemetryEndpoint ¶ added in v1.7.0
func WithTelemetryEndpoint(telemetryEndpoint string) ConfigOption
WithTelemetryEndpoint returns an option that can set TelemetryEndpoint on a Config
func WithTelemetryInterval ¶ added in v1.7.0
func WithTelemetryInterval(telemetryInterval time.Duration) ConfigOption
WithTelemetryInterval returns an option that can set TelemetryInterval on a Config
func WithUnaryMiddleware ¶
func WithUnaryMiddleware(unaryMiddleware grpc.UnaryServerInterceptor) ConfigOption
WithUnaryMiddleware returns an option that can append UnaryMiddlewares to Config.UnaryMiddleware
type RunnableServer ¶
type RunnableServer interface {
Run(ctx context.Context) error
Middleware() ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
SetMiddleware(unaryInterceptors []grpc.UnaryServerInterceptor, streamingInterceptors []grpc.StreamServerInterceptor) RunnableServer
GRPCDialContext(ctx context.Context, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DispatchNetDialContext(ctx context.Context, s string) (net.Conn, error)
}
RunnableServer is a spicedb service set ready to run