rdb

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBResult added in v0.0.3

type DBResult interface {
	Next(dest interface{}) bool
	Err() error
}

type FilterFunc added in v0.0.3

type FilterFunc func(t r.Term) r.Term

type PolicySchema added in v0.0.3

type PolicySchema struct {
	ID          string          `json:"id" gorethink:"id"`
	Description string          `json:"description" gorethink:"description"`
	Subjects    subjects        `json:"subjects" gorethink:"subjects"`
	Effect      string          `json:"effect" gorethink:"effect"`
	Resources   resources       `json:"resources" gorethink:"resources"`
	Actions     actions         `json:"actions" gorethink:"actions"`
	Conditions  json.RawMessage `json:"conditions" gorethink:"conditions"`
}

func (*PolicySchema) GetID added in v0.0.3

func (s *PolicySchema) GetID() string

func (*PolicySchema) GetPolicy added in v0.0.3

func (s *PolicySchema) GetPolicy() (Policy, error)

func (*PolicySchema) PopulateWithPolicy added in v0.0.3

func (s *PolicySchema) PopulateWithPolicy(p Policy) error

type PolicySchemaManager added in v0.0.3

type PolicySchemaManager struct{}

func (*PolicySchemaManager) GetFilterFunc added in v0.0.3

func (_ *PolicySchemaManager) GetFilterFunc(sbj, res, act string) FilterFunc

func (*PolicySchemaManager) GetRequestCandidatesTerm added in v0.0.4

func (sm *PolicySchemaManager) GetRequestCandidatesTerm(table r.Term, sbj, res, act string) r.Term

GetRequestCandidates term returns term to provide getRequestCandidates ability

func (*PolicySchemaManager) NewSchema added in v0.0.3

func (_ *PolicySchemaManager) NewSchema() Schema

func (*PolicySchemaManager) ProcessResult added in v0.0.3

func (_ *PolicySchemaManager) ProcessResult(r DBResult) chan *ProcessResult

type ProcessResult added in v0.0.3

type ProcessResult struct {
	Schema Schema
	Err    error
}

type RdbManager

type RdbManager struct {
	// contains filtered or unexported fields
}

RdbManager is a rethinkdb implementation of Manager to store policies persistently.

func NewRdbManager

func NewRdbManager(session *r.Session, table string, s SchemaManager) *RdbManager

NewRdbManager initializes a new RdbManager for given session.

func (*RdbManager) Create

func (m *RdbManager) Create(policy Policy) error

Create inserts a new policy.

func (*RdbManager) Delete

func (m *RdbManager) Delete(id string) error

Delete removes a policy.

func (*RdbManager) FindRequestCandidates

func (m *RdbManager) FindRequestCandidates(req *Request) (Policies, error)

FindRequestCandidates returns candidates that could match the request object. It either returns a set that exactly matches the request, or a superset of it. If an error occurs, it returns nil and the error.

func (*RdbManager) Get

func (m *RdbManager) Get(id string) (Policy, error)

Get retrieves a policy.

func (*RdbManager) GetAll

func (m *RdbManager) GetAll(limit, offset int64) (Policies, error)

GetAll returns all policies.

func (*RdbManager) Update

func (m *RdbManager) Update(policy Policy) error

Update updates an existing policy.

type Schema added in v0.0.3

type Schema interface {
	GetID() string
	GetPolicy() (Policy, error)
	PopulateWithPolicy(Policy) error
}

type SchemaManager added in v0.0.3

type SchemaManager interface {
	NewSchema() Schema
	GetFilterFunc(subject, resource, action string) FilterFunc
	GetRequestCandidatesTerm(table r.Term, subject, resource, action string) r.Term
	ProcessResult(r DBResult) chan *ProcessResult
}

Jump to

Keyboard shortcuts

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