Documentation ¶
Index ¶
- type RethinkManager
- func (m *RethinkManager) ColdStart() error
- func (m *RethinkManager) Create(policy Policy) error
- func (m *RethinkManager) Delete(id string) error
- func (m *RethinkManager) FindRequestCandidates(r *Request) (Policies, error)
- func (m *RethinkManager) Get(id string) (Policy, error)
- func (m *RethinkManager) Watch(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RethinkManager ¶
type RethinkManager struct { Session *r.Session Table r.Term sync.RWMutex Policies map[string]Policy }
RethinkManager is a rethinkdb implementation of Manager to store policies persistently.
func NewRethinkManager ¶
func NewRethinkManager(session *r.Session, table string) *RethinkManager
NewRethinkManager initializes a new RethinkManager for given session, table name defaults to "policies".
func (*RethinkManager) ColdStart ¶
func (m *RethinkManager) ColdStart() error
ColdStart loads all policies from rethinkdb into memory.
func (*RethinkManager) Create ¶
func (m *RethinkManager) Create(policy Policy) error
Create inserts a new policy.
func (*RethinkManager) Delete ¶
func (m *RethinkManager) Delete(id string) error
Delete removes a policy.
func (*RethinkManager) FindRequestCandidates ¶
func (m *RethinkManager) FindRequestCandidates(r *Request) (Policies, error)
func (*RethinkManager) Get ¶
func (m *RethinkManager) Get(id string) (Policy, error)
Get retrieves a policy.
func (*RethinkManager) Watch ¶
func (m *RethinkManager) Watch(ctx context.Context)
Watch is used to watch for changes on rethinkdb (which happens asynchronous) and updates manager's policy accordingly.
Click to show internal directories.
Click to hide internal directories.