vise/go/engine/default.go
2023-04-12 18:04:36 +01:00

27 lines
762 B
Go

package engine
import (
"git.defalsify.org/festive/cache"
"git.defalsify.org/festive/resource"
"git.defalsify.org/festive/state"
)
// NewDefaultEngine is a convenience function to instantiate a filesystem-backed engine with no output constraints.
func NewDefaultEngine(dir string) Engine {
st := state.NewState(0)
rs := resource.NewFsResource(dir)
ca := cache.NewCache()
return NewEngine(Config{}, &st, &rs, ca)
}
// NewSizedEngine is a convenience function to instantiate a filesystem-backed engine with a specified output constraint.
func NewSizedEngine(dir string, size uint32) Engine {
st := state.NewState(0)
rs := resource.NewFsResource(dir)
ca := cache.NewCache()
cfg := Config{
OutputSize: size,
}
return NewEngine(cfg, &st, &rs, ca)
}