Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidRelationTupleString = fmt.Errorf("the RelationTuple string is malformed")
View Source
var ErrInvalidSubjectSetString = fmt.Errorf("the provided SubjectSet string is malformed")
Functions ¶
This section is empty.
Types ¶
type AccessWatcher ¶
type AccessWatcher struct {
watchpb.UnimplementedWatchServiceServer
// contains filtered or unexported fields
}
func NewAccessWatcher ¶
func NewAccessWatcher(opts ...AccessWatcherOption) (*AccessWatcher, error)
func (*AccessWatcher) Watch ¶
func (w *AccessWatcher) Watch(req *watchpb.WatchRequest, server watchpb.WatchService_WatchServer) error
type AccessWatcherOption ¶
type AccessWatcherOption func(*AccessWatcher)
func WithChangelogDatastore ¶
func WithChangelogDatastore(ds ChangelogDatastore) AccessWatcherOption
type ChangelogDatastore ¶
type ChangelogEntry ¶
type ChangelogEntry struct {
Namespace string
Operation string
RelationTuple *InternalRelationTuple
Timestamp time.Time
}
type ChangelogIterator ¶
type ChangelogIterator interface {
// Next prepares the next changelog entry for reading. It returns true
// if there is another entry and false if no more entries are available.
Next() bool
// Value returns the current most changelog entry that the iterator is
// iterating over.
Value() (*ChangelogEntry, error)
}
ChangelogIterator is used to iterate over changelog entries as they are yielded.
type InternalRelationTuple ¶
type InternalRelationTuple struct {
Namespace string `json:"namespace"`
Object string `json:"object"`
Relation string `json:"relation"`
Subject Subject `json:"subject"`
}
func RelationTupleFromString ¶
func RelationTupleFromString(s string) (*InternalRelationTuple, error)
func (*InternalRelationTuple) String ¶
func (r *InternalRelationTuple) String() string
String returns r as a relation tuple in string format.
func (*InternalRelationTuple) ToProto ¶
func (r *InternalRelationTuple) ToProto() *watchpb.RelationTuple
ToProto serializes r in it's equivalent protobuf format.
type Subject ¶
type Subject interface {
json.Marshaler
String() string
FromString(string) (Subject, error)
Equals(interface{}) bool
ToProto() *watchpb.Subject
}
func SubjectFromString ¶
SubjectFromString parses the string s and returns a Subject - either a SubjectSet or an explicit SubjectID.
type SubjectSet ¶
type SubjectSet struct {
Namespace string `json:"namespace"`
Object string `json:"object"`
Relation string `json:"relation"`
}
func (*SubjectSet) Equals ¶
func (s *SubjectSet) Equals(v interface{}) bool
func (*SubjectSet) FromString ¶
func (s *SubjectSet) FromString(str string) (Subject, error)
func (SubjectSet) MarshalJSON ¶
func (s SubjectSet) MarshalJSON() ([]byte, error)
func (*SubjectSet) String ¶
func (s *SubjectSet) String() string
func (*SubjectSet) ToProto ¶
func (s *SubjectSet) ToProto() *watchpb.Subject
Click to show internal directories.
Click to hide internal directories.