server

package
v1.22.0-rc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 69 Imported by: 3

Documentation

Overview

Code generated by github.com/ecordell/optgen. DO NOT EDIT.

Code generated by github.com/ecordell/optgen. DO NOT EDIT.

Index

Constants

View Source
const (
	DefaultMiddlewareRequestID     = "requestid"
	DefaultMiddlewareLog           = "log"
	DefaultMiddlewareGRPCLog       = "grpclog"
	DefaultMiddlewareOTelGRPC      = "otelgrpc"
	DefaultMiddlewareGRPCAuth      = "grpcauth"
	DefaultMiddlewareGRPCProm      = "grpcprom"
	DefaultMiddlewareServerVersion = "serverversion"

	DefaultInternalMiddlewareDispatch       = "dispatch"
	DefaultInternalMiddlewareDatastore      = "datastore"
	DefaultInternalMiddlewareConsistency    = "consistency"
	DefaultInternalMiddlewareServerSpecific = "servicespecific"
)

Variables

View Source
var ConsistentHashringBuilder = balancer.NewConsistentHashringBuilder(
	xxhash.Sum64,
)

ConsistentHashringBuilder is a balancer Builder that uses xxhash as the underlying hash for the ConsistentHashringBalancers it creates.

View Source
var DisableTelemetryHandler *prometheus.Registry

Functions

func DefaultDispatchMiddleware

func DefaultDispatchMiddleware(logger zerolog.Logger, authFunc grpcauth.AuthFunc, ds datastore.Datastore) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)

DefaultDispatchMiddleware generates the default middleware chain used for the internal dispatch SpiceDB gRPC API

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, c *Config) http.Handler

MetricsHandler sets up an HTTP server that handles serving Prometheus metrics and pprof endpoints.

func RegisterCacheFlags added in v1.13.0

func RegisterCacheFlags(flags *pflag.FlagSet, flagPrefix string, config, defaults *CacheConfig)

RegisterCacheFlags registers flags used to configure SpiceDB's various caches.

func ServeExample

func ServeExample(programName string) string

ServeExample creates an example usage string with the provided program name.

Types

type CacheConfig

type CacheConfig struct {
	Name        string `debugmap:"visible"`
	MaxCost     string `debugmap:"visible"`
	NumCounters int64  `debugmap:"visible"`
	Metrics     bool   `debugmap:"visible"`
	Enabled     bool   `debugmap:"visible"`
	// contains filtered or unexported fields
}

CacheConfig defines the configuration various SpiceDB caches.

func CacheConfigWithOptions added in v1.22.0

func CacheConfigWithOptions(c *CacheConfig, opts ...CacheConfigOption) *CacheConfig

CacheConfigWithOptions configures an existing CacheConfig with the passed in options set

func NewCacheConfigWithOptions added in v1.22.0

func NewCacheConfigWithOptions(opts ...CacheConfigOption) *CacheConfig

NewCacheConfigWithOptions creates a new CacheConfig with the passed in options set

func NewCacheConfigWithOptionsAndDefaults added in v1.22.0

func NewCacheConfigWithOptionsAndDefaults(opts ...CacheConfigOption) *CacheConfig

NewCacheConfigWithOptionsAndDefaults creates a new CacheConfig with the passed in options set starting from the defaults

func (*CacheConfig) Complete

func (cc *CacheConfig) Complete() (cache.Cache, error)

Complete translates the CLI cache config into a cache config.

func (CacheConfig) DebugMap added in v1.22.0

func (c CacheConfig) DebugMap() map[string]any

DebugMap returns a map form of CacheConfig for debugging

func (*CacheConfig) ToOption added in v1.22.0

func (c *CacheConfig) ToOption() CacheConfigOption

ToOption returns a new CacheConfigOption that sets the values from the passed in CacheConfig

func (*CacheConfig) WithOptions added in v1.22.0

func (c *CacheConfig) WithOptions(opts ...CacheConfigOption) *CacheConfig

WithOptions configures the receiver CacheConfig with the passed in options set

func (*CacheConfig) WithRevisionParameters added in v1.21.0

func (cc *CacheConfig) WithRevisionParameters(
	quantizationInterval time.Duration,
	followerReadDelay time.Duration,
	maxStalenessPercent float64,
) *CacheConfig

WithRevisionParameters configures a cache such that all entries are given a TTL that will expire safely outside of the quantization window.

type CacheConfigOption added in v1.22.0

type CacheConfigOption func(c *CacheConfig)

func WithEnabled added in v1.22.0

func WithEnabled(enabled bool) CacheConfigOption

WithEnabled returns an option that can set Enabled on a CacheConfig

