Documentation
¶
Overview ¶
Package driver implements the out-of-process JSON/NDJSON subject driver client backed by the containment supervisor.
Index ¶
Constants ¶
const HandshakeFlag = "--docpresser-handshake"
HandshakeFlag is the argument that asks a driver to describe itself.
const ProtocolVersion = "docpresser-driver/v0"
ProtocolVersion identifies the Wave 1 stdin/stdout driver wire contract.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Name string
Role string
Command string
Args []string
DriverSHA256 string
// contains filtered or unexported fields
}
Client invokes an out-of-process subject driver under containment supervision.
func NewClient ¶
NewClient constructs a subject driver client from a specification string "name=command [args...]" and role ("target" or "baseline").
func (*Client) ExecuteCase ¶
func (c *Client) ExecuteCase(ctx context.Context, pc model.PackCase, inputBytes []byte) (model.Observation, error)
ExecuteCase runs a single PackCase against the subject driver inside the containment supervisor.
func (*Client) Handshake ¶ added in v0.2.0
Handshake runs the driver once with HandshakeFlag (appended after its own arguments) under containment and records the identity it reports. It fails on any timeout, crash, oversized or malformed reply, wrong protocol version, or empty identity field; there is no placeholder fallback.
type Handshake ¶ added in v0.2.0
type Handshake struct {
Version string `json:"version"`
Subject string `json:"subject"`
SubjectVersion string `json:"subject_version"`
Language string `json:"language"`
Engine string `json:"engine"`
Formats []string `json:"formats"`
Operations []string `json:"operations"`
}
Handshake is the single JSON object a driver prints for HandshakeFlag.
type Request ¶
type Request struct {
Version string `json:"version"`
CaseID string `json:"case_id"`
Format string `json:"format"`
Operation string `json:"operation"`
Profile string `json:"profile,omitempty"`
InputBase64 string `json:"input_base64"`
Budgets *model.CaseBudgets `json:"budgets,omitempty"`
}
Request is sent as a single JSON line on stdin to a subject driver.
type Response ¶
type Response struct {
Version string `json:"version"`
CaseID string `json:"case_id"`
Subject string `json:"subject,omitempty"`
SubjectVersion string `json:"subject_version,omitempty"`
Status string `json:"status"`
OutputSHA256 string `json:"output_sha256,omitempty"`
OutputBytes int64 `json:"output_bytes,omitempty"`
DocumentCount int `json:"document_count,omitempty"`
EventCount int `json:"event_count,omitempty"`
CanonicalValue string `json:"canonical_value,omitempty"`
ErrorPhase string `json:"error_phase,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
ParseNs int64 `json:"parse_ns,omitempty"`
EmitNs int64 `json:"emit_ns,omitempty"`
HazardsFound []string `json:"hazards_found,omitempty"`
}
Response is emitted as a single JSON line on stdout by a subject driver.