Documentation
¶
Index ¶
- Constants
- Variables
- func AlwaysFail(ctx context.Context, resultChan chan<- CheckResult)
- func AlwaysFailExpand(ctx context.Context, resultChan chan<- ExpandResult)
- func NewAlwaysFailErr() error
- func NewCheckFailureErr(baseErr error) error
- func NewExpansionFailureErr(baseErr error) error
- func NewNamespaceNotFoundErr(nsName string) error
- func NewRelationNotFoundErr(nsName string, relationName string) error
- func NewRequestCanceledErr() error
- type CheckRequest
- type CheckResult
- type DebugTracer
- type DebugTracerEmitter
- type Dispatcher
- func NewCachingDispatcher(delegate Dispatcher, cacheConfig *ristretto.Config, ...) (Dispatcher, error)
- func NewClusterDispatcher(client clusterClient, depthRemainingHeader, forcedRevisionHeader string) Dispatcher
- func NewLocalDispatcher(nsm namespace.Manager, ds datastore.GraphDatastore) (Dispatcher, error)
- func NewLocalDispatcherWithRedispatch(nsm namespace.Manager, ds datastore.GraphDatastore, redispatcher Dispatcher) (Dispatcher, error)
- type EmittableObjectSet
- type EmittableObjectSlice
- type ErrAlwaysFail
- type ErrCheckFailure
- type ErrExpansionFailure
- type ErrNamespaceNotFound
- type ErrRelationNotFound
- type ErrRequestCanceled
- type ExpandReducer
- type ExpandRequest
- type ExpandResult
- func ExpandAll(ctx context.Context, start *v0.ObjectAndRelation, ...) ExpandResult
- func ExpandAny(ctx context.Context, start *v0.ObjectAndRelation, ...) ExpandResult
- func ExpandDifference(ctx context.Context, start *v0.ObjectAndRelation, ...) ExpandResult
- func ExpandOne(ctx context.Context, request ReduceableExpandFunc) ExpandResult
- type ExpansionMode
- type LookupReducer
- type LookupRequest
- type LookupResult
- func LookupAll(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
- func LookupAny(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
- func LookupExclude(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
- func LookupOne(ctx context.Context, request ReduceableLookupFunc) LookupResult
- type ReduceableCheckFunc
- type ReduceableExpandFunc
- type ReduceableLookupFunc
- type Reducer
Constants ¶
const Ellipsis = "..."
Ellipsis relation is used to signify a semantic-free relationship.
Variables ¶
var ( RegisterPromMetrics registerPromMetricsIntention = true DisablePromMetrics registerPromMetricsIntention = false )
Functions ¶
func AlwaysFail ¶
func AlwaysFail(ctx context.Context, resultChan chan<- CheckResult)
AlwaysFail is a ReduceableCheckFunc which will always fail when reduced.
func AlwaysFailExpand ¶
func AlwaysFailExpand(ctx context.Context, resultChan chan<- ExpandResult)
AlwaysFailExpand is a ReduceableExpandFunc which will always fail when reduced.
func NewAlwaysFailErr ¶
func NewAlwaysFailErr() error
NewAlwaysFailErr constructs a new always fail error.
func NewCheckFailureErr ¶
NewCheckFailureErr constructs a new check failed error.
func NewExpansionFailureErr ¶
NewExpansionFailureErr constructs a new expansion failed error.
func NewNamespaceNotFoundErr ¶
NewNamespaceNotFoundErr constructs a new namespace not found error.
func NewRelationNotFoundErr ¶
NewRelationNotFoundErr constructs a new relation not found error.
func NewRequestCanceledErr ¶
func NewRequestCanceledErr() error
NewRequestCanceledErr constructs a new request was canceled error.
Types ¶
type CheckRequest ¶
type CheckRequest struct {
Start *v0.ObjectAndRelation
Goal *v0.ObjectAndRelation
AtRevision decimal.Decimal
DepthRemaining uint16
}
CheckRequest contains the data for a single check request.
func (CheckRequest) MarshalZerologObject ¶
func (cr CheckRequest) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type CheckResult ¶
CheckResult is the data that is returned by a single check or sub-check.
func All ¶
func All(ctx context.Context, requests []ReduceableCheckFunc) CheckResult
All returns whether all of the lazy checks pass, and is used for intersection.
func Any ¶
func Any(ctx context.Context, requests []ReduceableCheckFunc) CheckResult
Any returns whether any one of the lazy checks pass, and is used for union.
func Difference ¶
func Difference(ctx context.Context, requests []ReduceableCheckFunc) CheckResult
Difference returns whether the first lazy check passes and none of the supsequent checks pass.
func (CheckResult) MarshalZerologObject ¶
func (cr CheckResult) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type DebugTracer ¶
type DebugTracer interface {
Child(name string) DebugTracer
Childf(format string, a ...interface{}) DebugTracer
ChildONR(onr *v0.ObjectAndRelation) DebugTracer
Add(name string, value DebugTracerEmitter)
String() string
}
func NewNullTracer ¶
func NewNullTracer() DebugTracer
func NewPrinterTracer ¶
func NewPrinterTracer() DebugTracer
type DebugTracerEmitter ¶
type DebugTracerEmitter interface {
EmitForTrace(tracer DebugTracer)
}
type Dispatcher ¶
type Dispatcher interface {
// Check submits a single check request and returns its result.
Check(ctx context.Context, req CheckRequest) CheckResult
// Expand submits a single expand request and returns its result.
Expand(ctx context.Context, req ExpandRequest) ExpandResult
// Lookup submits a single lookup request and returns its result.
Lookup(ctx context.Context, req LookupRequest) LookupResult
}
Dispatcher interface describes a method for passing subchecks off to additional machines.
func NewCachingDispatcher ¶
func NewCachingDispatcher( delegate Dispatcher, cacheConfig *ristretto.Config, registerPromMetrics registerPromMetricsIntention, ) (Dispatcher, error)
func NewClusterDispatcher ¶
func NewClusterDispatcher(client clusterClient, depthRemainingHeader, forcedRevisionHeader string) Dispatcher
NewClusterDispatcher creates a dispatcher implementation that uses the provided client to dispatch requests to peer nodes in the cluster.
func NewLocalDispatcher ¶
func NewLocalDispatcher( nsm namespace.Manager, ds datastore.GraphDatastore, ) (Dispatcher, error)
NewLocalDispatcher creates a dispatcher that checks everything in the same process on the same machine.
func NewLocalDispatcherWithRedispatch ¶
func NewLocalDispatcherWithRedispatch( nsm namespace.Manager, ds datastore.GraphDatastore, redispatcher Dispatcher, ) (Dispatcher, error)
NewLocalDispatcherWithRedispatch creates a dispatcher that uses a different dispatcher for further request dispatching.
type EmittableObjectSet ¶
func (EmittableObjectSet) EmitForTrace ¶
func (s EmittableObjectSet) EmitForTrace(tracer DebugTracer)
type EmittableObjectSlice ¶
type EmittableObjectSlice []*v0.ObjectAndRelation
func (EmittableObjectSlice) EmitForTrace ¶
func (s EmittableObjectSlice) EmitForTrace(tracer DebugTracer)
type ErrAlwaysFail ¶
type ErrAlwaysFail struct {
// contains filtered or unexported fields
}
ErrAlwaysFail is returned when an internal error leads to an operation guaranteed to fail.
type ErrCheckFailure ¶
type ErrCheckFailure struct {
// contains filtered or unexported fields
}
ErrCheckFailure occurs when check failed in some manner. Note this should not apply to namespaces and relations not being found.
type ErrExpansionFailure ¶
type ErrExpansionFailure struct {
// contains filtered or unexported fields
}
ErrExpansionFailure occurs when expansion failed in some manner. Note this should not apply to namespaces and relations not being found.
type ErrNamespaceNotFound ¶
type ErrNamespaceNotFound struct {
// contains filtered or unexported fields
}
ErrNamespaceNotFound occurs when a namespace was not found.
func (ErrNamespaceNotFound) MarshalZerologObject ¶
func (enf ErrNamespaceNotFound) MarshalZerologObject(e *zerolog.Event)
func (ErrNamespaceNotFound) NotFoundNamespaceName ¶
func (enf ErrNamespaceNotFound) NotFoundNamespaceName() string
NotFoundNamespaceName returns the name of the namespace that was not found.
type ErrRelationNotFound ¶
type ErrRelationNotFound struct {
// contains filtered or unexported fields
}
ErrRelationNotFound occurs when a relation was not found under a namespace.
func (ErrRelationNotFound) MarshalZerologObject ¶
func (erf ErrRelationNotFound) MarshalZerologObject(e *zerolog.Event)
func (ErrRelationNotFound) NamespaceName ¶
func (erf ErrRelationNotFound) NamespaceName() string
NamespaceName returns the name of the namespace in which the relation was not found.
func (ErrRelationNotFound) NotFoundRelationName ¶
func (erf ErrRelationNotFound) NotFoundRelationName() string
NotFoundRelationName returns the name of the relation not found.
type ErrRequestCanceled ¶
type ErrRequestCanceled struct {
// contains filtered or unexported fields
}
ErrRequestCanceled occurs when a request has been canceled.
type ExpandReducer ¶
type ExpandReducer func( ctx context.Context, start *v0.ObjectAndRelation, requests []ReduceableExpandFunc, ) ExpandResult
ExpandReducer is a type for the functions Any and All which combine check results.
type ExpandRequest ¶
type ExpandRequest struct {
Start *v0.ObjectAndRelation
AtRevision decimal.Decimal
DepthRemaining uint16
ExpansionMode ExpansionMode
}
ExpandRequest contains the data for a single expand request.
func (ExpandRequest) MarshalZerologObject ¶
func (er ExpandRequest) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type ExpandResult ¶
type ExpandResult struct {
Tree *v0.RelationTupleTreeNode
Err error
}
ExpandResult is the data that is returned by a single expand or sub-expand.
func ExpandAll ¶
func ExpandAll(ctx context.Context, start *v0.ObjectAndRelation, requests []ReduceableExpandFunc) ExpandResult
ExpandAll returns a tree with all of the children and an intersection node type.
func ExpandAny ¶
func ExpandAny(ctx context.Context, start *v0.ObjectAndRelation, requests []ReduceableExpandFunc) ExpandResult
ExpandAny returns a tree with all of the children and a union node type.
func ExpandDifference ¶
func ExpandDifference(ctx context.Context, start *v0.ObjectAndRelation, requests []ReduceableExpandFunc) ExpandResult
ExpandDifference returns a tree with all of the children and an exclusion node type.
func ExpandOne ¶
func ExpandOne(ctx context.Context, request ReduceableExpandFunc) ExpandResult
ExpandOne waits for exactly one response
type ExpansionMode ¶
type ExpansionMode int
const ( ShallowExpansion ExpansionMode = 0 RecursiveExpansion ExpansionMode = 1 )
type LookupReducer ¶
type LookupReducer func(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
LookupReducer is a type for the functions which combine lookup results.
type LookupRequest ¶
type LookupRequest struct {
// StartRelation is the relation at which to start the lookup.
StartRelation *v0.RelationReference
// TargetONR is the target ONR that we are trying to reach.
TargetONR *v0.ObjectAndRelation
Limit int
AtRevision decimal.Decimal
DepthRemaining uint16
DirectStack *tuple.ONRSet
TTUStack *tuple.ONRSet
DebugTracer DebugTracer
}
LookupRequest contains the data for a single lookup request.
func (LookupRequest) MarshalZerologObject ¶
func (lr LookupRequest) MarshalZerologObject(e *zerolog.Event)
MarshalZerologObject implements zerolog object marshalling.
type LookupResult ¶
type LookupResult struct {
ResolvedObjects []*v0.ObjectAndRelation
Err error
}
LookupResult is the data that is returned by a single lookup or sub-lookup.
func LookupAll ¶
func LookupAll(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
func LookupAny ¶
func LookupAny(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
func LookupExclude ¶
func LookupExclude(ctx context.Context, limit int, requests []ReduceableLookupFunc) LookupResult
func LookupOne ¶
func LookupOne(ctx context.Context, request ReduceableLookupFunc) LookupResult
type ReduceableCheckFunc ¶
type ReduceableCheckFunc func(ctx context.Context, resultChan chan<- CheckResult)
ReduceableCheckFunc is a function that can be bound to a execution context.
func AlwaysMember ¶
func AlwaysMember() ReduceableCheckFunc
AlwaysMember returns that the check always passes.
func NotMember ¶
func NotMember() ReduceableCheckFunc
NotMember returns that the check always returns false.
type ReduceableExpandFunc ¶
type ReduceableExpandFunc func(ctx context.Context, resultChan chan<- ExpandResult)
ReduceableExpandFunc is a function that can be bound to a execution context.
func EmptyExpansion ¶
func EmptyExpansion(start *v0.ObjectAndRelation) ReduceableExpandFunc
EmptyExpansion returns an empty expansion.
type ReduceableLookupFunc ¶
type ReduceableLookupFunc func(ctx context.Context, resultChan chan<- LookupResult)
ReduceableLookupFunc is a function that can be bound to a execution context.
func ResolveError ¶
func ResolveError(err error) ReduceableLookupFunc
func Resolved ¶
func Resolved(resolved *v0.ObjectAndRelation) ReduceableLookupFunc
func ResolvedObjects ¶
func ResolvedObjects(resolved []*v0.ObjectAndRelation) ReduceableLookupFunc
type Reducer ¶
type Reducer func(ctx context.Context, requests []ReduceableCheckFunc) CheckResult
Reducer is a type for the functions Any and All which combine check results.