resolver-go/internal/compilecache/types.go
raw ยท 530 bytes
package compilecache
import (
"context"
"sync"
)
type State int
const (
Missing State = iota
Pending
Ready
Failed
)
type Job struct {
Hash string
Mode string
Payload any
}
type Compiler interface {
Compile(ctx context.Context, job Job) ([]byte, error)
}
type Cache struct {
compiler Compiler
disableCache bool
mu sync.Mutex
states map[string]State
results map[string][]byte
errors map[string]error
jobs chan Job
}
type Options struct {
Workers int
QueueSize int
DisableCache bool
}