defs

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The prefix for all configuration keys reserved to Ego.
	PrivilegedKeyPrefix = "ego."

	// File system location used to locate services, lib,
	// and test directories.
	EgoPathSetting = PrivilegedKeyPrefix + "runtime.path"

	// Do we normalize the case of all symbols to a common
	// (lower) case string. If not true, symbol names are
	// case-sensitive.
	CaseNormalizedSetting = PrivilegedKeyPrefix + "compiler.normalized"

	// What is the output format that should be used by
	// default for operations that could return either
	// "text" , "indented", or "json" output.
	OutputFormatSetting = PrivilegedKeyPrefix + "console.format"

	// ConsoleHistorySetting is the name of the readline console history
	// file. This contains a line of text for each command previously read
	// using readline. If not specified in the profile, a default is used.
	ConsoleHistorySetting = PrivilegedKeyPrefix + "console.history"

	// If true, the script language includes language
	// extensions such as print, call, try/catch.
	ExtensionsEnabledSetting = PrivilegedKeyPrefix + "compiler.extensions"

	// Should an interactive session automatically import
	// all the pre-defined packages?
	AutoImportSetting = PrivilegedKeyPrefix + "compiler.import"

	// Should the interactive RUN mode exit when the user
	// enters a blank line on the console?
	ExitOnBlankSetting = PrivilegedKeyPrefix + "console.exit.on.blank"

	// Should the copyright message be omitted when in
	// interactive prompt mode?
	NoCopyrightSetting = PrivilegedKeyPrefix + "console.no.copyright"

	// Should the interactive command input processor use
	// readline?
	UseReadline = PrivilegedKeyPrefix + "console.readline"

	// Set to true if the full stack should be listed during
	// tracing.
	FullStackListingSetting = PrivilegedKeyPrefix + "compiler.full.stack"

	// Should the bytecode generator attempt an optimization pass?
	OptimizerSetting = PrivilegedKeyPrefix + "compiler.optimize"

	// Should the Ego program(s) be run with "strict" or
	// "dynamic" typing? The default is "dynamic".
	StaticTypesSetting = PrivilegedKeyPrefix + "compiler.types"

	// The base URL of the Ego server providing application services. This
	// is normally the same as the logon server, but may be set differently
	// if the logon services are hosted on a different server.
	ApplicationServerSetting = PrivilegedKeyPrefix + "application.server"

	// The base URL of the Ego server providing logon services.
	LogonServerSetting = PrivilegedKeyPrefix + "logon.server"

	// The last token created by a ego logon command, which
	// is used by default for server admin commands as well
	// as rest calls.
	LogonTokenSetting = PrivilegedKeyPrefix + "logon.token"

	// Stores the expiration date from the last login. This can be
	// used to detect an expired token and provide a better message
	// to the client user than "not authorized".
	LogonTokenExpirationSetting = PrivilegedKeyPrefix + "logon.token.expiration"

	// The default user if no userdatabase has been initialized
	// yet. This is a strong of the form "user:password", which
	// is defined as the root user.
	DefaultCredentialSetting = PrivilegedKeyPrefix + "server.default-credential"

	// If present, this user is always assigned super-user (root)
	// privileges regardless of the userdata settings. This can be
	// used to access an encrypted user data file.
	LogonSuperuserSetting = PrivilegedKeyPrefix + "server.superuser"

	// The file system location where the user database is stored.
	LogonUserdataSetting = PrivilegedKeyPrefix + "server.userdata"

	// The encryption key for the userdata file. If not present,
	// the file is not encrypted and is readable json.
	LogonUserdataKeySetting = PrivilegedKeyPrefix + "server.userdata.key"

	// The URL path for the tables database functionality.
	TablesServerDatabase = PrivilegedKeyPrefix + "server.database.url"

	// The user:password credentials to use with the local tables database.
	TablesServerDatabaseCredentials = PrivilegedKeyPrefix + "server.database.credentials"

	// The name of the tables database in the local database store (schemas
	// are used to partition this database by Ego username).
	TablesServerDatabaseName = PrivilegedKeyPrefix + "server.database.name"

	// Boolean indicating if the communication with the tables database
	// should be done using SSL secured communications.
	TablesServerDatabaseSSLMode = PrivilegedKeyPrefix + "server.database.ssl"

	// The URL path for the tables database functionality.
	TablesServerEmptyFilterError = PrivilegedKeyPrefix + "server.database.empty.filter.error"

	// The URL path for the tables database functionality.
	TablesServerEmptyRowsetError = PrivilegedKeyPrefix + "server.database.empty.rowset.error"

	// If true, the insert of a row _must_ specify all values in the table.
	TableServerPartialInsertError = PrivilegedKeyPrefix + "server.database.partial.insert.error"

	// The key string used to encrypt authentication tokens.
	ServerTokenKeySetting = PrivilegedKeyPrefix + "server.token.key"

	// A string indicating the duration of a token before it is
	// considered expired. Examples are "15m" or "24h".
	ServerTokenExpirationSetting = PrivilegedKeyPrefix + "server.token.expiration"

	// A string indicating the default logging to be assigned to a server that is
	// started without an explicit --log setting.
	ServerDefaultLogSetting = PrivilegedKeyPrefix + "server.default.logging"

	// How many old logs do we maintain by default when in server mode?
	LogRetainCountSetting = PrivilegedKeyPrefix + "server.retain.log.count"

	// If true, the util.Exec() function can be executed to run an arbitrary
	// native shell command. This defaults to being disabled.
	ExecPermittedSetting = PrivilegedKeyPrefix + "runtime.exec"

	// Default allocation factor to set on symbol table create/expand
	// operations. Larger numbers are more efficient for larger symbol
	// tables, but too large a number wastes time and memory.
	SymbolTableAllocationSetting = PrivilegedKeyPrefix + "runtime.symbol.allocation"

	// If true, functions that return multiple values including an
	// error that do not assign that error to a value will result in
	// the error being thrown.
	ThrowUncheckedErrorsSetting = PrivilegedKeyPrefix + "runtime.unchecked.errors"

	// If true, then an error with a message string that starts with "!" will
	// cause an actual go panic abend.
	RuntimePanicsSetting = PrivilegedKeyPrefix + "runtime.panics"

	// If true, the TRACE operation will print the full stack instead of
	// a shorter single-line version.
	FullStackTraceSetting = PrivilegedKeyPrefix + "runtime.stack.trace"

	// If specified, has the Go-style format string to be used for log
	// messages showing the time of the event.
	LogTimestampFormat = PrivilegedKeyPrefix + "log.timestamp"

	// If specified, all filename references in ego programs (such as the
	// ReadFile() function) must start with this path, or it will be prefixed
	// with this path. This lets you limit where/how the files can be managed
	// by an ego program. This is especially important in server mode.
	SandboxPathSetting = PrivilegedKeyPrefix + "sandbox.path"

	// PidDirectorySettings has the path used to store and find PID files for
	// server invocations and management.
	PidDirectorySetting = PrivilegedKeyPrefix + "server.piddir"

	// If true, the default state for staring an Ego is to not require HTTPS/SSL
	// but rather run in "insecure" mode.
	InsecureServerSetting = PrivilegedKeyPrefix + "server.insecure"

	// Maximum cache size for server cache. The default is zero, no caching
	// performed.
	MaxCacheSizeSetting = PrivilegedKeyPrefix + "server.cache.size"

	// Do we automatically process non-success ErrorResponse payloads from
	// client REST calls as if they were the return code value? Default is
	// true.
	RestClientErrorSetting = PrivilegedKeyPrefix + "runtime.rest.errors"
)

