app

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearCleanup added in v0.4.1

func ClearCleanup(thread *starlark.Thread, key string)

ClearCleanup clears a defer function from the thread local

func CreatePluginApi added in v0.3.0

func CreatePluginApi(f StarlarkFunction, opType PluginFunctionType) utils.PluginFunc

func CreatePluginApiName added in v0.4.0

func CreatePluginApiName(
	f func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error),
	opType PluginFunctionType,
	name string) utils.PluginFunc

CreatePluginApiName creates a Clace plugin function

func DeferCleanup added in v0.4.1

func DeferCleanup(thread *starlark.Thread, key string, deferFunc DeferFunc, strict bool)

DeferCleanup defers a close function to call when the API handler is done

func FetchPluginState added in v0.4.1

func FetchPluginState(thread *starlark.Thread, key string) any

FetchPluginState fetches a value from the thread local for the plugin

func GetContext added in v0.4.1

func GetContext(thread *starlark.Thread) context.Context

func RegisterPlugin

func RegisterPlugin(name string, builder utils.NewPluginFunc, funcs []utils.PluginFunc)

RegisterPlugin registers a plugin with Clace

func SavePluginState added in v0.4.1

func SavePluginState(thread *starlark.Thread, key string, value any)

SavePluginState saves a value in the thread local for the plugin

Types

type App

type App struct {
	*utils.Logger
	*utils.AppEntry
	Name         string
	CustomLayout bool

	Config *util.AppConfig
	// contains filtered or unexported fields
}

App is the main object that represents a Clace app. It is created when the app is loaded

func NewApp

func NewApp(sourceFS *util.SourceFs, workFS *util.WorkFs, logger *utils.Logger,
	appEntry *utils.AppEntry, systemConfig *utils.SystemConfig,
	plugins map[string]utils.PluginSettings) *App

func (*App) Audit

func (a *App) Audit() (*utils.ApproveResult, error)

func (*App) Close

func (a *App) Close() error

func (*App) Initialize

func (a *App) Initialize() error

func (*App) Reload

func (a *App) Reload(force, immediate bool) (bool, error)

func (*App) ResetFS added in v0.3.0

func (a *App) ResetFS()

func (*App) ServeHTTP

func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AppPlugins added in v0.4.0

type AppPlugins struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewAppPlugins added in v0.4.0

func NewAppPlugins(app *App, pluginConfig map[string]utils.PluginSettings, appAccounts []utils.AccountLink) *AppPlugins

func (*AppPlugins) GetPlugin added in v0.4.0

func (p *AppPlugins) GetPlugin(pluginInfo *utils.PluginInfo, accountName string) (any, error)

type DeferEntry added in v0.4.1

type DeferEntry struct {
	Func   DeferFunc
	Strict bool
}

type DeferFunc added in v0.4.1

type DeferFunc func() error

type PluginFunctionType added in v0.4.0

type PluginFunctionType int
const (
	READ PluginFunctionType = iota
	WRITE
	READ_WRITE
)

type PluginResponse added in v0.4.4

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

PluginResponse is a starlark.Value that represents the response to a plugin request

func NewErrorCodeResponse added in v0.4.4

func NewErrorCodeResponse(errorCode int, err error, value any) *PluginResponse

func NewErrorResponse added in v0.4.4

func NewErrorResponse(err error, errorCallable starlark.Callable, thread *starlark.Thread) *PluginResponse

func NewResponse added in v0.4.4

func NewResponse(value any) *PluginResponse

func (*PluginResponse) Attr added in v0.4.4

func (r *PluginResponse) Attr(name string) (starlark.Value, error)

func (*PluginResponse) AttrNames added in v0.4.4

func (r *PluginResponse) AttrNames() []string

func (*PluginResponse) Freeze added in v0.4.4

func (r *PluginResponse) Freeze()

func (*PluginResponse) Hash added in v0.4.4

func (r *PluginResponse) Hash() (uint32, error)

func (*PluginResponse) String added in v0.4.4

func (r *PluginResponse) String() string

func (*PluginResponse) Truth added in v0.4.4

func (r *PluginResponse) Truth() starlark.Bool

func (*PluginResponse) Type added in v0.4.4

func (r *PluginResponse) Type() string

func (*PluginResponse) UnmarshalStarlarkType added in v0.4.4

func (r *PluginResponse) UnmarshalStarlarkType() (any, error)

type SSEMessage

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

type StarlarkFunction added in v0.4.0

type StarlarkFunction func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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