func WithMaxCost added in v1.22.0

func WithMaxCost(maxCost string) CacheConfigOption

WithMaxCost returns an option that can set MaxCost on a CacheConfig

func WithMetrics added in v1.22.0

func WithMetrics(metrics bool) CacheConfigOption

WithMetrics returns an option that can set Metrics on a CacheConfig

func WithName added in v1.22.0

func WithName(name string) CacheConfigOption

WithName returns an option that can set Name on a CacheConfig

func WithNumCounters added in v1.22.0

func WithNumCounters(numCounters int64) CacheConfigOption

WithNumCounters returns an option that can set NumCounters on a CacheConfig

type Config

type Config struct {
	// API config
	GRPCServer             util.GRPCServerConfig `debugmap:"visible"`
	GRPCAuthFunc           grpc_auth.AuthFunc    `debugmap:"visible"`
	PresharedSecureKey     []string              `debugmap:"sensitive"`
	ShutdownGracePeriod    time.Duration         `debugmap:"visible"`
	DisableVersionResponse bool                  `debugmap:"visible"`

	// GRPC Gateway config
	HTTPGateway                    util.HTTPServerConfig `debugmap:"visible"`
	HTTPGatewayUpstreamAddr        string                `debugmap:"visible"`
	HTTPGatewayUpstreamTLSCertPath string                `debugmap:"visible"`
	HTTPGatewayCorsEnabled         bool                  `debugmap:"visible"`
	HTTPGatewayCorsAllowedOrigins  []string              `debugmap:"visible-format"`

	// Datastore
	DatastoreConfig datastorecfg.Config `debugmap:"visible"`
	Datastore       datastore.Datastore `debugmap:"visible"`

	// Datastore usage
	MaxCaveatContextSize       int `debugmap:"visible" default:"4096"`
	MaxRelationshipContextSize int `debugmap:"visible" default:"25_000"`

	// Namespace cache
	NamespaceCacheConfig CacheConfig `debugmap:"visible"`

	// Schema options
	SchemaPrefixesRequired bool `debugmap:"visible"`

	// Dispatch options
	DispatchServer                    util.GRPCServerConfig   `debugmap:"visible"`
	DispatchMaxDepth                  uint32                  `debugmap:"visible"`
	GlobalDispatchConcurrencyLimit    uint16                  `debugmap:"visible"`
	DispatchConcurrencyLimits         graph.ConcurrencyLimits `debugmap:"visible"`
	DispatchUpstreamAddr              string                  `debugmap:"visible"`
	DispatchUpstreamCAPath            string                  `debugmap:"visible"`
	DispatchUpstreamTimeout           time.Duration           `debugmap:"visible"`
	DispatchClientMetricsEnabled      bool                    `debugmap:"visible"`
	DispatchClientMetricsPrefix       string                  `debugmap:"visible"`
	DispatchClusterMetricsEnabled     bool                    `debugmap:"visible"`
	DispatchClusterMetricsPrefix      string                  `debugmap:"visible"`
	Dispatcher                        dispatch.Dispatcher     `debugmap:"visible"`
	DispatchHashringReplicationFactor uint16                  `debugmap:"visible"`
	DispatchHashringSpread            uint8                   `debugmap:"visible"`

	DispatchCacheConfig        CacheConfig `debugmap:"visible"`
	ClusterDispatchCacheConfig CacheConfig `debugmap:"visible"`

	// API Behavior
	DisableV1SchemaAPI       bool          `debugmap:"visible"`
	V1SchemaAdditiveOnly     bool          `debugmap:"visible"`
	MaximumUpdatesPerWrite   uint16        `debugmap:"visible"`
	MaximumPreconditionCount uint16        `debugmap:"visible"`
	MaxDatastoreReadPageSize uint64        `debugmap:"visible"`
	StreamingAPITimeout      time.Duration `debugmap:"visible"`

	// Additional Services
	DashboardAPI util.HTTPServerConfig `debugmap:"visible"`
	MetricsAPI   util.HTTPServerConfig `debugmap:"visible"`

	// Middleware for grpc API
	MiddlewareModification []MiddlewareModification `debugmap:"hidden"`

	// Middleware for internal dispatch API
	DispatchUnaryMiddleware     []grpc.UnaryServerInterceptor  `debugmap:"hidden"`
	DispatchStreamingMiddleware []grpc.StreamServerInterceptor `debugmap:"hidden"`

	// Telemetry
	SilentlyDisableTelemetry bool          `debugmap:"visible"`
	TelemetryCAOverridePath  string        `debugmap:"visible"`
	TelemetryEndpoint        string        `debugmap:"visible"`
	TelemetryInterval        time.Duration `debugmap:"visible"`
}

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 NewConfigWithOptionsAndDefaults added in v1.22.0

