app

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTraceId  = "X-B3-TraceId"
	HeaderTenantId = "Application-Id"
)

API header expected keys

View Source
const (
	TENANT_CACHE_TTL_SECS = 30
)

Variables

View Source
var WebsiteFS embed.FS

Functions

func GetTaskArn added in v1.1.2

func GetTaskArn() (string, error)

func NewMiddleware

func NewMiddleware(logger *zerolog.Logger, jwtManager jwt.JWTConsumer) []func(next http.Handler) http.Handler

func NewMux

func NewMux(a *APIManager, middleware []func(next http.Handler) http.Handler) (http.Handler, error)

func ProvideLogger added in v0.2.0

func ProvideLogger(config config.Config) (*zerolog.Logger, error)

func SetupAPIServer

func SetupAPIServer(lifecycle fx.Lifecycle, config config.Config, logger *zerolog.Logger, mux http.Handler) error

func SetupCheckpointManager added in v0.7.0

func SetupCheckpointManager(lifecycle fx.Lifecycle, checkpointManager checkpoint.CheckpointManager, config config.Config, logger *zerolog.Logger) error

func SetupNodeStateManager added in v0.7.0

func SetupNodeStateManager(lifecycle fx.Lifecycle, nodeStateManager sharder.NodeStateManager, config config.Config, logger *zerolog.Logger) error

func SetupOpenTelemetry added in v0.7.0

func SetupOpenTelemetry(lifecycle fx.Lifecycle, config config.Config, logger *zerolog.Logger) error

func SetupPprof added in v1.1.0

func SetupPprof(lifecycle fx.Lifecycle, logger *zerolog.Logger, config config.Config) error

Types

type APIManager

type APIManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewAPIManager

func NewAPIManager(routingMgr tablemgr.RoutingTableManager, tenantStorer tenant.TenantStorer, quotaManager *quota.QuotaManager, jwtManager jwt.JWTConsumer, config config.Config) (*APIManager, error)

type AWSTaskMetadata added in v1.1.2

type AWSTaskMetadata struct {
	TaskARN string
}

type ApiError added in v0.2.0

type ApiError interface {
	error
	StatusCode() int
}

Rest API errors

type BadRequestError added in v0.2.0

type BadRequestError struct {
	// contains filtered or unexported fields
}

func (*BadRequestError) Error added in v0.2.0

func (e *BadRequestError) Error() string

func (*BadRequestError) StatusCode added in v0.2.0

func (e *BadRequestError) StatusCode() int

type CachedTenantConfig added in v1.1.0

type CachedTenantConfig struct {
	tenant.Config
	Ts int64
}

type InternalServerError added in v0.2.0

type InternalServerError struct {
	Wrapped error
}

func (*InternalServerError) Error added in v0.2.0

func (e *InternalServerError) Error() string

func (*InternalServerError) StatusCode added in v0.2.0

func (e *InternalServerError) StatusCode() int

type InvalidOptionError

type InvalidOptionError struct {
	Option string
}

InvalidOptionError is returned when an invalid option is passed in

func (*InvalidOptionError) Error

func (e *InvalidOptionError) Error() string

type NotFoundError added in v0.2.0

type NotFoundError struct {
	// contains filtered or unexported fields
}

func (*NotFoundError) Error added in v0.2.0

func (e *NotFoundError) Error() string

func (*NotFoundError) StatusCode added in v0.2.0

func (e *NotFoundError) StatusCode() int

type NotImplementedError added in v0.2.0

type NotImplementedError struct {
}

func (*NotImplementedError) Error added in v0.2.0

func (e *NotImplementedError) Error() string

func (*NotImplementedError) StatusCode added in v0.2.0

func (e *NotImplementedError) StatusCode() int

type Response

type Response struct {
	Status  *Status  `json:"status,omitempty" xml:"status,omitempty"`
	Tracing *Tracing `json:"tx,omitempty" xml:"tx,omitempty"`

	Item  interface{} `json:"item,omitempty" xml:"item,omitempty"`
	Items interface{} `json:"items,omitempty" xml:"items,omitempty"`
	Data  interface{} `json:"data,omitempty" xml:"data,omitempty"`
}

func ErrorResponse added in v0.2.0

func ErrorResponse(apiErr ApiError) Response

func ItemResponse added in v0.2.0

func ItemResponse(item interface{}) Response

func ItemsResponse added in v0.2.0

func ItemsResponse(item interface{}) Response

func SimpleResponse added in v0.2.0

func SimpleResponse(ctx context.Context) Response

func (Response) Respond

func (r Response) Respond(ctx context.Context, w http.ResponseWriter, doYaml bool)

type Status

type Status struct {
	Code    int    `json:"code,omitempty" xml:"code,omitempty"`
	Message string `json:"message,omitempty" xml:"message,omitempty"`
}

type Tenant added in v0.2.0

type Tenant struct {
	// contains filtered or unexported fields
}

func NewTenantId added in v0.2.0

func NewTenantId(orgId, appId string) *Tenant

func (*Tenant) AppId added in v0.2.0

func (t *Tenant) AppId() string

func (*Tenant) OrgId added in v0.2.0

func (t *Tenant) OrgId() string

type TenantCache added in v1.1.0

type TenantCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTenantCache added in v1.1.0

func NewTenantCache(ttlSecs int) *TenantCache

func (*TenantCache) GetTenant added in v1.1.0

func (c *TenantCache) GetTenant(tenantId string) *tenant.Config

func (*TenantCache) SetTenant added in v1.1.0

func (c *TenantCache) SetTenant(tenantConfig *tenant.Config)

type Tracing

type Tracing struct {
	TraceId string `json:"traceId,omitempty" xml:"traceId,omitempty"`
	SpanId  string `json:"spanId,omitempty" xml:"spanId,omitempty"`
}

Directories

Path Synopsis
Package classification EARS
Package classification EARS

Jump to

Keyboard shortcuts

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