Documentation ¶
Index ¶
Constants ¶
const ( // CompileVersion is the current version that we're on for // compilation formats. This can be used in the future to change // the directory structure and on-disk format of compiled appfiles. CompileVersion = 1 CompileFilename = "Appfile.compiled" CompileDepsFolder = "deps" CompileImportsFolder = "deps" CompileVersionFilename = "version" )
const (
IDFile = ".ottoid"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { Name string Type string Dependencies []*Dependency `mapstructure:"dependency"` }
Application is the structure of an application definition.
func (*Application) GoString ¶
func (v *Application) GoString() string
type CompileEvent ¶
type CompileEvent interface{}
CompileEvent is a potential event that a Callback can receive during Compilation.
type CompileEventDep ¶
type CompileEventDep struct {
Source string
}
CompileEventDep is the event that is called when a dependency is being loaded.
type CompileEventImport ¶
type CompileEventImport struct {
Source string
}
CompileEventImport is the event that is called when an import statement is being loaded and merged.
type CompileOpts ¶
type CompileOpts struct { // Dir is the directory where all the compiled data will be stored. // For use of Otto with a compiled Appfile, this directory must not // be deleted. Dir string // Detect is the detect configuration that will be used for processing // defaults for the various dependencies. Detect *detect.Config // Callback is an optional way to receive notifications of events // during the compilation process. The CompileEvent argument should be // type switched to determine what it is. Callback func(CompileEvent) }
CompileOpts are the options for compilation.
type Compiled ¶
type Compiled struct { // File is the raw Appfile File *File // Graph is the DAG that has all the dependencies. This is already // verified to have no cycles. Each vertex is a *CompiledGraphVertex. Graph *dag.AcyclicGraph }
Compiled represents a "Compiled" Appfile. A compiled Appfile is one that has loaded all of its dependency Appfiles, completed its imports, verified it is valid, etc.
Appfile compilation is a process that requires network activity and has to occur once. The idea is that after compilation, a fully compiled Appfile can then be loaded in the future without network connectivity. Additionally, since we can assume it is valid, we can load it very quickly.
func Compile ¶
func Compile(f *File, opts *CompileOpts) (*Compiled, error)
Compile compiles an Appfile.
This may require network connectivity if there are imports or non-local dependencies. The repositories that dependencies point to will be fully loaded into the given directory, and the compiled Appfile will be saved there.
LoadCompiled can be used to load a pre-compiled Appfile.
If you have no interest in reloading a compiled Appfile, you can recursively delete the compilation directory after this is completed. Note that certain functions of Otto such as development environments will depend on those directories existing, however.
func LoadCompiled ¶
LoadCompiled loads and verifies a compiled Appfile (*Compiled) from disk.
func (*Compiled) MarshalJSON ¶
func (*Compiled) UnmarshalJSON ¶
type CompiledGraphVertex ¶
type CompiledGraphVertex struct { // File is the raw Appfile that this represents File *File // Dir is the directory of the data root for this dependency. This // is only non-empty for dependencies (the root vertex does not have // this value). Dir string // Don't use this outside of this package. NameValue string }
CompiledGraphVertex is the type of the vertex within the Graph of Compiled.
func (*CompiledGraphVertex) Name ¶
func (v *CompiledGraphVertex) Name() string
type Customization ¶
Customization is the structure of customization stanzas within the Appfile.
func (*Customization) GoString ¶
func (v *Customization) GoString() string
type CustomizationSet ¶
type CustomizationSet struct { // Raw is the raw list of customizations. Raw []*Customization }
CustomizationSet is a struct that maintains a set of customizations from an Appfile and provides helper functions for retrieving and filtering them.
Note: While "set" is in the name, this is not a set in the formal sense of the word, since customizations can be duplicated.
func (*CustomizationSet) Filter ¶
func (s *CustomizationSet) Filter(t string) []*Customization
Filter filters the customizations by the given type and returns only the matching list of customizations.
type Dependency ¶
type Dependency struct {
Source string
}
Dependency is another Appfile that an App depends on
type File ¶
type File struct { // ID is a unique UUID that represents this file. It is generated the // first time on compile. This will be blank until the Appfile is // compiled with Compile. ID string // Path is the path to the root file that was loaded. This might be // empty if the appfile was parsed from an io.Reader. Path string // Source is non-empty for dependencies and will be the raw source // value. This can be used for debugging. Source string Application *Application Project *Project Infrastructure []*Infrastructure Customization *CustomizationSet // Imports is the list of imports that this File made. The imports // are realized during compilation, but this list won't be cleared // in case it wants to be inspected later. Imports []*Import }
File is the structure of a single Appfile.
func Default ¶
Default will generate a default Appfile for the given directory.
The path to the directory must be absolute, since the path is used as a way to determine the name of the application.
func Parse ¶
Parse parses the Appfile from the given io.Reader.
Due to current internal limitations, the entire contents of the io.Reader will be copied into memory first before parsing.
func (*File) ActiveInfrastructure ¶
func (f *File) ActiveInfrastructure() *Infrastructure
ActiveInfrastructure returns the Infrastructure that is being used for this Appfile.
type Foundation ¶
Foundation is the configuration for the fundamental building blocks of the infrastructure.
func (*Foundation) GoString ¶
func (v *Foundation) GoString() string
type Import ¶
type Import struct {
Source string
}
Import is an import request of another Appfile into this one
type Infrastructure ¶
type Infrastructure struct { Name string Type string Flavor string Foundations []*Foundation }
Infrastructure is the structure of defining the infrastructure that an application must run on.
func (*Infrastructure) GoString ¶
func (v *Infrastructure) GoString() string