Skip to content

File

std/file@1. One file operation per Call. read publishes complete bytes; replace stages and atomically replaces one file. Directory operations are outside this Contract.

This declaration comes from examples/file-pipeline.rkg. Place the Connector in a Graph and wire its ports; the excerpt alone is not an App. Its App input is string: each producer of read_file.in must supply a string for the plain data as string in the path setting to be safe.

connector read_file : File {
mode = read
path = data as string
max_read = "64KiB"
timeout = duration("2s")
}

The contract index explains shared settings, build features and the distinction between a Contract, a Lab model and an installed Driver.

Selector: mode is required.

Calls on one instance are serialized; queue time counts toward timeout.

ModeDriver directionExchangeLab modelInstalled in this binary
readoutboundcalllab-callfile
replaceoutboundcalllab-callfile
ModePortDirectionType rule
readininputvariant
read, replaceoutoutputarray<byte>
read, replaceexitoutputFileExit, below
replaceininputarray<byte>
ModeOutput cardinality
readout: exactly one on Completed; exactly one final exit per Call
replaceout: never; exactly one final exit per Call
CasePayloadCall visibility
AtomicReplaceUnavailableEmptybefore_effect
CompletedEmptyafter_effect
InvalidPathEmptybefore_effect
IoFailedEmptyoutcome_unknown
NotAFileEmptybefore_effect
NotFoundEmptybefore_effect
OutcomeUnknownEmptyoutcome_unknown
PermissionDeniedEmptybefore_effect
ReadLimitExceeded{ limit: ulong }after_effect
TimeoutExpiredEmptyoutcome_unknown
ModeSettingDomainPresence / defaultLatest phase
read, replacepathstringrequiredinvocation
read, replaceidempotentbooltrueplan
read, replacebehaviordeterministicdeterministicplan
read, replacetimeoutdurationoptionalinstance
readmax_readByteSize"8MiB"plan

File paths are logical paths relative to the deployment root. A replacement has no truncate fallback and makes no crash-durability promise. The checker fixes File repetition to idempotent and behavior to deterministic.

read: fixture crates/rastok/tests/conformance_file.rs. Cases without a portable forced fixture: PermissionDenied, AtomicReplaceUnavailable, IoFailed, TimeoutExpired, OutcomeUnknown. Related tests: crates/rastok/tests/file_connector.rs.

replace: No dedicated full-Contract fixture is declared. Related tests: crates/rastok/tests/file_connector.rs.

Diagram