Documentation
¶
Index ¶
- type MemLimits
- type Option
- func WithAutoResponseSize(b bool) Option
- func WithControlAt(addr string) Option
- func WithGRPCOptions(opt ...grpc.ServerOption) Option
- func WithHealthAt(addr string) Option
- func WithLogger(logger *log.Logger) Option
- func WithMaxGRPCStreams(limit uint32) Option
- func WithMaxResponseSize(size uint32) Option
- func WithMemLimits(limits MemLimits) Option
- func WithMemProfDumping(path string, numGC uint32, delay time.Duration) Option
- func WithMemStatsLogging(path string, interval time.Duration) Option
- func WithPolicyParser(parser ast.Parser) Option
- func WithProfilerAt(addr string) Option
- func WithServiceAt(addr string) Option
- func WithStorageAt(addr string) Option
- func WithTracingAt(addr string) Option
- func WithValidatePostHook(f ValidatePostHookFn) Option
- func WithValidatePreHook(f ValidatePreHookFn) Option
- type Server
- func (s *Server) Apply(ctx context.Context, in *pb.Update) (*pb.Response, error)
- func (s *Server) GRPCServer() *grpc.Server
- func (s *Server) InitializeSelectors()
- func (s *Server) LoadContent(paths []string) error
- func (s *Server) LoadPolicies(path string) error
- func (s *Server) NewValidationStream(stream pb.PDP_NewValidationStreamServer) error
- func (s *Server) NotifyReady(ctx context.Context, m *pb.Empty) (*pb.Response, error)
- func (s *Server) ReadContent(readers ...io.Reader) error
- func (s *Server) ReadPolicies(r io.Reader) error
- func (s *Server) Request(ctx context.Context, in *pb.Item) (*pb.Response, error)
- func (s *Server) Serve() error
- func (s *Server) Stop() error
- func (s *Server) Upload(stream pb.PDPControl_UploadServer) error
- func (s *Server) Validate(ctx context.Context, in *pb.Msg) (*pb.Msg, error)
- type ValidatePostHookFn
- type ValidatePreHookFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemLimits ¶
type MemLimits struct {
// contains filtered or unexported fields
}
MemLimits structure contains memory limit levels to manage GC
type Option ¶
type Option func(*options)
Option configures how we set up PDP server.
func WithAutoResponseSize ¶
WithAutoResponseSize creates an options which makes server automatically allocate response buffer. If the options isn't set server uses default fixed buffer size which is 10KB.
func WithControlAt ¶
WithControlAt returns a Option which sets control endpoint
func WithGRPCOptions ¶ added in v0.0.3
func WithGRPCOptions(opt ...grpc.ServerOption) Option
WithServerOption specifies gRPC Server Options
func WithHealthAt ¶
WithHealthAt returns a Option which sets healthcheck endpoint
func WithLogger ¶
WithLogger returns a Option which sets logger
func WithMaxGRPCStreams ¶
WithMaxGRPCStreams returns a Option which sets maximum gRPC streams count
func WithMaxResponseSize ¶
WithMaxResponseSize creates an option which limits response size in bytes. Default is 10KB. In case if a response doesn't fit the constraint, PDP puts error message to response which indicates this fact. Buffer should be at least pdp.MinResponseSize long to accept the error.
func WithMemLimits ¶
WithMemLimits returns a Option which sets memory limits
func WithMemProfDumping ¶
WithMemProfDumping returns a Option to enables memory profile dumps. Path points to a directory for memory profile files. File name is "mem-NNNNNNNNN.pprof" where NNNNNNNNN is value of runtime.MemStats.NumGC after which the profile is stored.Dumps are created at each numGC after first dump (negative or zero value disables dumping). If delay is above zero first dump is taken with the delay after request service port has been opened.
func WithMemStatsLogging ¶
WithMemStatsLogging returns a Option which enables regular runtime.MemStats logging. Path points to file where stats are logged as sequence of JSON objects splitted by new line. Each JSON object contains timestamp and output of runtime.ReadMemStats taken with given interval. Zero interval logs MemStats with minimum and maximum Alloc value between NumGC changes but not more than once a 100 ms. Negative interval disables logging.
func WithPolicyParser ¶
WithPolicyParser returns a Option which sets policy parser
func WithProfilerAt ¶
WithProfilerAt returns a Option which sets profiler endpoint
func WithServiceAt ¶
WithServiceAt returns a Option which sets service endpoint
func WithStorageAt ¶
WithStorageAt returns a Option which sets storage endpoint
func WithTracingAt ¶
WithTracingAt returns a Option which sets tracing endpoint
func WithValidatePostHook ¶ added in v0.0.2
func WithValidatePostHook(f ValidatePostHookFn) Option
WithValidatePostHook calls the passed func at the end of Validate()
func WithValidatePreHook ¶ added in v0.0.2
func WithValidatePreHook(f ValidatePreHookFn) Option
WithValidatePreHook calls the passed func at the start of Validate()
type Server ¶
Server structure is PDP server object
func (*Server) Apply ¶
Apply is a server handler for gRPC call It applies data previously saved in PDP
func (*Server) GRPCServer ¶ added in v0.0.3
GRPCServer expose the underlying gRPC Server
func (*Server) InitializeSelectors ¶
func (s *Server) InitializeSelectors()
InitializeSelectors initialize all registered selectors that are enabled
func (*Server) LoadContent ¶
LoadContent loads content from files
func (*Server) LoadPolicies ¶
LoadPolicies loads policies from file
func (*Server) NewValidationStream ¶
func (s *Server) NewValidationStream(stream pb.PDP_NewValidationStreamServer) error
NewValidationStream is a server handler for gRPC call It creates new gRPC stream and handles PDP decision requests using it
func (*Server) NotifyReady ¶
NotifyReady is a server handler for gRPC call It starts handling decision requests
func (*Server) ReadContent ¶
ReadContent reads content with using io.Reader instances
func (*Server) ReadPolicies ¶
ReadPolicies reads policies with using io.Reader instance
type ValidatePostHookFn ¶ added in v0.0.2
ValidatePostHookFn is called when passed to WithValidatePostHook