Documentation
Table of Contents

Interface ITarget

Namespace
IntentSharp.Targets
Assembly
IntentSharp.dll

Connects one technology to IntentSharp: a database, a document store, a GIS service, a REST API or anything else a model may plan commands for. A target describes what it holds, inspects a command the model planned, and executes a command that passed the guardrail check. TargetRuntime runs the rest: it senses the target, plans a command with the model, checks it against the rule files and executes it. The library never builds a command, binds a parameter, opens a transaction or converts a value; the target does.

public interface ITarget
Extension Methods

Remarks

A minimal target implements Name and the three methods; Subjects, ProbeAsync(TargetContext, CancellationToken) and GetChangeToken() have default bodies. Members added in later versions have default bodies too, so a target written today keeps compiling.

A target never puts connection data (a connection string, a key, a password, a host it should not reveal) in a description: descriptions reach the model. Keep secrets in the target's own fields.

Properties

Name

The target's name: the key rule files, stamps and the change ledger use for it, such as orders-db. It does not change for the life of the target.

Subjects

The subjects this target hands to the Data checkpoint: by default the core's (Core). A target that reports values of its own in Extra, such as a count of literal values in a statement, declares them here, after the core's.

Methods

DescribeAsync(TargetContext, CancellationToken)

Describes what the target holds: its command language, the schema of a command, its entities with their fields and operations, and guidance for the model. The runtime calls it before an operation when the target has no probe, when the probe's token changed, or when asked to describe again.

ExecuteAsync(TargetExecution, CancellationToken)

Runs a command that passed the guardrail check. Only the runtime can create a TargetExecution, so nothing reaches this method unchecked. The target binds the parameters, converts values, opens a transaction for a write when its technology has one, honors Limits while it reads and classifies a rejection by throwing a TargetOperationException with the right Kind.

GetChangeToken()

A token that fires when the target's technology reports a schema change, or null when it reports none.

InspectAsync(TargetCommand, TargetContext, CancellationToken)

Reads a command the model planned, without running it, and reports what it would do: the entities it touches, its operations, the parameters it uses, the values of the target's own subjects, and the target's own refusals. The runtime checks the result against the rule files, and a refusal here always applies, whatever a rule file allows.

ProbeAsync(TargetContext, CancellationToken)

Returns a cheap token that identifies the target's schema, such as a digest of the schema or a schema version the technology keeps with its data, or null when the target has no such token. With a token, the runtime describes the target again only when the token changes; without one, before every operation.