app

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: ISC Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StableLabel     = "stable"
	PrevStableLabel = "last_stable"

	StatusRunning = "running"
	StatusReady   = "ready"
	StatusPending = "pending"

	RequestFieldStatus = "status"

	// MaxTeamLength model team max length
	MaxTeamLength = 32
	// MaxProjectLength model project max length
	MaxProjectLength = 32
	// MaxModelNameLength model name max length
	MaxModelNameLength = 32

	ComponentServing   = "SERVING"
	ComponentStorage   = "STORAGE"
	ComponentLock      = "LOCK"
	ComponentDiscovery = "DISCOVERY"
	ComponentMetadata  = "METADATA"
	ComponentService   = "SERVICE"
	ComponentRest      = "REST"
	ComponentAPP       = "APP"
)

Variables

View Source
var (
	ErrCLIUsage error = errors.New("cli usage")
)

Functions

This section is empty.

Types

type AnswerStatusInfo

type AnswerStatusInfo struct {
	ResponseStatus
	ErrorToLog string
	Endpoint   string
}

type Archive

type Archive struct {
	Data []byte
	Name string
}

type Config

type Config struct {
	App       ConfigApp       `yaml:"application"`
	Discovery ConfigDiscovery `yaml:"discovery" group:"Discovery Options"`
	Storage   ConfigStorage   `yaml:"storage" group:"Storage Options"`
	Metadata  ConfigMetadata  `yaml:"metadata" group:"Metadata Options"`
}

Config holds all configuration parameters

func NewConfig

func NewConfig() *Config

NewConfig creates unfilled config

func NewConfigCLI

func NewConfigCLI(ctx context.Context) (*Config, error)

NewConfigCLI loads configuration parameters from command-line

func NewConfigDefaults

func NewConfigDefaults(ctx context.Context) (*Config, error)

NewConfigDefaults loads configuration parameters from defaults

func NewConfigENV

func NewConfigENV(ctx context.Context, prefix string) (*Config, error)

NewConfigENV loads configuration parameters from enviroment

func NewConfigYAML

func NewConfigYAML(ctx context.Context, file string) (*Config, error)

NewConfigYAML loads configuration parameters from YAML file

func (*Config) Validate

func (c *Config) Validate(ctx context.Context) error

Validate validates configuration parameters

type ConfigApp

type ConfigApp struct {
	ConfigFile                      *string `envconfig:"TFD_CONFIG_FILE" long:"config_file" description:"Path to the config file" default-mask:"not set"` // core parameter
	ListenHost                      *string ``                                                                                                            /* 146-byte string literal not displayed */
	ListenPort                      *uint16 ``                                                                                                            /* 126-byte string literal not displayed */
	ReloadIntervalInSec             *int    ``                                                                                                            /* 252-byte string literal not displayed */
	MaxAutoReloadDurationInSec      *int    ``                                                                                                            /* 213-byte string literal not displayed */
	UploadTimeoutInSec              *int    ``                                                                                                            /* 204-byte string literal not displayed */
	DefaultModelLabel               *string ``                                                                                                            /* 161-byte string literal not displayed */
	AllowLabelsForUnavailableModels *bool   ``                                                                                                            /* 289-byte string literal not displayed */
	Discovery                       *string ``                                                                                                            /* 230-byte string literal not displayed */
	Storage                         *string ``                                                                                                            /* 220-byte string literal not displayed */
	Metadata                        *string ``                                                                                                            /* 205-byte string literal not displayed */
}

ConfigApp holds configuration parameters common to the application

func (*ConfigApp) Listen

func (a *ConfigApp) Listen() string

Listen returns joined host with port

type ConfigDiscovery

type ConfigDiscovery struct {
	Plaintext ConfigDiscoveryPlaintext `yaml:"plaintext" group:"Plaintext Discovery Options"`
	DNS       ConfigDiscoveryDNS       `yaml:"dns" group:"DNS Discovery Options"`
}

ConfigDiscovery holds discovery package configuration parameters

type ConfigDiscoveryDNS

type ConfigDiscoveryDNS struct {
	ServiceSuffix *string `` // allowed empty string
	/* 202-byte string literal not displayed */
	DefaultInstancePort *uint16 `` /* 263-byte string literal not displayed */
}

ConfigDiscoveryDNS holds DNS package configuration parameters

type ConfigDiscoveryPlaintext

type ConfigDiscoveryPlaintext struct {
	HostsPath *string `` /* 232-byte string literal not displayed */
}

ConfigDiscoveryPlaintext holds Plaintext package configuration parameters

type ConfigMetadata

type ConfigMetadata struct {
	SQLDB ConfigMetadataSQLDB `yaml:"sqldb" group:"SQLDB Metadata Options"`
}

ConfigMetadata holds metadata package configuration parameters

type ConfigMetadataSQLDB

