Documentation ¶
Index ¶
- Variables
- func ValidateUpdatesToWrite(updates []*v1.RelationshipUpdate) error
- func WithJitter(factor float64, interval time.Duration) time.Duration
- type Changes
- type ExecuteQueryFunc
- type SchemaInformation
- type SchemaQueryFilterer
- func (sqf SchemaQueryFilterer) FilterToRelation(relation string) SchemaQueryFilterer
- func (sqf SchemaQueryFilterer) FilterToResourceID(objectID string) SchemaQueryFilterer
- func (sqf SchemaQueryFilterer) FilterToResourceType(resourceType string) SchemaQueryFilterer
- func (sqf SchemaQueryFilterer) FilterToSubjectFilter(filter *v1.SubjectFilter) SchemaQueryFilterer
- type TransactionPreparer
- type TupleQuerySplitter
Constants ¶
This section is empty.
Variables ¶
var ( // ObjNamespaceNameKey is a tracing attribute representing the resource // object type. ObjNamespaceNameKey = attribute.Key("authzed.com/spicedb/sql/objNamespaceName") // ObjRelationNameKey is a tracing attribute representing the resource // relation. ObjRelationNameKey = attribute.Key("authzed.com/spicedb/sql/objRelationName") // ObjIDKey is a tracing attribute representing the resource object ID. ObjIDKey = attribute.Key("authzed.com/spicedb/sql/objId") // SubNamespaceNameKey is a tracing attribute representing the subject object // type. SubNamespaceNameKey = attribute.Key("authzed.com/spicedb/sql/subNamespaceName") // SubRelationNameKey is a tracing attribute representing the subject // relation. SubRelationNameKey = attribute.Key("authzed.com/spicedb/sql/subRelationName") // SubObjectIDKey is a tracing attribute representing the the subject object // ID. SubObjectIDKey = attribute.Key("authzed.com/spicedb/sql/subObjectId") )
Functions ¶
func ValidateUpdatesToWrite ¶ added in v1.3.0
func ValidateUpdatesToWrite(updates []*v1.RelationshipUpdate) error
ValidateUpdatesToWrite performs basic validation on relationship updates going into datastores.
Types ¶
type Changes ¶ added in v1.3.0
type Changes map[revisionKey]*changeRecord
Changes represents a set of tuple mutations that are kept self-consistent across one or more transaction revisions.
func NewChanges ¶ added in v1.3.0
func NewChanges() Changes
NewChanges creates a new Changes object for change tracking and de-duplication.
func (Changes) AddChange ¶ added in v1.3.0
func (ch Changes) AddChange( ctx context.Context, rev decimal.Decimal, tpl *core.RelationTuple, op core.RelationTupleUpdate_Operation, )
AddChange adds a specific change to the complete list of tracked changes
func (Changes) AsRevisionChanges ¶ added in v1.3.0
func (ch Changes) AsRevisionChanges() (changes []*datastore.RevisionChanges)
AsRevisionChanges returns the list of changes processed so far as a datastore watch compatible, ordered, changelist.
type ExecuteQueryFunc ¶ added in v1.5.0
type ExecuteQueryFunc func(ctx context.Context, revision datastore.Revision, sql string, args []interface{}) ([]*core.RelationTuple, error)
ExecuteQueryFunc is a function that can be used to execute a single rendered SQL query.
func NewPGXExecutor ¶ added in v1.5.0
func NewPGXExecutor(conn *pgxpool.Pool, prepTxn TransactionPreparer) ExecuteQueryFunc
type SchemaInformation ¶
type SchemaInformation struct { TableTuple string ColNamespace string ColObjectID string ColRelation string ColUsersetNamespace string ColUsersetObjectID string ColUsersetRelation string }
SchemaInformation holds the schema information from the SQL datastore implementation.
type SchemaQueryFilterer ¶ added in v1.3.0
type SchemaQueryFilterer struct {
// contains filtered or unexported fields
}
SchemaQueryFilterer wraps a SchemaInformation and SelectBuilder to give an opinionated way to build query objects.
func NewSchemaQueryFilterer ¶ added in v1.3.0
func NewSchemaQueryFilterer(schema SchemaInformation, initialQuery sq.SelectBuilder) SchemaQueryFilterer
NewSchemaQueryFilterer creates a new SchemaQueryFilterer object.
func (SchemaQueryFilterer) FilterToRelation ¶ added in v1.3.0
func (sqf SchemaQueryFilterer) FilterToRelation(relation string) SchemaQueryFilterer
FilterToRelation returns a new SchemaQueryFilterer that is limited to resources with the specified relation.
func (SchemaQueryFilterer) FilterToResourceID ¶ added in v1.3.0
func (sqf SchemaQueryFilterer) FilterToResourceID(objectID string) SchemaQueryFilterer
FilterToResourceID returns a new SchemaQueryFilterer that is limited to resources with the specified ID.
func (SchemaQueryFilterer) FilterToResourceType ¶ added in v1.3.0
func (sqf SchemaQueryFilterer) FilterToResourceType(resourceType string) SchemaQueryFilterer
FilterToResourceType returns a new SchemaQueryFilterer that is limited to resources of the specified type.
func (SchemaQueryFilterer) FilterToSubjectFilter ¶ added in v1.3.0
func (sqf SchemaQueryFilterer) FilterToSubjectFilter(filter *v1.SubjectFilter) SchemaQueryFilterer
FilterToSubjectFilter returns a new SchemaQueryFilterer that is limited to resources with subjects that match the specified filter.
type TransactionPreparer ¶
TransactionPreparer is a function provided by the datastore to prepare the transaction before the tuple query is run.
type TupleQuerySplitter ¶ added in v1.3.0
type TupleQuerySplitter struct { Executor ExecuteQueryFunc UsersetBatchSize int }
TupleQuerySplitter is a tuple query runner shared by SQL implementations of the datastore.
func (TupleQuerySplitter) SplitAndExecuteQuery ¶ added in v1.5.0
func (tqs TupleQuerySplitter) SplitAndExecuteQuery( ctx context.Context, query SchemaQueryFilterer, revision datastore.Revision, opts ...options.QueryOptionsOption, ) (datastore.TupleIterator, error)
SplitAndExecuteQuery is used to split up the usersets in a very large query and execute them as separate queries.