Mount and bind
sftp({ data, provider, writer }) returns the app to place at a path of your
tree. Bind the directory with sftpDirectory and declare its credential with
secret().
app.ts
operator role, which clears data. Only the operator
calls drop.source.*, drop.files.list, drop.files.get and drop.writes.*,
so initialization, pause, resume and immediate polls stay with whoever holds
it. The mount owns the position, active pass and health facts, plus the file
rows. Each accepted page and its next position commit together.
Set the credential to JSON holding the SSH username, the server’s pinned
OpenSSH public key, an absolute directory inside the SSH account’s root and
one login. Then grant the role and start the source:
drop.operator is granted from code: ctx.grant(drop.operator, { to, under }) in one of your
mutations (Grants).
passphrase. A password login uses
{ "kind": "password", "password": "…" }. Give the account read permission
only on its dedicated directory and constrain it on the SSH server. Publish
files under immutable names using atomic renames so the app reads coherent
content. The driver pins the server key and checks
size and modification time on both the open handle and its name. SFTP v3
does not expose an immutable version ID. The driver hashes the bounded body
during discovery and checks the same digest against a full reread for each
range before releasing that range.
A scan covers at most 2,048 directory entries and resumes strictly after the
last committed path. Files up to 1 MiB are assembled from 24 KiB ranges.
The app holds unfinished parts as private Files at the mount label, then
retires them on publication, failure, deadline, pause or reset. The File owner
accounts for each part and final File before writing it to storage. Staged
parts use the label’s ordinary File quota, including its retirement horizon.
Larger files receive metadata only. Observations never infer deletion from absence.
The source implementation has yet to be compiled or tested.
Use the revision returned by source.initialize or source.health for
poll, pause and resume. A stale revision refuses RevisionMoved. A reset also takes the observed
gapAt.
The same mount accepts FTP over TLS,
an SMB disk share, a filesystem bridge,
a WebHDFS gateway, or an
exact Git commit through their binders.
Put a file
Bind a writer withsftpWriter(endpoint, credential, label) at the mount’s
data label and pass it as writer; without it the mount has no writes.
Set the writer credential with the same server-pin and directory fields as the
reader. Use a dedicated confined account and pre-create a private, non-symlink
.bijection staging directory beneath the installed directory. Keep its
parent path and staging directory under trusted server control. The server
must support SFTP v3 no-overwrite rename from staging into the directory.
drop.writes.put and drop.writes.get. Send a command
key and command: { name, data }, where name is one flat ASCII filename and
data holds up to 24 KiB of canonical base64-encoded bytes. A repeated key
with identical inputs replays; with other inputs it refuses KeyReused, and a
name that is not one flat filename refuses InvalidFilename. The mount’s
clock submits a single once task per command key.
If the task refuses, drop.writes.get reports refused with the
refusal value in refusal.
On acknowledged, the server acknowledged writing and closing the staged
file and renaming it to the requested name. Evidence carries the name and
the byte length and SHA-256 of the bytes sent. The hash is a local witness
of those bytes. Remote durability, later content and downstream processing
require separate evidence. The put creates a new name. A rename refusal or
a lost reply can settle the task Unknown and, after a connection loss, a
temporary file in the recipient’s staging directory. The put advances no
read cursor.