benchmarks

package
v1.52.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadSchema

func ReadSchema(ctx context.Context, ds datastore.Datastore, rev datastore.Revision) (*schema.Schema, error)

ReadSchema reads all namespace and caveat definitions from the datastore at the given revision and returns the compiled schema.

Types

type Benchmark

type Benchmark struct {
	Name  string
	Tags  []Tag
	Setup func(ctx context.Context, ds datastore.Datastore) (*QuerySets, error)
}

Benchmark is a named scenario that can write its schema and data to a datastore and return sets of valid queries with expected results.

func All

func All() []Benchmark

All returns a copy of every registered benchmark.

func Get

func Get(name string) (Benchmark, bool)

Get returns a single registered benchmark by name.

func WithTag

func WithTag(tag Tag) []Benchmark

WithTag returns all benchmarks that carry the given tag.

type CheckQuery

type CheckQuery struct {
	ResourceType    string
	ResourceID      string
	Permission      string
	SubjectType     string
	SubjectID       string
	SubjectRelation string
}

CheckQuery is a positive check query — the subject is expected to have the permission.

type IterResourcesQuery

type IterResourcesQuery struct {
	SubjectType         string
	SubjectID           string
	SubjectRelation     string
	Permission          string
	FilterResourceType  string
	ExpectedResourceIDs []string
}

IterResourcesQuery is an IterResources query with the full expected result set.

type IterSubjectsQuery

type IterSubjectsQuery struct {
	ResourceType       string
	ResourceID         string
	Permission         string
	FilterSubjectType  string
	ExpectedSubjectIDs []string
}

IterSubjectsQuery is an IterSubjects query with the full expected result set.

type QuerySets

type QuerySets struct {
	Checks        []CheckQuery
	IterResources []IterResourcesQuery
	IterSubjects  []IterSubjectsQuery

	// MaxRecursionDepth, if > 0, should be passed to the query context.
	// Zero means use the default.
	MaxRecursionDepth int
}

QuerySets holds the sets of valid queries returned by a benchmark's Setup.

type ServiceTester

type ServiceTester = consistencytestutil.ServiceTester

func BuildTestCluster

func BuildTestCluster(tb testing.TB, size uint, ds datastore.Datastore) ServiceTester

type Tag

type Tag string

Tag categorizes benchmarks for filtering.

const (
	Arrows    Tag = "arrows"
	Recursion Tag = "recursion"
)

Jump to

Keyboard shortcuts

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