Documentation
¶
Overview ¶
Package commitintent defines the durable, pure queue record that sits before an effectful fak commit drain.
The package deliberately does not run git, inspect the live index, take locks, or push. It validates and orders submit records so a later single-writer drain can consume one deterministic stream.
Index ¶
- Constants
- Variables
- func DefaultQueueDir(repoRoot string) string
- func MarshalQueue(q Queue) ([]byte, error)
- func MarshalRecord(rec SubmitRecord) ([]byte, error)
- func NormalizeHexDigest(digest, field string) (string, error)
- func NormalizeID(id string) (string, error)
- func NormalizePath(raw string) (string, error)
- func NormalizePaths(paths []string) ([]string, error)
- func NormalizeSHA(sha string) (string, error)
- func PathDigest(paths []string) string
- func Submit(q Queue, now time.Time, intent Intent) (Queue, SubmitRecord, error)
- func ValidateIntent(in Intent) error
- func ValidateIntentForBase(in Intent, currentBaseSHA string) error
- func ValidateMetadata(meta StampMetadata) error
- func ValidateQueue(q Queue) error
- func ValidateRecord(rec SubmitRecord) error
- func ValidateStamp(stamp Stamp) error
- func ValidateState(state State) error
- func ValidateSubject(subject string) error
- type DrainPlan
- type FieldError
- type Intent
- type InvalidRecord
- type Queue
- type Stamp
- type StampKind
- type StampMetadata
- type State
- type Store
- type SubmitRecord
Constants ¶
View Source
const ( QueueSchema = "fak.commit-intent.queue.v1" RecordSchema = "fak.commit-intent.submit.v1" )
View Source
const ( StoreDirName = "commit-intents" StoreQueueFile = "queue.json" StoreLockFile = "queue.lock" )
Variables ¶
Functions ¶
func DefaultQueueDir ¶
func MarshalQueue ¶
func MarshalRecord ¶
func MarshalRecord(rec SubmitRecord) ([]byte, error)
func NormalizeHexDigest ¶
func NormalizeID ¶
func NormalizePath ¶
func NormalizePaths ¶
func NormalizeSHA ¶
func PathDigest ¶
func ValidateIntent ¶
func ValidateIntentForBase ¶
func ValidateMetadata ¶
func ValidateMetadata(meta StampMetadata) error
func ValidateQueue ¶
func ValidateRecord ¶
func ValidateRecord(rec SubmitRecord) error
func ValidateStamp ¶
func ValidateState ¶
func ValidateSubject ¶
Types ¶
type DrainPlan ¶
type DrainPlan struct {
Ready []SubmitRecord `json:"ready"`
Stale []SubmitRecord `json:"stale"`
Invalid []InvalidRecord `json:"invalid"`
}
type FieldError ¶
func (FieldError) Error ¶
func (e FieldError) Error() string
func (FieldError) Unwrap ¶
func (e FieldError) Unwrap() error
type Intent ¶
type Intent struct {
ID string `json:"id"`
BaseSHA string `json:"base_sha"`
Paths []string `json:"paths"`
PathDigest string `json:"path_digest"`
DiffDigest string `json:"diff_digest,omitempty"`
Subject string `json:"subject"`
Stamp Stamp `json:"stamp"`
Metadata StampMetadata `json:"metadata,omitempty"`
}
func NormalizeIntent ¶
type InvalidRecord ¶
type InvalidRecord struct {
Record SubmitRecord `json:"record"`
Error string `json:"error"`
}
type Queue ¶
type Queue struct {
Schema string `json:"schema"`
NextSequence int64 `json:"next_sequence"`
Records []SubmitRecord `json:"records"`
}
func ParseQueue ¶
type Stamp ¶
type Stamp struct {
Kind StampKind `json:"kind"`
Leaf string `json:"leaf,omitempty"`
Text string `json:"text,omitempty"`
}
func StampFromSubject ¶
type StampMetadata ¶
type Store ¶
type SubmitRecord ¶
type SubmitRecord struct {
Schema string `json:"schema"`
Sequence int64 `json:"sequence"`
SubmittedAt time.Time `json:"submitted_at"`
State State `json:"state"`
Intent Intent `json:"intent"`
}
func Ordered ¶
func Ordered(records []SubmitRecord) []SubmitRecord
func ParseRecord ¶
func ParseRecord(data []byte) (SubmitRecord, error)
Click to show internal directories.
Click to hide internal directories.