server

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 35 Imported by: 3

Documentation

Overview

Package server contains the endpoint handlers.

Index

Constants

View Source
const (
	AuthorizationModelIDHeader = "openfga-authorization-model-id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExperimentalFeatureFlag

type ExperimentalFeatureFlag string

type OpenFGAServiceV1Option added in v1.3.0

type OpenFGAServiceV1Option func(s *Server)

func WithChangelogHorizonOffset added in v1.3.0

func WithChangelogHorizonOffset(offset int) OpenFGAServiceV1Option

func WithCheckQueryCacheEnabled added in v1.3.1

func WithCheckQueryCacheEnabled(enabled bool) OpenFGAServiceV1Option

WithCheckQueryCacheEnabled enables/disables caching of check and list objects partial results.

func WithCheckQueryCacheLimit added in v1.3.1

func WithCheckQueryCacheLimit(limit uint32) OpenFGAServiceV1Option

WithCheckQueryCacheLimit sets the cache size limit (in items)

func WithCheckQueryCacheTTL added in v1.3.1

func WithCheckQueryCacheTTL(ttl time.Duration) OpenFGAServiceV1Option

WithCheckQueryCacheTTL sets the TTL of cached checks and list objects partial results

func WithDatastore added in v1.3.0

func WithExperimentals added in v1.3.0

func WithExperimentals(experimentals ...ExperimentalFeatureFlag) OpenFGAServiceV1Option

func WithListObjectsDeadline added in v1.3.0

func WithListObjectsDeadline(deadline time.Duration) OpenFGAServiceV1Option

func WithListObjectsMaxResults added in v1.3.0

func WithListObjectsMaxResults(limit uint32) OpenFGAServiceV1Option

func WithLogger added in v1.3.0

func WithLogger(l logger.Logger) OpenFGAServiceV1Option

func WithMaxAuthorizationModelSizeInBytes added in v1.3.3

func WithMaxAuthorizationModelSizeInBytes(size int) OpenFGAServiceV1Option

func WithMaxConcurrentReadsForCheck added in v1.3.0

func WithMaxConcurrentReadsForCheck(max uint32) OpenFGAServiceV1Option

WithMaxConcurrentReadsForCheck sets a limit on the number of datastore reads that can be in flight for a given Check call. This number should be set depending on the RPS expected for Check and ListObjects APIs, the number of OpenFGA replicas running, and the number of connections the datastore allows. E.g. if Datastore.MaxOpenConns = 100 and assuming that each Check call takes 1 second and no traffic to ListObjects API: - One OpenFGA replica and expected traffic of 100 RPS => set it to 1. - One OpenFGA replica and expected traffic of 1 RPS => set it to 100. - Two OpenFGA replicas and expected traffic of 1 RPS => set it to 50.

func WithMaxConcurrentReadsForListObjects added in v1.3.0

func WithMaxConcurrentReadsForListObjects(max uint32) OpenFGAServiceV1Option

WithMaxConcurrentReadsForListObjects sets a limit on the number of datastore reads that can be in flight for a given ListObjects call. This number should be set depending on the RPS expected for Check and ListObjects APIs, the number of OpenFGA replicas running, and the number of connections the datastore allows. E.g. if Datastore.MaxOpenConns = 100 and assuming that each ListObjects call takes 1 second and no traffic to Check API: - One OpenFGA replica and expected traffic of 100 RPS => set it to 1. - One OpenFGA replica and expected traffic of 1 RPS => set it to 100. - Two OpenFGA replicas and expected traffic of 1 RPS => set it to 50.

func WithRequestDurationByQueryHistogramBuckets added in v1.3.1

func WithRequestDurationByQueryHistogramBuckets(buckets []uint) OpenFGAServiceV1Option

WithRequestDurationByQueryHistogramBuckets sets the buckets used in labelling the requestDurationByQueryHistogram

func WithResolveNodeBreadthLimit added in v1.3.0

func WithResolveNodeBreadthLimit(limit uint32) OpenFGAServiceV1Option

WithResolveNodeBreadthLimit sets a limit on the number of goroutines that can be created when evaluating a subtree of a Check or ListObjects call. Thinking of a Check request as a tree of evaluations, this option controls, on a given level of the tree, the maximum number of nodes that can be evaluated concurrently (the breadth). If your authorization models are very complex (e.g. one relation is a union of many relations, or one relation is deeply nested), or if you have lots of users for (object, relation) pairs, you should set this option to be a low number (e.g. 1000)

func WithResolveNodeLimit added in v1.3.0

func WithResolveNodeLimit(limit uint32) OpenFGAServiceV1Option

WithResolveNodeLimit sets a limit on the number of recursive calls that one Check or ListObjects call will allow. Thinking of a request as a tree of evaluations, this option controls how many levels we will evaluate before throwing an error that the authorization model is too complex.

func WithTokenEncoder added in v1.3.0

func WithTokenEncoder(encoder encoder.Encoder) OpenFGAServiceV1Option

func WithTransport added in v1.3.0

func WithTransport(t gateway.Transport) OpenFGAServiceV1Option

type Server

type Server struct {
	openfgav1.UnimplementedOpenFGAServiceServer
	// contains filtered or unexported fields
}

A Server implements the OpenFGA service backend as both a GRPC and HTTP server.

func MustNewServerWithOpts added in v1.3.0

func MustNewServerWithOpts(opts ...OpenFGAServiceV1Option) *Server

func NewServerWithOpts added in v1.3.0

func NewServerWithOpts(opts ...OpenFGAServiceV1Option) (*Server, error)

func (*Server) Check

func (*Server) CreateStore

func (*Server) DeleteStore

func (*Server) Expand

func (*Server) GetStore

func (*Server) IsReady

func (s *Server) IsReady(ctx context.Context) (bool, error)

IsReady reports whether this OpenFGA server instance is ready to accept traffic.

func (*Server) ListObjects

func (*Server) ListStores

func (*Server) Read

func (*Server) ReadChanges

func (*Server) Write

Directories

Path Synopsis
Package commands contains the code that handles each endpoint.
Package commands contains the code that handles each endpoint.
reverseexpand
Package reverseexpand contains the code that handles the ReverseExpand API
Package reverseexpand contains the code that handles the ReverseExpand API
Package errors contains custom error codes that are sent to clients.
Package errors contains custom error codes that are sent to clients.
Package health contains the service that check the health of an OpenFGA server.
Package health contains the service that check the health of an OpenFGA server.

Jump to

Keyboard shortcuts

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