core

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package core defines the shared domain types used across all astrolabe packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Name             string       `json:"name"`
	Path             string       `json:"path"`
	MediaType        string       `json:"media_type"`
	Role             ArtifactRole `json:"role"`
	SizeBytes        int64        `json:"size_bytes,omitempty"`
	Checksum         Checksum     `json:"checksum"`
	CreatedAt        time.Time    `json:"created_at"`
	UploadedAt       *time.Time   `json:"uploaded_at,omitempty"`
	RemoteURL        string       `json:"remote_url,omitempty"`
	RemoteArtifactID string       `json:"remote_artifact_id,omitempty"` // Backend-assigned ULID
}

Artifact represents a single file associated with a run, including its checksum, upload status, and optional remote reference.

type ArtifactRole

type ArtifactRole string

ArtifactRole classifies the purpose of an artifact within a run directory.

const (
	// ArtifactRoleManifest identifies the run's manifest.json file.
	ArtifactRoleManifest ArtifactRole = "manifest"
	// ArtifactRoleData identifies the primary NDJSON data file.
	ArtifactRoleData ArtifactRole = "data"
	// ArtifactRoleLog identifies a capture log file.
	ArtifactRoleLog ArtifactRole = "log"
	// ArtifactRoleAttachment identifies any supplementary file attached to the run.
	ArtifactRoleAttachment ArtifactRole = "attachment"
)

type CaptureSettings

type CaptureSettings struct {
	SampleRateHz float64  `json:"sample_rate_hz,omitempty"`
	Duration     float64  `json:"duration_seconds,omitempty"`
	Channels     []string `json:"channels,omitempty"`
	Notes        string   `json:"notes,omitempty"`
}

CaptureSettings records the technical parameters of the capture session (sample rate, duration, channel list) for reference alongside the data.

type Checksum

type Checksum struct {
	Algorithm string `json:"algorithm"`
	Value     string `json:"value"`
}

Checksum holds the algorithm name and hex-encoded digest for an artifact.

type DeviceInfo

type DeviceInfo struct {
	ID              string `json:"id"`
	Serial          string `json:"serial,omitempty"`
	Firmware        string `json:"firmware"` // required by the Orrery ingest contract; always emit (even when empty)
	FirmwareHash    string `json:"firmware_hash,omitempty"`
	HardwareVersion string `json:"hardware_version,omitempty"`
}

DeviceInfo identifies the physical device under test.

type Manifest

type Manifest struct {
	SchemaVersion string            `json:"schema_version"`
	Device        DeviceInfo        `json:"device"`
	Test          TestInfo          `json:"test"`
	Operator      string            `json:"operator,omitempty"`
	Location      string            `json:"location,omitempty"`
	Tags          []string          `json:"tags,omitempty"`
	Attributes    map[string]string `json:"attributes,omitempty"`
}

Manifest is the human-supplied metadata written into every run directory. It records who ran the test, on which device, under which test plan.

type ManifestOptions

type ManifestOptions struct {
	Operator   string
	Location   string
	Device     DeviceInfo
	Test       TestInfo
	Tags       []string
	Attributes map[string]string
}

ManifestOptions holds the user-supplied metadata flags shared across all capture subcommands.

type Record

type Record struct {
	TS       time.Time      `json:"ts"`
	Seq      uint64         `json:"seq"`
	Type     string         `json:"type"`
	Payload  map[string]any `json:"payload"`
	Envelope map[string]any `json:"envelope,omitempty"`
}

Record is a single normalized data point emitted by a normalizer. Each record has a timestamp, sequence number, type tag, and a free-form payload.

type Run

type Run struct {
	ID             string          `json:"run_id"`
	Source         SourceMeta      `json:"source"`
	Manifest       Manifest        `json:"manifest"`
	Capture        CaptureSettings `json:"capture"`
	Started        time.Time       `json:"started"`
	Completed      *time.Time      `json:"completed,omitempty"`
	RecordsCount   uint64          `json:"records_count,omitempty"`
	PrimaryDataURI string          `json:"primary_data_uri,omitempty"`
	Artifacts      []Artifact      `json:"artifacts,omitempty"`
	Upload         UploadState     `json:"upload"`
}

Run is the top-level record for a completed or in-progress capture session. It aggregates the source metadata, manifest, capture settings, artifacts, and upload state into a single persistent document.

type SourceMeta

type SourceMeta struct {
	Kind string `json:"kind"`
	Port string `json:"port,omitempty"`
	Baud int    `json:"baud,omitempty"`
	Addr string `json:"addr,omitempty"`
	Path string `json:"path,omitempty"`
}

SourceMeta describes the origin of a capture: the kind of source (serial, tcp, file) and the connection parameters relevant to that kind.

type TestInfo

type TestInfo struct {
	Plan    string `json:"plan"`
	Variant string `json:"variant,omitempty"`
	Run     string `json:"run,omitempty"`
}

TestInfo identifies the test plan and specific variant being executed.

type UploadState

type UploadState struct {
	Status      UploadStatus `json:"status"`
	Attempts    int          `json:"attempts"`
	LastError   string       `json:"last_error,omitempty"`
	LastAttempt *time.Time   `json:"last_attempt,omitempty"`
	CompletedAt *time.Time   `json:"completed_at,omitempty"`
	RemoteRunID string       `json:"remote_run_id,omitempty"`
}

UploadState tracks the progress and outcome of uploading a run to the backend.

type UploadStatus

type UploadStatus string

UploadStatus represents the lifecycle state of a run's upload to the backend.

const (
	// UploadStatusPending means the run has not been queued for upload yet.
	UploadStatusPending UploadStatus = "pending"
	// UploadStatusQueued means the run is waiting in the upload queue.
	UploadStatusQueued UploadStatus = "queued"
	// UploadStatusInFlight means the upload is currently in progress.
	UploadStatusInFlight UploadStatus = "in_flight"
	// UploadStatusSucceeded means all artifacts were uploaded successfully.
	UploadStatusSucceeded UploadStatus = "succeeded"
	// UploadStatusFailed means one or more upload attempts failed.
	UploadStatusFailed UploadStatus = "failed"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL