Documentation ¶
Index ¶
Constants ¶
const ( // MAX_JSON_SIZE is the limit on the size of JSON produced by a single fiddle run. MAX_JSON_SIZE = 100 * 1024 * 1024 MAX_CODE_SIZE = 128 * 1024 DefaultAnimationDuration = 2 // seconds )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BulkRequest ¶
type BulkRequest map[string]*FiddleContext
type BulkResponse ¶
type BulkResponse map[string]*RunResults
type Compile ¶
type Compile struct { Errors string `json:"errors"` Output string `json:"output"` // Compiler output. }
Compile contains the output from compiling the user's fiddle.
type CompileError ¶
CompileError is a single line of compiler error output, along with the line and column that the error occurred at.
type FiddleContext ¶
type FiddleContext struct { Version string `json:"version"` // The version of Skia that fiddle is running. Sources string `json:"sources"` // All the source image ids serialized as a JSON array. Hash string `json:"fiddlehash"` // Can be the fiddle hash or the fiddle name. Code string `json:"code"` Name string `json:"name"` // In a request can be the name to create for this fiddle. Overwrite bool `json:"overwrite"` // In a request, should a name be overwritten if it already exists. Fast bool `json:"fast"` // Fast, don't compile and run if a fiddle with this hash has already been compiled and run. Options Options `json:"options"` }
FiddleContext is the structure we use for expanding the index.html template.
It is also used (without the Hash) as the incoming JSON request to /_/run.
type FiddlerMainResponse ¶
type FiddlerMainResponse struct { State State `json:"state"` Version string `json:"version"` // Skia Git Hash }
FiddlerMainResponse is the JSON that fiddler responds with for a request to "/".
type Options ¶
type Options struct { Width int `json:"width"` Height int `json:"height"` Source int `json:"source"` SourceMipMap bool `json:"source_mipmap"` SRGB bool `json:"srgb"` F16 bool `json:"f16"` TextOnly bool `json:"textOnly"` Animated bool `json:"animated"` Duration float64 `json:"duration"` OffScreen bool `json:"offscreen"` OffScreenWidth int `json:"offscreen_width"` OffScreenHeight int `json:"offscreen_height"` OffScreenSampleCount int `json:"offscreen_sample_count"` OffScreenTexturable bool `json:"offscreen_texturable"` OffScreenMipMap bool `json:"offscreen_mipmap"` }
Options are the users options they can select when running a fiddle that will cause it to produce different output.
If new fields are added make sure to update ComputeHash and go/store.
func (*Options) ComputeHash ¶
ComputeHash calculates the fiddleHash for the given code and options.
It might seem a little odd to have this as a member function of Options, but it's more likely to get updated if Options ever gets changed.
The hash computation is a bit convoluted because it needs to be backward compatible with the original version of fiddle so URLs don't break.
type Output ¶
type Output struct { Raster string `json:"Raster"` Gpu string `json:"Gpu"` Pdf string `json:"Pdf"` Skp string `json:"Skp"` Text string `json:"Text"` AnimatedRaster string `json:"AnimatedRaster"` AnimatedGpu string `json:"AnimatedGpu"` GLInfo string `json:"GLInfo"` }
Output contains the base64 encoded files for each of the output types.
type Result ¶
type Result struct { Errors string `json:"errors"` Compile Compile `json:"compile"` Execute Execute `json:"execute"` }
Result is the JSON output format from fiddle_run.
type RunResults ¶
type RunResults struct { CompileErrors []CompileError `json:"compile_errors"` RunTimeError string `json:"runtime_error"` FiddleHash string `json:"fiddleHash"` Text string `json:"text"` }
RunResults is the results we serialize to JSON as the results from a run.