func NewConfigWithOptionsAndDefaults(opts ...ConfigOption) *Config

NewConfigWithOptionsAndDefaults creates a new Config with the passed in options set starting from the defaults

func (*Config) Complete

func (c *Config) Complete(ctx context.Context) (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) DebugMap added in v1.22.0

func (c Config) DebugMap() map[string]any

DebugMap returns a map form of Config for debugging

func (*Config) ToOption

func (c *Config) ToOption() ConfigOption

ToOption returns a new ConfigOption that sets the values from the passed in Config

func (*Config) WithOptions added in v1.22.0

func (c *Config) WithOptions(opts ...ConfigOption) *Config

WithOptions configures the receiver Config with the passed in options set

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 SetMiddlewareModification added in v1.16.0

func SetMiddlewareModification(middlewareModification []MiddlewareModification) ConfigOption

SetMiddlewareModification returns an option that can set MiddlewareModification on a Config

func SetPresharedSecureKey added in v1.22.0

func SetPresharedSecureKey(presharedSecureKey []string) ConfigOption

SetPresharedSecureKey returns an option that can set PresharedSecureKey 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 WithDispatchClientMetricsEnabled added in v1.17.0

func WithDispatchClientMetricsEnabled(dispatchClientMetricsEnabled bool) ConfigOption

WithDispatchClientMetricsEnabled returns an option that can set DispatchClientMetricsEnabled on a Config

func WithDispatchClientMetricsPrefix

func WithDispatchClientMetricsPrefix(dispatchClientMetricsPrefix string) ConfigOption

WithDispatchClientMetricsPrefix returns an option that can set DispatchClientMetricsPrefix on a Config

func WithDispatchClusterMetricsEnabled added in v1.17.0

func WithDispatchClusterMetricsEnabled(dispatchClusterMetricsEnabled bool) ConfigOption

WithDispatchClusterMetricsEnabled returns an option that can set DispatchClusterMetricsEnabled 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 WithDispatchConcurrencyLimits added in v1.16.0

func WithDispatchConcurrencyLimits(dispatchConcurrencyLimits graph.ConcurrencyLimits) ConfigOption

WithDispatchConcurrencyLimits returns an option that can set DispatchConcurrencyLimits on a Config

func WithDispatchHashringReplicationFactor added in v1.18.1

func WithDispatchHashringReplicationFactor(dispatchHashringReplicationFactor uint16) ConfigOption

WithDispatchHashringReplicationFactor returns an option that can set DispatchHashringReplicationFactor on a Config

func WithDispatchHashringSpread added in v1.20.0

func WithDispatchHashringSpread(dispatchHashringSpread uint8) ConfigOption

WithDispatchHashringSpread returns an option that can set DispatchHashringSpread 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 WithDispatchUpstreamTimeout added in v1.16.2

func WithDispatchUpstreamTimeout(dispatchUpstreamTimeout time.Duration) ConfigOption

WithDispatchUpstreamTimeout returns an option that can set DispatchUpstreamTimeout 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 WithGlobalDispatchConcurrencyLimit added in v1.16.0

func WithGlobalDispatchConcurrencyLimit(globalDispatchConcurrencyLimit uint16) ConfigOption

WithGlobalDispatchConcurrencyLimit returns an option that can set GlobalDispatchConcurrencyLimit 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 WithMaxCaveatContextSize added in v1.18.0

func WithMaxCaveatContextSize(maxCaveatContextSize int) ConfigOption

WithMaxCaveatContextSize returns an option that can set MaxCaveatContextSize on a Config

func WithMaxDatastoreReadPageSize added in v1.21.0

func WithMaxDatastoreReadPageSize(maxDatastoreReadPageSize uint64) ConfigOption

WithMaxDatastoreReadPageSize returns an option that can set MaxDatastoreReadPageSize on a Config

func WithMaxRelationshipContextSize added in v1.22.0

func WithMaxRelationshipContextSize(maxRelationshipContextSize int) ConfigOption

WithMaxRelationshipContextSize returns an option that can set MaxRelationshipContextSize on a Config

func WithMaximumPreconditionCount added in v1.12.0

func WithMaximumPreconditionCount(maximumPreconditionCount uint16) ConfigOption

WithMaximumPreconditionCount returns an option that can set MaximumPreconditionCount on a Config

func WithMaximumUpdatesPerWrite added in v1.12.0

func WithMaximumUpdatesPerWrite(maximumUpdatesPerWrite uint16) ConfigOption