This section describes the profile keys used by Ego.

View Source
const (
	AutoImportOption      = "auto-import"
	DisassembleOption     = "disassemble"
	FullSymbolScopeOption = "full-symbol-scope"
	TypingOption          = "types"
	SymbolTableSizeOption = "symbol-allocation"
	OptimizerOption       = "optimize"
)

This section contains the names of the command-line options. These often (but not always) have parallels in the settings above. Settings typically have a structured name (ego.compiler.autoimport) while the option name is Unix shell-friendly (auto-import).

View Source
const (
	AdminAgent  = "admin"
	ClientAgent = "rest client"
	LogonAgent  = "logon"
	StatusAgent = "status"
	TableAgent  = "tables"
)

Agent identifiers for REST calls, which indicate the role of the client.

View Source
const (
	True    = "true"
	False   = "false"
	Any     = "any"
	Strict  = "strict"
	Loose   = "relaxed"
	Dynamic = "dynamic"
	Main    = "main"
)
View Source
const (
	ByteCodeReflectionTypeString = "<*bytecode.ByteCode Value>"

	TypeCheckingVariable   = InvisiblePrefix + "type_checking"
	StrictTypeEnforcement  = 0
	RelaxedTypeEnforcement = 1
	NoTypeEnforcement      = 2

	InvisiblePrefix          = "__"
	ThisVariable             = InvisiblePrefix + "this"
	MainVariable             = InvisiblePrefix + "main"
	ErrorVariable            = InvisiblePrefix + "error"
	ArgumentListVariable     = InvisiblePrefix + "args"
	CLIArgumentListVariable  = InvisiblePrefix + "cli_args"
	ModeVariable             = InvisiblePrefix + "exec_mode"
	DebugServicePathVariable = InvisiblePrefix + "debug_service_path"
	PathsVariable            = InvisiblePrefix + "paths"
	LocalizationVariable     = InvisiblePrefix + "localization"
	LineVariable             = InvisiblePrefix + "line"
	ModuleVariable           = InvisiblePrefix + "module"
	RestStatusVariable       = InvisiblePrefix + "rest_status"
	DiscardedVariable        = "_"
	ReadonlyVariablePrefix   = "_"
	VersionName              = ReadonlyVariablePrefix + "version"
	CopyrightVariable        = ReadonlyVariablePrefix + "copyright"
	InstanceUUIDVariable     = ReadonlyVariablePrefix + "server_instance"
	BuildTimeVariable        = ReadonlyVariablePrefix + "buildtime"
	PlatformVariable         = ReadonlyVariablePrefix + "platform"
)
View Source
const (
	TableParameterName    = "table"
	SchemaParameterName   = "schema"
	UserParameterName     = "user"
	ColumnParameterName   = "columns"
	FilterParameterName   = "filter"
	SortParameterName     = "sort"
	StartParameterName    = "start"
	LimitParameterName    = "limit"
	RowCountParameterName = "rowcounts"
	AbstractParameterName = "abstract"
)
View Source
const (
	AdminCachesPath           = "/admin/caches"
	AdminHeartbeatPath        = "/admin/heartbeat"
	AdminLoggersPath          = "/admin/loggers/"
	AdminUsersPath            = "/admin/users/"
	AdminUsersNamePath        = AdminUsersPath + "%s"
	AssetsPath                = "/assets/"
	CodePath                  = "/code"
	ServicesPath              = "/services/"
	ServicesLogonPath         = ServicesPath + "admin/logon/"
	ServicesUpPath            = ServicesPath + "up/"
	TablesPath                = "/tables/"
	TablesNamePath            = TablesPath + "%s"
	TablesRowsPath            = TablesNamePath + "/rows"
	TablesSQLPath             = TablesPath + "@sql"
	TablesPermissionsPath     = TablesPath + "@permissions"
	TablesNamePermissionsPath = TablesNamePath + "/permissions"
)
View Source
const (
	TextMediaType = "application/text"
	JSONMediaType = "application/json"
	HTMLMediaType = "application/html"

	EgoMediaType            = "application/vnd.ego."
	SQLStatementsMediaType  = EgoMediaType + "sql+json"
	RowSetMediaType         = EgoMediaType + "rows+json"
	AbstractRowSetMediaType = EgoMediaType + "rows.abstract+json"
	RowCountMediaType       = EgoMediaType + "rowcount+json"
	TableMetadataMediaType  = EgoMediaType + "columns+json"
	TablesMediaType         = EgoMediaType + "tables+json"
	ErrorMediaType          = EgoMediaType + "error+json"
	UserMediaType           = EgoMediaType + "user+json"
	UsersMediaType          = EgoMediaType + "users+json"
	LogStatusMediaType      = EgoMediaType + "log.status+json"
	LogLinesMediaType       = EgoMediaType + "log.lines+json"
	CacheMediaType          = EgoMediaType + "cache+json"
)
View Source
const (
	UserAuthenticationRequired  = "user"
	TokenRequired               = "token"
	AdminAuthneticationRequired = "admin"
	AdminTokenRequired          = "admintoken"
)
View Source
const (
	APIVersion = 1
)
View Source
const Anon = "<anon>"