type ConfigMetadataSQLDB struct {
	Driver *string `` /* 189-byte string literal not displayed */
	DSN    *string `` /* 277-byte string literal not displayed */
}

ConfigMetadataSQLDB holds sqldb package configuration parameters

type ConfigStorage

type ConfigStorage struct {
	Filesystem ConfigStorageFilesystem `yaml:"filesystem" group:"Filesystem Storage Options"`
}

ConfigStorage holds storage package configuration parameters

type ConfigStorageFilesystem

type ConfigStorageFilesystem struct {
	Base   ConfigStorageFilesystemBase   `yaml:"base"`
	Model  ConfigStorageFilesystemModel  `yaml:"model"`
	Module ConfigStorageFilesystemModule `yaml:"module"`
}

ConfigStorageFilesystem holds filesystem configuration parameters

func (ConfigStorageFilesystem) ConvertPerms

func (ConfigStorageFilesystem) ConvertPerms(perms string) (os.FileMode, error)

ConvertPerms converts string permission to FileMode

type ConfigStorageFilesystemBase

type ConfigStorageFilesystemBase struct {
	BasePath *string `` /* 257-byte string literal not displayed */
}

type ConfigStorageFilesystemModel

type ConfigStorageFilesystemModel struct {
	ArchiveName          *string `` /* 212-byte string literal not displayed */
	BasePath             *string `` /* 213-byte string literal not displayed */
	ConfigName           *string `` /* 205-byte string literal not displayed */
	EmptyConfigName      *string `` /* 219-byte string literal not displayed */
	IncomingArchivePath  *string `` /* 277-byte string literal not displayed */
	DirectoryPermissions *string `` /* 236-byte string literal not displayed */
	FilePermissions      *string `` /* 216-byte string literal not displayed */
}

ConfigStorageFilesystemModel holds model configuration parameters

type ConfigStorageFilesystemModule

type ConfigStorageFilesystemModule struct {
	ArchiveName          *string `` /* 217-byte string literal not displayed */
	BasePath             *string `` /* 218-byte string literal not displayed */
	IncomingArchivePath  *string `` /* 282-byte string literal not displayed */
	DirectoryPermissions *string `` /* 239-byte string literal not displayed */
	FilePermissions      *string `` /* 219-byte string literal not displayed */
}

ConfigStorageFilesystemModule holds module configuration parameters

type ErrorBody

type ErrorBody struct {
	Error ErrorDetails `json:"error_details"`
}

type ErrorDetails

type ErrorDetails struct {
	ErrorCode    string `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type LabelChanged

type LabelChanged struct {
	ServableID
	Label string

	PreviousVersion int64
	NewVersion      int64
}

type ModelData

type ModelData struct {
	ModelID
	ID      int64  `json:"id"`
	Status  string `json:"status"`
	Created string `json:"created,omitempty"`
	Updated string `json:"updated,omitempty"`
}

ModelData

type ModelID

type ModelID struct {
	ServableID
	Version int64  `json:"version"`
	Label   string `json:"label,omitempty"`
}

ModelID is struct to simply hold basic informations using in most application endpoints and functions

func (ModelID) IsVersionSet

func (m ModelID) IsVersionSet() bool

IsVersionSet checks if version is set

type ModuleData

type ModuleData struct {
	ModuleID
	ID      int64  `json:"id"`
	Created string `json:"created,omitempty"`
	Updated string `json:"updated,omitempty"`
}

ModuleData

type ModuleID

type ModuleID struct {
	ServableID
	Version int64 `json:"version"`
}

ModuleID is struct to simply hold basic informations using in most application endpoints and functions

func (ModuleID) IsVersionSet

func (m ModuleID) IsVersionSet() bool

IsVersionSet checks if version is set

type QueryParameters

type QueryParameters map[string]interface{}

QueryParameters

type ReloadResponse

type ReloadResponse struct {
}

type Response

type Response struct {
	ResponseStatus
	ResponseData interface{} `json:"output"`
}

type ResponseModel

type ResponseModel struct {
	Model   string `json:"model"`
	Label   string `json:"label"`
	Version int64  `json:"version"`
}

type ResponseModule

type ResponseModule struct {
	Module  string `json:"module"`
	Version int64  `json:"version"`
}

type ResponseStatus

type ResponseStatus struct {
	Code              int       `json:"code"`
	Status            string    `json:"status"`
	Error             string    `json:"error"`
	InstanceErrorList *[]string `json:"errorinstancelist,omitempty"`
}

type ServableID

type ServableID struct {
	Team    string `json:"team"`
	Project string `json:"project"`
	Name    string `json:"name"`
}

func (ServableID) ArchiveName

func (s ServableID) ArchiveName(prefix string, version int64) string

func (ServableID) InstanceHost

func (s ServableID) InstanceHost(suffix string) string

func (ServableID) InstanceName

func (s ServableID) InstanceName() string

type ServableInstances

type ServableInstances struct {
	ServableID
	Instances []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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