Documentation
¶
Index ¶
- Constants
- Variables
- func GetDefaultRuntimeVersion(name string) string
- type DepChanges
- type EnvChanges
- type Manager
- func (m *Manager) Clean() error
- func (m *Manager) GetChanges() (*StateChanges, error)
- func (m *Manager) GetDepChanges() (*DepChanges, error)
- func (m *Manager) GetEnvChanges(envFile string) (*EnvChanges, error)
- func (m *Manager) GetProgInfo() (*ProgInfo, error)
- func (m *Manager) GetRuntime() (*Runtime, error)
- func (m *Manager) GetUserInfo() (*UserInfo, error)
- func (m *Manager) IsInitialized() (bool, error)
- func (m *Manager) IsProgDirEmpty() (bool, error)
- func (m *Manager) StoreProgInfo(p *ProgInfo) error
- func (m *Manager) StoreState() error
- func (m *Manager) StoreUserInfo(u *UserInfo) error
- func (m *Manager) WriteProgramFiles(zipFile []byte, targetDir *string, relative bool, runtimeVersion string) error
- type Pattern
- type ProgInfo
- type Runtime
- type StateChanges
- type UserInfo
Constants ¶
const ( SPACE = " " NEGATION = '!' PythonSkipPattern = `(.*\.pyc)|(.*\.rst)|(__pycache__)|(.*~$)|(.*\.deta)|(^.*env$)|(^.*venv$)` NodeSkipPattern = `(node_modules)|(.*~$)|(.*\.deta)` Python = "python" Node = "node" // DefaultProject default project slug DefaultProject = "default" )
Variables ¶
var ( // DepCommands maps runtimes to the dependency managers DepCommands = map[string]string{ Python: "pip", Node: "npm", } // ErrNoEntrypoint noe entrypoint file present ErrNoEntrypoint = errors.New("no entrypoint file present") // ErrEntrypointConflict conflicting entrypoint files ErrEntrypointConflict = errors.New("conflicting entrypoint files present") )
Functions ¶
func GetDefaultRuntimeVersion ¶
GetDefaultRuntimeVersion returns default runtime version
Types ¶
type DepChanges ¶
DepChanges changes in dependencies
type EnvChanges ¶
EnvChanges changes in env vars keys
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager runtime manager handles files management and other services
func NewManager ¶
NewManager returns a new runtime manager for the root dir of the program if initDirs is true, it creates dirs under root
func (*Manager) GetChanges ¶
func (m *Manager) GetChanges() (*StateChanges, error)
GetChanges checks if the state has changed in the root directory
func (*Manager) GetDepChanges ¶
func (m *Manager) GetDepChanges() (*DepChanges, error)
GetDepChanges gets dependencies from program
func (*Manager) GetEnvChanges ¶
func (m *Manager) GetEnvChanges(envFile string) (*EnvChanges, error)
GetEnvChanges gets changes in stored env keys and keys of the envFile
func (*Manager) GetProgInfo ¶
GetProgInfo gets the program info stored
func (*Manager) GetRuntime ¶
GetRuntime gets runtime from proginfo or figures out the runtime of the program from entrypoint file if present in the root dir
func (*Manager) GetUserInfo ¶
GetUserInfo gets the user info
func (*Manager) IsInitialized ¶
IsInitialized checks if the root directory is initialized as a deta program
func (*Manager) IsProgDirEmpty ¶
IsProgDirEmpty checks if dir contains any files/folders which are not hidden if dir is nil, it sets the root dir
func (*Manager) StoreProgInfo ¶
StoreProgInfo stores program info to disk
func (*Manager) StoreState ¶
StoreState stores hashes of the current state of all files(not hidden) in the root program directory
func (*Manager) StoreUserInfo ¶
StoreUserInfo stores the user info
type ProgInfo ¶
type ProgInfo struct { ID string `json:"id"` Space int64 `json:"space"` Runtime string `json:"runtime"` // runtime version eg: nodejs12.x RuntimeName string `json:"-"` Name string `json:"name"` Path string `json:"path"` Project string `json:"project"` Account string `json:"account"` Region string `json:"region"` Deps []string `json:"deps"` Envs []string `json:"envs"` Public bool `json:"public"` Visor string `json:"log_level"` Cron string `json:"cron"` }
ProgInfo program info
type Runtime ¶
Runtime holds name and version of current runtime used
func CheckRuntime ¶
CheckRuntime checks if given runtime is supported