This is the name for objects that otherwise have no name.

View Source
const AuthScheme = "bearer "

The authorization scheme attached to the bearer token in REST calls.

View Source
const DefaultUserdataFileName = "sqlite3://users.db"

DefaultUserdataFileName is the default file system name of the user database file, if not specified by the user.

View Source
const EgoDefaultLogFileName = "EGO_LOG_FILE"

The environment variable that contains the name to use for writing log file messages. If not specified, defaults to writing to stdout.

View Source
const EgoDefaultLogging = "EGO_DEFAULT_LOGGING"

The environment variable that contains the name(s) of the loggers that are to be enabled by default at startup (before command line processing).

View Source
const EgoFilenameExtension = ".ego"

The file extension for Ego programs".

View Source
const EgoLogEnv = "EGO_LOG"

The environment variable that contains the path to which the log file is written.

View Source
const EgoPathEnv = "EGO_PATH"

The environment variable that defines where the runtime files are to be found.

View Source
const LibPathName = "lib"

The subdirectory in "EGO_PATH" where the .ego runtime files and assets are found.

View Source
const LocalHost = "localhost"

Name of the default local host, in TCP/IP standards.

View Source
const RowIDName = "_row_id_"

This is the name of a column automatically added to tables created using the 'tables' REST API.

Variables

