rethink

package
v0.0.0-...-ac214d9 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

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