shared

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewMaxDepthExceededError(allowedMaximumDepth uint32, isCheckRequest bool) error

NewMaxDepthExceededError creates a new MaxDepthExceededError.

func RewriteError added in v1.22.0

func RewriteError(ctx context.Context, err error, config *ConfigForErrors) error

func RewriteErrorWithoutConfig added in v1.33.0

func RewriteErrorWithoutConfig(ctx context.Context, err error) 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.

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) (*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

StreamInterceptor implements servicespecific.ExtraStreamInterceptor

func (WithServiceSpecificInterceptors) UnaryInterceptor

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

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

UnaryInterceptor implements servicespecific.ExtraUnaryInterceptor

Jump to

Keyboard shortcuts

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