store

package
v0.0.0-...-1643d90 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: UPL-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxDiscoverRequestNum                = int64(50000)
	DefaultDeleteNumWhenReachMaxDiscoverRequest = int64(100)
)

Variables

View Source
var MaxDiscoverRequestNum, DeleteNumWhenReachMaxDiscoverRequest int64

Functions

func GeneratePoliciesFromDiscoverRequests

func GeneratePoliciesFromDiscoverRequests(requests []*ads.RequestContext, principalType, principalName, principalIDD string) (map[string]*pms.Service, error)

func GetAllStoreParams

func GetAllStoreParams() map[string]string

The return map expect param's command line flag name as key, and storeProps key in config file as value

func NewStore

func NewStore(storeType string, storeConfig map[string]interface{}) (pms.PolicyStoreManager, error)

func Register

func Register(storeType string, storeBuilder StoreBuilder)

Register makes a type of store available by the provided name. If Register is called twice with the same name or if storeBuilder is nil, it panics.

func StoreBuilders

func StoreBuilders() []string

StoreBuilders returns a sorted list of the names of the registered store types.

Types

type DiscoverRequestManager

type DiscoverRequestManager interface {
	//Save discover request
	SaveDiscoverRequest(discoverRequest *ads.RequestContext) error
	//Get last request log
	GetLastDiscoverRequest(serviceName string) (*ads.RequestContext, int64, error)
	//Get request logs since a revision.
	GetDiscoverRequestsSinceRevision(serviceName string, revision int64) ([]*ads.RequestContext, int64, error)
	//Get request logs for a service. Get all requests when serviceName is empty.
	GetDiscoverRequests(serviceName string) ([]*ads.RequestContext, int64, error)
	//Clean request logs for a service. Clean all request logs when serviceName is empty.
	ResetDiscoverRequests(serviceName string) error
	//Generate policies for principal based on existing request logs. Generate policies for all principals when principalXXX are empty.
	GeneratePolicies(serviceName, principalType, principalName, principalIDD string) (map[string]*pms.Service, int64, error)
}

type StoreBuilder

type StoreBuilder interface {
	NewStore(storeConfig map[string]interface{}) (pms.PolicyStoreManager, error)
	GetStoreParams() map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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