shared

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 28 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

func NewMaxDepthExceededError(allowedMaximumDepth uint32, isCheckRequest bool) error

NewMaxDepthExceededError creates a new MaxDepthExceededError.

func RewriteError

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

func RewriteErrorWithoutConfig

func RewriteErrorWithoutConfig(ctx context.Context, err error) error

Types

type AppliedSchemaChanges

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

ApplySchemaChanges applies schema changes found in the validated changes struct, via the specified ReadWriteTransaction.

func ApplySchemaChangesOverExisting

func ApplySchemaChangesOverExisting(
	ctx context.Context,
	rwt datastore.ReadWriteTransaction,
	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

type ConfigForErrors struct {
	MaximumAPIDepth uint32
	DebugTrace      *v1.DebugInformation
}

type ErrSchemaWriteDataValidation

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

ErrSchemaWriteDataValidation occurs when a schema cannot be applied due to leaving data unreferenced.

func AsValidationError

func AsValidationError(err error) *ErrSchemaWriteDataValidation

func NewSchemaWriteDataValidationError

func NewSchemaWriteDataValidationError(message string, args ...any) ErrSchemaWriteDataValidation

NewSchemaWriteDataValidationError creates a new error representing that a schema write cannot be completed due to existing data that would be left unreferenced.

func (ErrSchemaWriteDataValidation) GRPCStatus

func (err ErrSchemaWriteDataValidation) GRPCStatus() *status.Status

GRPCStatus implements retrieving the gRPC status for the error.

func (ErrSchemaWriteDataValidation) MarshalZerologObject

func (err ErrSchemaWriteDataValidation) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog object marshalling.

type MaxDepthExceededError

type MaxDepthExceededError struct {
	*spiceerrors.ErrorWithAdditionalDetails

	// 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

func (err MaxDepthExceededError) GRPCStatus() *status.Status

GRPCStatus implements retrieving the gRPC status for the error.

type ValidatedSchemaChanges

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

func ValidateSchemaChanges(ctx context.Context, compiled *compiler.CompiledSchema, 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