Documentation
¶
Index ¶
- Constants
- Variables
- func CheckForRelationship(client biz.ZanzibarRepository, subjectID string, subjectNamespace string, ...) bool
- type ContainerOptions
- type LocalSpiceDbContainer
- func (l *LocalSpiceDbContainer) Close()
- func (l *LocalSpiceDbContainer) CreateSpiceDbRepository() (*SpiceDbRepository, error)
- func (l *LocalSpiceDbContainer) Name() string
- func (l *LocalSpiceDbContainer) NewToken() (string, error)
- func (l *LocalSpiceDbContainer) Port() string
- func (l *LocalSpiceDbContainer) WaitForQuantizationInterval()
- type SpiceDbRepository
- func (s *SpiceDbRepository) AcquireLock(ctx context.Context, lockId string) (*apiV1beta1.AcquireLockResponse, error)
- func (s *SpiceDbRepository) Check(ctx context.Context, check *apiV1beta1.CheckRequest) (*apiV1beta1.CheckResponse, error)
- func (s *SpiceDbRepository) CheckBulk(ctx context.Context, check *apiV1beta1.CheckBulkRequest) (*apiV1beta1.CheckBulkResponse, error)
- func (s *SpiceDbRepository) CheckForUpdate(ctx context.Context, check *apiV1beta1.CheckForUpdateRequest) (*apiV1beta1.CheckForUpdateResponse, error)
- func (s *SpiceDbRepository) CreateRelationships(ctx context.Context, rels []*apiV1beta1.Relationship, touch biz.TouchSemantics, ...) (*apiV1beta1.CreateTuplesResponse, error)
- func (s *SpiceDbRepository) DeleteRelationships(ctx context.Context, filter *apiV1beta1.RelationTupleFilter, ...) (*apiV1beta1.DeleteTuplesResponse, error)
- func (s *SpiceDbRepository) ImportBulkTuples(...) error
- func (s *SpiceDbRepository) IsBackendAvailable() error
- func (s *SpiceDbRepository) LookupResources(ctx context.Context, resouce_type *apiV1beta1.ObjectType, relation string, ...) (chan *biz.ResourceResult, chan error, error)
- func (s *SpiceDbRepository) LookupSubjects(ctx context.Context, subject_type *apiV1beta1.ObjectType, ...) (chan *biz.SubjectResult, chan error, error)
- func (s *SpiceDbRepository) ReadRelationships(ctx context.Context, filter *apiV1beta1.RelationTupleFilter, limit uint32, ...) (chan *biz.RelationshipResult, chan error, error)
Constants ¶
const ( // SpicedbImage is the image used for containerized spiceDB in tests SpicedbImage = "authzed/spicedb" // SpicedbVersion is the image version used for containerized spiceDB in tests SpicedbVersion = "v1.37.0" // SpicedbSchemaBootstrapFile specifies an optional bootstrap schema file to be used for testing SpicedbSchemaBootstrapFile = "spicedb-test-data/basic_schema.zed" // SpicedbRelationsBootstrapFile specifies an optional bootstrap file containing relations to be used for testing SpicedbRelationsBootstrapFile = "" // FullyConsistent specifices the consistency mode used for our read API calls // may experience different results between tests and manual probing if the values differ FullyConsistent = false // Should probably be inline with our config file. (TODO: Can we make our tests grab the same value?) )
Variables ¶
var ProviderSet = wire.NewSet(NewSpiceDbRepository, wire.Bind(new(biz.ZanzibarRepository), new(*SpiceDbRepository)))
ProviderSet is data providers.
Functions ¶
func CheckForRelationship ¶
func CheckForRelationship(client biz.ZanzibarRepository, subjectID string, subjectNamespace string, subjectType string, subjectRelationship string, relationship string, resourceNamespace string, resourceType string, resourceID string, consistency *v1beta1.Consistency) bool
CheckForRelationship returns true if the given subject has the given relationship to the given resource, otherwise false
Types ¶
type LocalSpiceDbContainer ¶
type LocalSpiceDbContainer struct {
// contains filtered or unexported fields
}
LocalSpiceDbContainer struct that holds pointers to the container, dockertest pool and exposes the port
func CreateContainer ¶
func CreateContainer(opts *ContainerOptions) (*LocalSpiceDbContainer, error)
CreateContainer creates a new SpiceDbContainer using dockertest
func (*LocalSpiceDbContainer) Close ¶
func (l *LocalSpiceDbContainer) Close()
Close purges the container
func (*LocalSpiceDbContainer) CreateSpiceDbRepository ¶
func (l *LocalSpiceDbContainer) CreateSpiceDbRepository() (*SpiceDbRepository, error)
CreateClient creates a new client that connects to the dockerized spicedb instance and the right store
func (*LocalSpiceDbContainer) Name ¶
func (l *LocalSpiceDbContainer) Name() string
Name returns the container name
func (*LocalSpiceDbContainer) NewToken ¶
func (l *LocalSpiceDbContainer) NewToken() (string, error)
NewToken returns a new token used for the container so a new store is created in serve-testing
func (*LocalSpiceDbContainer) Port ¶
func (l *LocalSpiceDbContainer) Port() string
Port returns the Port the container is listening
func (*LocalSpiceDbContainer) WaitForQuantizationInterval ¶
func (l *LocalSpiceDbContainer) WaitForQuantizationInterval()
WaitForQuantizationInterval needed to avoid read-before-write when loading the schema
type SpiceDbRepository ¶
type SpiceDbRepository struct {
// contains filtered or unexported fields
}
SpiceDbRepository .
func NewSpiceDbRepository ¶
NewSpiceDbRepository .
func (*SpiceDbRepository) AcquireLock ¶
func (s *SpiceDbRepository) AcquireLock(ctx context.Context, lockId string) (*apiV1beta1.AcquireLockResponse, error)
func (*SpiceDbRepository) Check ¶
func (s *SpiceDbRepository) Check(ctx context.Context, check *apiV1beta1.CheckRequest) (*apiV1beta1.CheckResponse, error)
func (*SpiceDbRepository) CheckBulk ¶
func (s *SpiceDbRepository) CheckBulk(ctx context.Context, check *apiV1beta1.CheckBulkRequest) (*apiV1beta1.CheckBulkResponse, error)
simplified CheckBulk using the helpers
func (*SpiceDbRepository) CheckForUpdate ¶
func (s *SpiceDbRepository) CheckForUpdate(ctx context.Context, check *apiV1beta1.CheckForUpdateRequest) (*apiV1beta1.CheckForUpdateResponse, error)
func (*SpiceDbRepository) CreateRelationships ¶
func (s *SpiceDbRepository) CreateRelationships(ctx context.Context, rels []*apiV1beta1.Relationship, touch biz.TouchSemantics, fencing *apiV1beta1.FencingCheck) (*apiV1beta1.CreateTuplesResponse, error)
func (*SpiceDbRepository) DeleteRelationships ¶
func (s *SpiceDbRepository) DeleteRelationships(ctx context.Context, filter *apiV1beta1.RelationTupleFilter, fencing *apiV1beta1.FencingCheck) (*apiV1beta1.DeleteTuplesResponse, error)
func (*SpiceDbRepository) ImportBulkTuples ¶
func (s *SpiceDbRepository) ImportBulkTuples(stream grpc.ClientStreamingServer[apiV1beta1.ImportBulkTuplesRequest, apiV1beta1.ImportBulkTuplesResponse]) error
func (*SpiceDbRepository) IsBackendAvailable ¶
func (s *SpiceDbRepository) IsBackendAvailable() error
func (*SpiceDbRepository) LookupResources ¶
func (s *SpiceDbRepository) LookupResources(ctx context.Context, resouce_type *apiV1beta1.ObjectType, relation string, subject *apiV1beta1.SubjectReference, limit uint32, continuation biz.ContinuationToken, consistency *apiV1beta1.Consistency) (chan *biz.ResourceResult, chan error, error)
func (*SpiceDbRepository) LookupSubjects ¶
func (s *SpiceDbRepository) LookupSubjects(ctx context.Context, subject_type *apiV1beta1.ObjectType, subject_relation, relation string, object *apiV1beta1.ObjectReference, limit uint32, continuation biz.ContinuationToken, consistency *apiV1beta1.Consistency) (chan *biz.SubjectResult, chan error, error)
func (*SpiceDbRepository) ReadRelationships ¶
func (s *SpiceDbRepository) ReadRelationships(ctx context.Context, filter *apiV1beta1.RelationTupleFilter, limit uint32, continuation biz.ContinuationToken, consistency *apiV1beta1.Consistency) (chan *biz.RelationshipResult, chan error, error)