app

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTAINERFILE = "Containerfile"
	DOCKERFILE    = "Dockerfile"
)
View Source
const (
	DEFAULT_FILE_LIMIT = 10_000
	MAX_FILE_LIMIT     = 100_000
)

Variables

This section is empty.

Functions

func AddUserFile added in v0.9.8

func AddUserFile(ctx context.Context, file *types.UserFile) error

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) plugin.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) plugin.PluginFunc

CreatePluginApiName creates a Clace plugin function

func CreatePluginConstant added in v0.6.0

func CreatePluginConstant(name string, value starlark.Value) plugin.PluginFunc

func DeferCleanup added in v0.4.1

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

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

func DeleteUserFile added in v0.9.8

func DeleteUserFile(ctx context.Context, id string) error

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 GetUserFile added in v0.9.8

func GetUserFile(ctx context.Context, id string) (*types.UserFile, error)

func InitFileStore added in v0.9.8

func InitFileStore(ctx context.Context, connectString string) error

func NewFSPlugin added in v0.9.8

func NewFSPlugin(pluginContext *types.PluginContext) (any, error)

func RegisterPlugin

func RegisterPlugin(name string, builder plugin.NewPluginFunc, funcs []plugin.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 AccessType added in v0.9.8

type AccessType string
const (
	UserAccess AccessType = "user"
	AppAccess  AccessType = "app"
)

type App

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

	// App config that takes default values from toml config, overridden with app level metadata.
	// It is important that this property is used instead of reading from app metadata config, so that toml
	// config defaults are applied.
	AppConfig types.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 *appfs.SourceFs, workFS *appfs.WorkFs, logger *types.Logger,
	appEntry *types.AppEntry, systemConfig *types.SystemConfig,
	plugins map[string]types.PluginSettings, appConfig types.AppConfig, notifyClose chan<- types.AppPathDomain,
	secretEvalFunc func([][]string, string, string) (string, error),
	auditInsert func(*types.AuditEvent) error) (*App, error)

func (*App) Audit

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

func (*App) Close

func (a *App) Close() error

func (*App) Initialize

func (a *App) Initialize(dryRun types.DryRun) error

func (*App) Reload

func (a *App) Reload(force, immediate bool, dryRun types.DryRun) (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]types.PluginSettings, appAccounts []types.AccountLink) *AppPlugins

func (*AppPlugins) GetPlugin added in v0.4.0

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

type ContainerManager added in v0.7.1

type ContainerManager struct {
	*types.Logger
	// contains filtered or unexported fields
}

func NewContainerManager added in v0.7.1

func NewContainerManager(logger *types.Logger, app *App, containerFile string,
	systemConfig *types.SystemConfig, configPort int64, lifetime, scheme, health, buildDir string, sourceFS appfs.ReadableFS,
	paramMap map[string]string, containerConfig types.Container, stripAppPath bool,
	containerVolumes []string, secretsAllowed [][]string) (*ContainerManager, error)

func (*ContainerManager) Close added in v0.7.1

func (m *ContainerManager) Close() error

func (*ContainerManager) DevReload added in v0.7.1

func (m *ContainerManager) DevReload(dryRun bool) error

func (*ContainerManager) GetEnvMap added in v0.7.1

func (m *ContainerManager) GetEnvMap() (map[string]string, string)

func (*ContainerManager) GetHealthUrl added in v0.7.1

func (m *ContainerManager) GetHealthUrl(appHealthUrl string) string

func (*ContainerManager) GetProxyUrl added in v0.7.1

func (m *ContainerManager) GetProxyUrl() string

func (*ContainerManager) ProdReload added in v0.7.1

func (m *ContainerManager) ProdReload(dryRun bool) error

func (*ContainerManager) WaitForHealth added in v0.7.1

func (m *ContainerManager) WaitForHealth(attempts int) error

type ContainerState added in v0.7.1

type ContainerState string
const (
	ContainerStateUnknown       ContainerState = "unknown"
	ContainerStateRunning       ContainerState = "running"
	ContainerStateIdleShutdown  ContainerState = "idle_shutdown"
	ContainerStateHealthFailure ContainerState = "health_failure"
)

type FileInfo added in v0.9.8

type FileInfo struct {
	Name  string
	Size  int64
	IsDir bool
	Mode  int
}

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, 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