Documentation
¶
Index ¶
- Variables
- func NewMaxDepthExceededError(allowedMaximumDepth uint32, isCheckRequest bool) error
- func RewriteError(ctx context.Context, err error, config *ConfigForErrors) error
- func RewriteErrorWithoutConfig(ctx context.Context, err error) error
- type AppliedSchemaChanges
- type ConfigForErrors
- type MaxDepthExceededError
- type SchemaWriteDataValidationError
- type ValidatedSchemaChanges
- type WithServiceSpecificInterceptors
- type WithStreamServiceSpecificInterceptor
- type WithUnaryServiceSpecificInterceptor
Constants ¶
This section is empty.
Variables ¶
var ErrServiceReadOnly = mustMakeStatusReadonly()
ErrServiceReadOnly is an extended GRPC error returned when a service is in read-only mode.
Functions ¶
func NewMaxDepthExceededError ¶ added in v1.23.0
NewMaxDepthExceededError creates a new MaxDepthExceededError.
func RewriteError ¶ added in v1.22.0
func RewriteError(ctx context.Context, err error, config *ConfigForErrors) error
Types ¶
type AppliedSchemaChanges ¶ added in v1.15.0
type AppliedSchemaChanges struct {
// TotalOperationCount holds the total number of "dispatch" operations performed by the schema
// being applied.
TotalOperationCount int
// NewObjectDefNames contains the names of the newly added object definitions.
NewObjectDefNames []string
// RemovedObjectDefNames contains the names of the removed object definitions.
RemovedObjectDefNames []string
// NewCaveatDefNames contains the names of the newly added caveat definitions.
NewCaveatDefNames []string
// RemovedCaveatDefNames contains the names of the removed caveat definitions.
RemovedCaveatDefNames []string
}
AppliedSchemaChanges holds information about the applied schema changes.
func ApplySchemaChanges ¶ added in v1.15.0
func ApplySchemaChanges(ctx context.Context, rwt datastore.ReadWriteTransaction, caveatTypeSet *caveattypes.TypeSet, validated *ValidatedSchemaChanges) (*AppliedSchemaChanges, error)
ApplySchemaChanges applies schema changes found in the validated changes struct, via the specified ReadWriteTransaction.
func ApplySchemaChangesOverExisting ¶ added in v1.15.0
func ApplySchemaChangesOverExisting( ctx context.Context, rwt datastore.ReadWriteTransaction, caveatTypeSet *caveattypes.TypeSet, validated *ValidatedSchemaChanges, existingCaveats []*core.CaveatDefinition, existingObjectDefs []*core.NamespaceDefinition, ) (*AppliedSchemaChanges, error)
ApplySchemaChangesOverExisting applies schema changes found in the validated changes struct, against existing caveat and object definitions given. The idea is that the given schema will be diffed against the existing objects given, and any objects not named in one of those two which are present in the datastore will be preserved.
type ConfigForErrors ¶ added in v1.23.0
type ConfigForErrors struct {
MaximumAPIDepth uint32
DebugTrace *v1.DebugInformation
}
type MaxDepthExceededError ¶ added in v1.23.0
type MaxDepthExceededError struct {
*spiceerrors.WithAdditionalDetailsError
// AllowedMaximumDepth is the configured allowed maximum depth.
AllowedMaximumDepth uint32
}
MaxDepthExceededError is an error returned when the maximum depth for dispatching has been exceeded.
func (MaxDepthExceededError) GRPCStatus ¶ added in v1.23.0
func (err MaxDepthExceededError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
type SchemaWriteDataValidationError ¶ added in v1.39.0
type SchemaWriteDataValidationError struct {
// contains filtered or unexported fields
}
SchemaWriteDataValidationError occurs when a schema cannot be applied due to leaving data unreferenced.
func AsValidationError ¶ added in v1.16.1
func AsValidationError(err error) *SchemaWriteDataValidationError
func NewSchemaWriteDataValidationError ¶ added in v1.16.1
func NewSchemaWriteDataValidationError(message string, args []any, metadata map[string]string) SchemaWriteDataValidationError
NewSchemaWriteDataValidationError creates a new error representing that a schema write cannot be completed due to existing data that would be left unreferenced.
func (SchemaWriteDataValidationError) GRPCStatus ¶ added in v1.39.0
func (err SchemaWriteDataValidationError) GRPCStatus() *status.Status
GRPCStatus implements retrieving the gRPC status for the error.
func (SchemaWriteDataValidationError) MarshalZerologObject ¶ added in v1.39.0
func (err SchemaWriteDataValidationError) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ValidatedSchemaChanges ¶ added in v1.15.0
type ValidatedSchemaChanges struct {
// contains filtered or unexported fields
}
ValidatedSchemaChanges is a set of validated schema changes that can be applied to the datastore.
func ValidateSchemaChanges ¶ added in v1.15.0
func ValidateSchemaChanges(ctx context.Context, compiled *compiler.CompiledSchema, caveatTypeSet *caveattypes.TypeSet, additiveOnly bool, schemaText string) (*ValidatedSchemaChanges, error)
ValidateSchemaChanges validates the schema found in the compiled schema and returns a ValidatedSchemaChanges, if fully validated.
type WithServiceSpecificInterceptors ¶
type WithServiceSpecificInterceptors struct {
Unary grpc.UnaryServerInterceptor
Stream grpc.StreamServerInterceptor
}
WithServiceSpecificInterceptors is a helper to add both a unary and stream interceptor or interceptor chain to a service.
func (WithServiceSpecificInterceptors) StreamInterceptor ¶
func (wssi WithServiceSpecificInterceptors) StreamInterceptor() grpc.StreamServerInterceptor
StreamInterceptor implements servicespecific.ExtraStreamInterceptor
func (WithServiceSpecificInterceptors) UnaryInterceptor ¶
func (wssi WithServiceSpecificInterceptors) UnaryInterceptor() grpc.UnaryServerInterceptor
UnaryInterceptor implements servicespecific.ExtraUnaryInterceptor
type WithStreamServiceSpecificInterceptor ¶
type WithStreamServiceSpecificInterceptor struct {
Stream grpc.StreamServerInterceptor
}
WithStreamServiceSpecificInterceptor is a helper to add a stream interceptor or interceptor chain to a service.
func (WithStreamServiceSpecificInterceptor) StreamInterceptor ¶
func (wsssi WithStreamServiceSpecificInterceptor) StreamInterceptor() grpc.StreamServerInterceptor
StreamInterceptor implements servicespecific.ExtraStreamInterceptor
type WithUnaryServiceSpecificInterceptor ¶
type WithUnaryServiceSpecificInterceptor struct {
Unary grpc.UnaryServerInterceptor
}
WithUnaryServiceSpecificInterceptor is a helper to add a unary interceptor or interceptor chain to a service.
func (WithUnaryServiceSpecificInterceptor) UnaryInterceptor ¶
func (wussi WithUnaryServiceSpecificInterceptor) UnaryInterceptor() grpc.UnaryServerInterceptor
UnaryInterceptor implements servicespecific.ExtraUnaryInterceptor