2023-04-02 11:11:09 +02:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
2023-04-13 01:38:33 +02:00
|
|
|
"context"
|
|
|
|
|
2023-04-14 10:59:37 +02:00
|
|
|
"git.defalsify.org/vise/cache"
|
|
|
|
"git.defalsify.org/vise/resource"
|
|
|
|
"git.defalsify.org/vise/state"
|
2023-04-02 11:11:09 +02:00
|
|
|
)
|
|
|
|
|
2023-04-12 19:04:36 +02:00
|
|
|
// NewDefaultEngine is a convenience function to instantiate a filesystem-backed engine with no output constraints.
|
2023-04-16 13:15:57 +02:00
|
|
|
func NewDefaultEngine(dir string) Engine {
|
2023-04-02 11:11:09 +02:00
|
|
|
st := state.NewState(0)
|
|
|
|
rs := resource.NewFsResource(dir)
|
2023-04-09 11:16:41 +02:00
|
|
|
ca := cache.NewCache()
|
2023-04-13 01:38:33 +02:00
|
|
|
cfg := Config{
|
|
|
|
Root: "root",
|
|
|
|
}
|
|
|
|
ctx := context.TODO()
|
|
|
|
return NewEngine(cfg, &st, &rs, ca, ctx)
|
2023-04-10 17:12:22 +02:00
|
|
|
}
|
|
|
|
|
2023-04-12 19:04:36 +02:00
|
|
|
// NewSizedEngine is a convenience function to instantiate a filesystem-backed engine with a specified output constraint.
|
2023-04-16 13:15:57 +02:00
|
|
|
func NewSizedEngine(dir string, size uint32) Engine {
|
2023-04-10 17:12:22 +02:00
|
|
|
st := state.NewState(0)
|
|
|
|
rs := resource.NewFsResource(dir)
|
|
|
|
ca := cache.NewCache()
|
|
|
|
cfg := Config{
|
|
|
|
OutputSize: size,
|
2023-04-13 01:38:33 +02:00
|
|
|
Root: "root",
|
2023-04-10 17:12:22 +02:00
|
|
|
}
|
2023-04-13 01:38:33 +02:00
|
|
|
ctx := context.TODO()
|
|
|
|
return NewEngine(cfg, &st, &rs, ca, ctx)
|
2023-04-02 11:11:09 +02:00
|
|
|
}
|