WithMaximumUpdatesPerWrite returns an option that can set MaximumUpdatesPerWrite on a Config

func WithMetricsAPI

func WithMetricsAPI(metricsAPI util.HTTPServerConfig) ConfigOption

WithMetricsAPI returns an option that can set MetricsAPI on a Config

func WithMiddlewareModification added in v1.16.0

func WithMiddlewareModification(middlewareModification MiddlewareModification) ConfigOption

WithMiddlewareModification returns an option that can append MiddlewareModifications to Config.MiddlewareModification

func WithNamespaceCacheConfig

func WithNamespaceCacheConfig(namespaceCacheConfig CacheConfig) ConfigOption

WithNamespaceCacheConfig returns an option that can set NamespaceCacheConfig on a Config

func WithPresharedSecureKey added in v1.22.0

func WithPresharedSecureKey(presharedSecureKey string) ConfigOption

WithPresharedSecureKey returns an option that can append PresharedSecureKeys to Config.PresharedSecureKey

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 WithStreamingAPITimeout added in v1.21.0

func WithStreamingAPITimeout(streamingAPITimeout time.Duration) ConfigOption

WithStreamingAPITimeout returns an option that can set StreamingAPITimeout on a Config

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 WithV1SchemaAdditiveOnly added in v1.15.0

func WithV1SchemaAdditiveOnly(v1SchemaAdditiveOnly bool) ConfigOption

WithV1SchemaAdditiveOnly returns an option that can set V1SchemaAdditiveOnly on a Config

type MiddlewareChain added in v1.16.0

type MiddlewareChain struct {
	// contains filtered or unexported fields
}

MiddlewareChain describes an ordered sequence of middlewares that can be modified with one or more MiddlewareModification. This struct is used to facilitate the creation and modification of gRPC middleware chains

func DefaultMiddleware

func DefaultMiddleware(logger zerolog.Logger, authFunc grpcauth.AuthFunc, enableVersionResponse bool, dispatcher dispatch.Dispatcher, ds datastore.Datastore) (*MiddlewareChain, error)

DefaultMiddleware generates the default middleware chain used for the public SpiceDB gRPC API

func NewMiddlewareChain added in v1.16.0

func NewMiddlewareChain(mw ...ReferenceableMiddleware) (MiddlewareChain, error)

NewMiddlewareChain creates a new middleware chain given zero or more named middlewares. An error will be returned in case validation of the NamedMiddlewares fail.

func (*MiddlewareChain) Names added in v1.16.0

func (mc *MiddlewareChain) Names() *util.Set[string]

Names returns the names of the middlewares in a chain

func (*MiddlewareChain) ToGRPCInterceptors added in v1.16.0

ToGRPCInterceptors generates slices of gRPC interceptors ready to be installed in a server

type MiddlewareModification added in v1.16.0

type MiddlewareModification struct {
	// DependencyMiddlewareName is used to define with respect to which middleware an operation is performed.
	// Dependency is not required for ReplaceAll operation
	DependencyMiddlewareName string

	// Operation describes the type of operation to be performed
	Operation MiddlewareOperation

	// Middlewares are the named middlewares that will be part of this modification
	Middlewares []ReferenceableMiddleware
}

MiddlewareModification describes an operation to modify a MiddlewareChain

type MiddlewareOperation added in v1.16.0

type MiddlewareOperation int

MiddlewareOperation describes the type of operation that will be performed in a MiddlewareModification

const (
	// OperationPrepend adds the middlewares right before the referenced dependency
	OperationPrepend MiddlewareOperation = iota

	// OperationReplace substitutes the referenced dependency with the middlewares of a modification.
	// If replaced with an empty modification, this acts like a deletion
	OperationReplace

	// OperationAppend adds the middlewares right after the referenced dependency
	OperationAppend

	// OperationReplaceAllUnsafe replaces all middlewares in a chain with those in the modification
	// this operation is only meant to be used in tests.
	OperationReplaceAllUnsafe
)

type ReferenceableMiddleware added in v1.16.0

type ReferenceableMiddleware struct {
	Name                string
	Internal            bool
	UnaryMiddleware     grpc.UnaryServerInterceptor
	StreamingMiddleware grpc.StreamServerInterceptor
}

ReferenceableMiddleware represents a middleware in a MiddlewareChain. Middlewares can be referenced by name in MiddlewareModification, for example "append after middleware abc". Internal middlewares can also be referenced for operations like append or prepend, but cannot be referenced for replace operations. Middlewares must always be named.

type RunnableServer

type RunnableServer interface {
	Run(ctx context.Context) error
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL