Documentation
¶
Overview ¶
Package frag is the Frag module: quick capture into a Fragments Engine (FE).
A capture is queued in the module's own store first (so it is never lost and capturing works offline) and delivered behind it by a worker, as an fe.capture.v1 manifest, with retries, receipts and idempotency. The outbox shows where each capture is and lets the owner retry or discard one. It is a port of Basalisk's built-in Frag in personal mode: the owner's own key, read from a file at the moment of use.
Delivery is off until the owner turns it on (frag.delivery) and sets the FE address (frag.fe_url) and the key file (frag.fe_token_file).
What the module knows about the moment of a capture (the window the owner was in when the draft began and when it was saved) is kept with the queued row and never sent to FE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Capture ¶
type Capture struct {
Sequence int64 `json:"sequence"`
CaptureID string `json:"capture_id"`
State string `json:"state"`
Code string `json:"code"`
Content string `json:"content"`
Tags []string `json:"tags"`
Context json.RawMessage `json:"context,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Attempts int `json:"attempts"`
NextAttempt int64 `json:"next_attempt,omitempty"`
MayHaveSent bool `json:"may_have_sent"`
Delivering bool `json:"delivering"`
FragmentID string `json:"fragment_id,omitempty"`
FragmentRevisionID string `json:"fragment_revision_id,omitempty"`
FragmentURL string `json:"fragment_url,omitempty"`
}
Capture is one row of the queue, as the outbox shows it.
type Check ¶
type Check struct {
OK bool `json:"ok"`
FEURL string `json:"fe_url,omitempty"`
SchemaVersion string `json:"schema_version,omitempty"`
Reason string `json:"reason,omitempty"`
}
Check is the answer of a read against FE.
type Draft ¶
type Draft struct {
Content string `json:"content"`
Tags string `json:"tags"`
DraftAt string `json:"draft_at,omitempty"`
CaptureID string `json:"capture_id,omitempty"`
Context json.RawMessage `json:"context,omitempty"`
// contains filtered or unexported fields
}
Draft is the capture being written. It is kept until it is committed.
type Mod ¶
type Mod struct {
// Client, when set before Start, is the HTTP client delivery uses.
Client *http.Client
// contains filtered or unexported fields
}
Mod is the Frag module.
type Moment ¶
type Moment struct {
Window *Window `json:"window,omitempty"`
}
Moment is what a capture remembers about when it was drafted or saved.
type OwnerContext ¶
type OwnerContext struct {
Draft *Moment `json:"draft,omitempty"`
Save *Moment `json:"save,omitempty"`
}
OwnerContext is kept with the row and never sent to FE.
type Payload ¶
type Payload struct {
CaptureID string `json:"capture_id"`
Content string `json:"content"`
Tags []string `json:"tags"`
DraftAt string `json:"draft_at"`
SubmittedAt string `json:"submitted_at"`
}
Payload is what a capture's row keeps for delivery: exactly what FE receives, and when.
type Status ¶
type Status struct {
Delivery bool `json:"delivery"`
Ready bool `json:"ready"`
Reason string `json:"reason,omitempty"`
FEURL string `json:"fe_url,omitempty"`
Counts map[string]int `json:"counts"`
}
Status is how captures are delivered now.
type Window ¶
type Window struct {
View string `json:"view,omitempty"`
Module string `json:"module,omitempty"`
Title string `json:"title,omitempty"`
Kind string `json:"kind,omitempty"`
Ref string `json:"ref,omitempty"`
URL string `json:"url,omitempty"`
}
Window is the owner's window at a moment: what it showed, as the desk knows it.