resolver-go/internal/compilecache/types.go
raw ยท 430 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
mu sync.Mutex
states map[string]State
results map[string][]byte
errors map[string]error
jobs chan Job
}