View Source
var ServerInstanceID string

ServerInstanceID is the UUID of the current Server Instance.

View Source
var TableColumnTypeNames []string = []string{
	"int",
	"int32",
	"int64",
	"string",
	"float",
	"double",
	"float32",
	"float64",
	"time",
	"timestamp",
	"date",
	"bool",
}

ValidSettings describes the list of valid settings, and whether they can be set by the command line.

Functions

This section is empty.

Types

type AllPermissionResponse

type AllPermissionResponse struct {
	ServerInfo  `json:"server"`
	Permissions []PermissionObject `json:"permissions"`
	Count       int                `json:"count"`
}

type BaseCollection

type BaseCollection struct {
	ServerInfo `json:"server"`
	Count      int `json:"count"`
	Start      int `json:"start"`
}

BaseCollection is a component of any collection type returned as a response.

type CacheResponse

type CacheResponse struct {
	ServerInfo `json:"server"`
	Count      int          `json:"count"`
	Limit      int          `json:"limit"`
	Items      []CachedItem `json:"items"`
	AssetCount int          `json:"assets"`
	AssetSize  int          `json:"assetSize"`
}

CacheResponse describes the response object returned from the /admin/caches endpoint.

type CachedItem

type CachedItem struct {
	Name     string    `json:"name"`
	LastUsed time.Time `json:"last"`
	Count    int       `json:"count"`
}

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type DBAbstractRowSet

