Start of code growth
This commit is contained in:
30
grow/definition.go
Normal file
30
grow/definition.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import "io"
|
||||
|
||||
import "gopkg.in/yaml.v2"
|
||||
|
||||
type Definition struct {
|
||||
GlobalMemorySize uint64 `yaml:"global_memory_size"`
|
||||
FunctionMemorySize uint64 `yaml:"function_memory_size"`
|
||||
Samples []*Sample `yaml:"samples"`
|
||||
}
|
||||
|
||||
type Sample struct {
|
||||
GlobalMemoryInputs map[uint64]uint64 `yaml:"global_memory_inputs"`
|
||||
GlobalMemoryOutputs map[uint64]uint64 `yaml:"global_memory_outputs"`
|
||||
}
|
||||
|
||||
func loadDefinition(r io.Reader) (*Definition, error) {
|
||||
dec := yaml.NewDecoder(r)
|
||||
dec.SetStrict(true)
|
||||
|
||||
def := &Definition{}
|
||||
|
||||
err := dec.Decode(def)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return def, nil
|
||||
}
|
||||
Reference in New Issue
Block a user