Documentation ¶
Index ¶
- Variables
- func RegisterGCMetrics() error
- func StartGarbageCollector(ctx context.Context, gc GarbageCollector, ...) error
- func ValidateUpdatesToWrite(updates []*v1.RelationshipUpdate) error
- func WithJitter(factor float64, interval time.Duration) time.Duration
- type Changes
- type DeletionCounts
- type ExecuteQueryFunc
- type GarbageCollector
- 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 TupleQuerySplitter
- type TxCleanupFunc
- type TxFactory
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 RegisterGCMetrics ¶ added in v1.10.0
func RegisterGCMetrics() error
RegisterGCMetrics registers garbage collection metrics to the default registry.
func StartGarbageCollector ¶ added in v1.10.0
func StartGarbageCollector(ctx context.Context, gc GarbageCollector, interval, window, timeout time.Duration) error
StartGarbageCollector loops forever until the context is canceled and performs garbage collection on the provided interval.
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 DeletionCounts ¶ added in v1.10.0
DeletionCounts tracks the amount of deletions that occurred when calling DeleteBeforeTx.
func (DeletionCounts) MarshalZerologObject ¶ added in v1.10.0
func (g DeletionCounts) MarshalZerologObject(e *zerolog.Event)
type ExecuteQueryFunc ¶ added in v1.5.0
type ExecuteQueryFunc func(ctx context.Context, sql string, args []any) ([]*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(txSource TxFactory) ExecuteQueryFunc
NewPGXExecutor creates an executor that uses the pgx library to make the specified queries.
type GarbageCollector ¶ added in v1.10.0
type GarbageCollector interface { IsReady(context.Context) (bool, error) Now(context.Context) (time.Time, error) TxIDBefore(context.Context, time.Time) (uint64, error) DeleteBeforeTx(ctx context.Context, txID uint64) (DeletionCounts, error) }
GarbageCollector represents any datastore that supports external garbage collection.
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 TupleQuerySplitter ¶ added in v1.3.0
type TupleQuerySplitter struct { Executor ExecuteQueryFunc UsersetBatchSize uint16 }
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, opts ...options.QueryOptionsOption, ) (datastore.RelationshipIterator, error)
SplitAndExecuteQuery is used to split up the usersets in a very large query and execute them as separate queries.
type TxCleanupFunc ¶ added in v1.8.0
TxCleanupFunc is a function that should be executed when the caller of TransactionFactory is done with the transaction.