Documentation
¶
Overview ¶
Package reverseexpand contains the code that handles the ReverseExpand API
Index ¶
- Variables
- type ConditionalResultStatus
- type IsUserRef
- type ResolutionMetadata
- type ReverseExpandQuery
- type ReverseExpandQueryOption
- func WithCheckResolver(resolver graph.CheckResolver) ReverseExpandQueryOption
- func WithDispatchThrottlerConfig(config threshold.Config) ReverseExpandQueryOption
- func WithListObjectOptimizationsEnabled(enabled bool) ReverseExpandQueryOption
- func WithLogger(logger logger.Logger) ReverseExpandQueryOption
- func WithResolveNodeBreadthLimit(limit uint32) ReverseExpandQueryOption
- func WithResolveNodeLimit(limit uint32) ReverseExpandQueryOption
- type ReverseExpandRequest
- type ReverseExpandResult
- type UserRef
- type UserRefObject
- type UserRefObjectRelation
- type UserRefTypedWildcard
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyStack = errors.New("unexpected empty stack")
Functions ¶
This section is empty.
Types ¶
type ConditionalResultStatus ¶
type ConditionalResultStatus int
const ( RequiresFurtherEvalStatus ConditionalResultStatus = iota NoFurtherEvalStatus )
type ResolutionMetadata ¶
type ResolutionMetadata struct {
// The number of times we are expanding from each node to find set of objects
DispatchCounter *atomic.Uint32
// WasThrottled indicates whether the request was throttled
WasThrottled *atomic.Bool
// WasWeightedGraphUsed indicates whether the weighted graph was used as the algorithm for the ReverseExpand request.
WasWeightedGraphUsed *atomic.Bool
// Temporary solution to indicate whether shadow list objects query should be run.
// For queries with Infinite weight, the weighted graph implementation falls back
// to the original code, making any comparison useless.
ShouldRunShadowQuery *atomic.Bool
}
func NewResolutionMetadata ¶
func NewResolutionMetadata() *ResolutionMetadata
type ReverseExpandQuery ¶
type ReverseExpandQuery struct {
// contains filtered or unexported fields
}
func NewReverseExpandQuery ¶
func NewReverseExpandQuery(ds storage.RelationshipTupleReader, ts *typesystem.TypeSystem, opts ...ReverseExpandQueryOption) *ReverseExpandQuery
TODO accept ReverseExpandRequest so we can build the datastore object right away.
func (*ReverseExpandQuery) Execute ¶
func (c *ReverseExpandQuery) Execute( ctx context.Context, req *ReverseExpandRequest, resultChan chan<- *ReverseExpandResult, resolutionMetadata *ResolutionMetadata, ) error
Execute yields all the objects of the provided objectType that the given user possibly has, a specific relation with and sends those objects to resultChan. It MUST guarantee no duplicate objects sent.
This function respects context timeouts and cancellations. If an error is encountered (e.g. context timeout) before resolving all objects, then the provided channel will NOT be closed, and it will return the error.
If no errors occur, then Execute will yield all of the objects on the provided channel and then close the channel to signal that it is done.
type ReverseExpandQueryOption ¶
type ReverseExpandQueryOption func(d *ReverseExpandQuery)
func WithCheckResolver ¶ added in v1.9.0
func WithCheckResolver(resolver graph.CheckResolver) ReverseExpandQueryOption
func WithDispatchThrottlerConfig ¶ added in v1.5.4
func WithDispatchThrottlerConfig(config threshold.Config) ReverseExpandQueryOption
func WithListObjectOptimizationsEnabled ¶ added in v1.9.0
func WithListObjectOptimizationsEnabled(enabled bool) ReverseExpandQueryOption
func WithLogger ¶ added in v1.4.3
func WithLogger(logger logger.Logger) ReverseExpandQueryOption
func WithResolveNodeBreadthLimit ¶
func WithResolveNodeBreadthLimit(limit uint32) ReverseExpandQueryOption
func WithResolveNodeLimit ¶
func WithResolveNodeLimit(limit uint32) ReverseExpandQueryOption
type ReverseExpandRequest ¶
type ReverseExpandResult ¶
type ReverseExpandResult struct {
Object string
ResultStatus ConditionalResultStatus
}
type UserRef ¶
type UserRef struct {
// Types that are assignable to Ref
// *UserRef_Object
// *UserRef_TypedWildcard
// *UserRef_ObjectRelation
Ref IsUserRef
}
type UserRefObject ¶
func (*UserRefObject) GetObjectType ¶
func (u *UserRefObject) GetObjectType() string
func (*UserRefObject) String ¶
func (u *UserRefObject) String() string
type UserRefObjectRelation ¶
type UserRefObjectRelation struct {
ObjectRelation *openfgav1.ObjectRelation
Condition *openfgav1.RelationshipCondition
}
func (*UserRefObjectRelation) GetObjectType ¶
func (u *UserRefObjectRelation) GetObjectType() string
func (*UserRefObjectRelation) String ¶
func (u *UserRefObjectRelation) String() string
type UserRefTypedWildcard ¶
type UserRefTypedWildcard struct {
Type string
}
func (*UserRefTypedWildcard) GetObjectType ¶
func (u *UserRefTypedWildcard) GetObjectType() string
func (*UserRefTypedWildcard) String ¶
func (u *UserRefTypedWildcard) String() string