type DBAbstractRowSet struct {
	ServerInfo `json:"server"`
	Columns    []string        `json:"columns"`
	Rows       [][]interface{} `json:"rows"`
	Count      int             `json:"count"`
}

type DBColumn

type DBColumn struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Size     int    `json:"size,omitempty"`
	Nullable bool   `json:"nullable,omitempty"`
	Unique   bool   `json:"unique,omitempty"`
}

type DBRowCount

type DBRowCount struct {
	ServerInfo `json:"server"`
	Count      int `json:"count"`
}

type DBRowSet

type DBRowSet struct {
	ServerInfo `json:"server"`
	Rows       []map[string]interface{} `json:"rows"`
	Count      int                      `json:"count"`
}

type LogTextResponse

type LogTextResponse struct {
	ServerInfo `json:"server"`
	Lines      []string `json:"lines"`
}

type LoggingItem

type LoggingItem struct {
	Filename    string          `json:"file,omitempty"`
	RetainCount int             `json:"keep"`
	Loggers     map[string]bool `json:"loggers,omitempty"`
}

type LoggingResponse

type LoggingResponse struct {
	ServerInfo `json:"server"`
	LoggingItem
}

type LogonResponse

type LogonResponse struct {
	ServerInfo `json:"server"`
	Expiration string `json:"expires"`
	Token      string `json:"token"`
	Identity   string `json:"identity"`
}

LogonResponse is the info returned from a logon request.

type PermissionObject

type PermissionObject struct {
	User        string   `json:"user"`
	Schema      string   `json:"schema"`
	Table       string   `json:"table"`
	Permissions []string `json:"permissions"`
}

type RemoteStatusResponse

type RemoteStatusResponse struct {
	ServerInfo `json:"server"`
	Version    string `json:"version"`
	Pid        int    `json:"pid"`
	Since      string `json:"since"`
}

The payload for the status check "/up" endpoint.

type RestStatusResponse

type RestStatusResponse struct {
	ServerInfo `json:"server"`
	Status     int    `json:"status"`
	Message    string `json:"msg"`
}

RestStatusResponse describes the HTTP status result and any helpful additional message. This must be part of all response objects.

type ServerInfo

type ServerInfo struct {
	Version  int    `json:"api,omitempty"`
	Hostname string `json:"name,omitempty"`
	ID       string `json:"id,omitempty"`
	Session  int    `json:"session,omitempty"`
}

type ServerStatus

type ServerStatus struct {
	ServerInfo `json:"server"`
	Version    string    `json:"version"`
	PID        int       `json:"pid"`
	Started    time.Time `json:"started"`
	LogID      uuid.UUID `json:"logID"`
	Args       []string  `json:"args"`
}

ServerStatus describes the state of a running server. A json version of this information is the contents of the pid file.

type Table

type Table struct {
	Name        string `json:"name"`
	Schema      string `json:"schema,omitempty"`
	Columns     int    `json:"columns"`
	Rows        int    `json:"rows"`
	Description string `json:"description,omitempty"`
}

type TableColumnsInfo

type TableColumnsInfo struct {
	ServerInfo `json:"server"`
	Columns    []DBColumn `json:"columns"`
	Count      int        `json:"count"`
}

type TableInfo

type TableInfo struct {
	ServerInfo `json:"server"`
	Tables     []Table `json:"tables"`
	Count      int     `json:"count"`
}

type User

type User struct {
	Name        string    `json:"name"`
	ID          uuid.UUID `json:"id,omitempty"`
	Password    string    `json:"password,omitempty"`
	Permissions []string  `json:"permissions,omitempty"`
}

User describbes a single user in the user database. The password field must be removed from response objects.

type UserCollection

type UserCollection struct {
	BaseCollection
	Items []User `json:"items"`
}

UserCollection is a collection of User response objects.

Jump to

Keyboard shortcuts

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