Documentation
¶
Index ¶
- Variables
- func MigrateLadybugMetadata(ctx context.Context, source ladybug.Graph, target ladybug.Graph, ...) error
- type LadybugStore
- func (store *LadybugStore) CreateAttachment(ctx context.Context, attachment model.Attachment) (model.Attachment, error)
- func (store *LadybugStore) CreateWorkPlan(ctx context.Context, plan model.WorkPlan) (model.WorkPlan, error)
- func (store *LadybugStore) CreateWorkTask(ctx context.Context, task model.WorkTask) (model.WorkTask, error)
- func (store *LadybugStore) DeleteAttachmentsForTask(ctx context.Context, projectID, taskID string) (int, error)
- func (store *LadybugStore) DeleteWorkPlan(ctx context.Context, projectID, planID string) error
- func (store *LadybugStore) DeleteWorkTask(ctx context.Context, projectID, taskID string) error
- func (store *LadybugStore) GetWorkPlan(ctx context.Context, projectID string, planID string) (model.WorkPlan, error)
- func (store *LadybugStore) GetWorkPlansByIDs(ctx context.Context, projectID string, planIDs []string) ([]model.WorkPlan, error)
- func (store *LadybugStore) GetWorkTask(ctx context.Context, projectID string, taskID string) (model.WorkTask, error)
- func (store *LadybugStore) ListAttachments(ctx context.Context, projectID string, taskID string) ([]model.Attachment, error)
- func (store *LadybugStore) ListWorkPlans(ctx context.Context, filter model.WorkPlanFilter) ([]model.WorkPlan, error)
- func (store *LadybugStore) ListWorkTasks(ctx context.Context, filter model.WorkTaskFilter) ([]model.WorkTask, error)
- func (store *LadybugStore) ListWorkTasksByPlanIDs(ctx context.Context, projectID string, planIDs []string) ([]model.WorkTask, error)
- func (store *LadybugStore) SetAttachmentIndex(index *SQLiteAttachmentStore)
- func (store *LadybugStore) UpdateWorkPlan(ctx context.Context, plan model.WorkPlan) (model.WorkPlan, error)
- func (store *LadybugStore) UpdateWorkTask(ctx context.Context, task model.WorkTask) (model.WorkTask, error)
- type LadybugStoreOption
- type MemoryStore
- func (store *MemoryStore) CreateAttachment(_ context.Context, attachment projectworkplan.Attachment) (projectworkplan.Attachment, error)
- func (store *MemoryStore) CreateWorkPlan(_ context.Context, plan projectworkplan.WorkPlan) (projectworkplan.WorkPlan, error)
- func (store *MemoryStore) CreateWorkTask(_ context.Context, task projectworkplan.WorkTask) (projectworkplan.WorkTask, error)
- func (store *MemoryStore) DeleteAttachmentsForTask(_ context.Context, projectID, taskID string) (int, error)
- func (store *MemoryStore) DeleteWorkPlan(_ context.Context, projectID, planID string) error
- func (store *MemoryStore) DeleteWorkTask(_ context.Context, projectID, taskID string) error
- func (store *MemoryStore) GetWorkPlan(_ context.Context, projectID, planID string) (projectworkplan.WorkPlan, error)
- func (store *MemoryStore) GetWorkPlansByIDs(_ context.Context, projectID string, planIDs []string) ([]projectworkplan.WorkPlan, error)
- func (store *MemoryStore) GetWorkTask(_ context.Context, projectID, taskID string) (projectworkplan.WorkTask, error)
- func (store *MemoryStore) ListAttachments(_ context.Context, projectID, taskID string) ([]projectworkplan.Attachment, error)
- func (store *MemoryStore) ListWorkPlans(_ context.Context, filter projectworkplan.WorkPlanFilter) ([]projectworkplan.WorkPlan, error)
- func (store *MemoryStore) ListWorkTasks(_ context.Context, filter projectworkplan.WorkTaskFilter) ([]projectworkplan.WorkTask, error)
- func (store *MemoryStore) ListWorkTasksByPlanIDs(_ context.Context, projectID string, planIDs []string) ([]projectworkplan.WorkTask, error)
- func (store *MemoryStore) UpdateWorkPlan(_ context.Context, plan projectworkplan.WorkPlan) (projectworkplan.WorkPlan, error)
- func (store *MemoryStore) UpdateWorkTask(_ context.Context, task projectworkplan.WorkTask) (projectworkplan.WorkTask, error)
- type SQLiteAttachmentStore
- func (store *SQLiteAttachmentStore) CreateAttachment(ctx context.Context, attachment projectworkplan.Attachment) error
- func (store *SQLiteAttachmentStore) DeleteAttachmentsForTask(ctx context.Context, projectID, taskID string) (int, error)
- func (store *SQLiteAttachmentStore) ListAttachments(ctx context.Context, projectID, taskID string) ([]projectworkplan.Attachment, error)
- func (store *SQLiteAttachmentStore) ListAttachmentsByKind(ctx context.Context, projectID, taskID, kind string) ([]projectworkplan.Attachment, error)
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicate = errors.New("project work plan resource already exists")
var ErrNotFound = errors.New("project work plan resource not found")
Functions ¶
Types ¶
type LadybugStore ¶
type LadybugStore struct {
// contains filtered or unexported fields
}
func NewLadybugStore ¶
func NewLadybugStore(graph ladybug.Graph, options ...LadybugStoreOption) *LadybugStore
func (*LadybugStore) CreateAttachment ¶
func (store *LadybugStore) CreateAttachment(ctx context.Context, attachment model.Attachment) (model.Attachment, error)
func (*LadybugStore) CreateWorkPlan ¶
func (*LadybugStore) CreateWorkTask ¶
func (*LadybugStore) DeleteAttachmentsForTask ¶ added in v0.3.0
func (store *LadybugStore) DeleteAttachmentsForTask(ctx context.Context, projectID, taskID string) (int, error)
DeleteAttachmentsForTask permanently removes every attachment node owned by the given task across all 6 attachment kinds, and mirrors the delete into the SQLite read index when present. Returns the total count removed. Scoped by project; idempotent (0, nil) when none exist.
func (*LadybugStore) DeleteWorkPlan ¶ added in v0.3.0
func (store *LadybugStore) DeleteWorkPlan(ctx context.Context, projectID, planID string) error
DeleteWorkPlan permanently removes the work plan node (not its tasks). Scoped by project; idempotent (nil when absent).
func (*LadybugStore) DeleteWorkTask ¶ added in v0.3.0
func (store *LadybugStore) DeleteWorkTask(ctx context.Context, projectID, taskID string) error
DeleteWorkTask permanently removes the work task node. It does NOT remove the task's attachments (call DeleteAttachmentsForTask) or its plan. Scoped by project; idempotent.
func (*LadybugStore) GetWorkPlan ¶
func (*LadybugStore) GetWorkPlansByIDs ¶ added in v0.3.0
func (*LadybugStore) GetWorkTask ¶
func (*LadybugStore) ListAttachments ¶
func (store *LadybugStore) ListAttachments(ctx context.Context, projectID string, taskID string) ([]model.Attachment, error)
func (*LadybugStore) ListWorkPlans ¶
func (store *LadybugStore) ListWorkPlans(ctx context.Context, filter model.WorkPlanFilter) ([]model.WorkPlan, error)
func (*LadybugStore) ListWorkTasks ¶
func (store *LadybugStore) ListWorkTasks(ctx context.Context, filter model.WorkTaskFilter) ([]model.WorkTask, error)
func (*LadybugStore) ListWorkTasksByPlanIDs ¶ added in v0.3.0
func (*LadybugStore) SetAttachmentIndex ¶ added in v0.3.0
func (store *LadybugStore) SetAttachmentIndex(index *SQLiteAttachmentStore)
SetAttachmentIndex attaches a SQLite attachment read index after construction. Used when the index is opened after the store (e.g. shared SQLite engine in cmd/mivia-server). Safe to call once at startup; not concurrency-safe for later re-assignment.
func (*LadybugStore) UpdateWorkPlan ¶
func (*LadybugStore) UpdateWorkTask ¶
type LadybugStoreOption ¶ added in v0.3.0
type LadybugStoreOption func(*LadybugStore)
LadybugStoreOption configures a LadybugStore at construction.
func WithAttachmentIndex ¶ added in v0.3.0
func WithAttachmentIndex(index *SQLiteAttachmentStore) LadybugStoreOption
WithAttachmentIndex routes attachment reads (ListAttachments / listAttachmentNodes, used by GetWorkTask/ListWorkTasks hydration and validateIndependentReviewRefs) to a purpose-built SQLite index instead of the graph's 6x full-project-prefix scan. Attachments are dual-written: the graph remains the source of truth; SQLite mirrors it for fast indexed reads. When nil, the store falls back to the original graph scan (tests / non-SQLite deployments).
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) CreateAttachment ¶
func (store *MemoryStore) CreateAttachment(_ context.Context, attachment projectworkplan.Attachment) (projectworkplan.Attachment, error)
func (*MemoryStore) CreateWorkPlan ¶
func (store *MemoryStore) CreateWorkPlan(_ context.Context, plan projectworkplan.WorkPlan) (projectworkplan.WorkPlan, error)
func (*MemoryStore) CreateWorkTask ¶
func (store *MemoryStore) CreateWorkTask(_ context.Context, task projectworkplan.WorkTask) (projectworkplan.WorkTask, error)
func (*MemoryStore) DeleteAttachmentsForTask ¶ added in v0.3.0
func (store *MemoryStore) DeleteAttachmentsForTask(_ context.Context, projectID, taskID string) (int, error)
DeleteAttachmentsForTask permanently removes every attachment owned by the given task, across all kinds. Returns the count removed. Scoped by project; idempotent (0, nil) when none exist.
func (*MemoryStore) DeleteWorkPlan ¶ added in v0.3.0
func (store *MemoryStore) DeleteWorkPlan(_ context.Context, projectID, planID string) error
DeleteWorkPlan permanently removes a work plan node. It does NOT remove the plan's tasks (call DeleteWorkTask per task). Scoped by project; idempotent.
func (*MemoryStore) DeleteWorkTask ¶ added in v0.3.0
func (store *MemoryStore) DeleteWorkTask(_ context.Context, projectID, taskID string) error
DeleteWorkTask permanently removes a work task node. It does NOT remove the task's attachments (call DeleteAttachmentsForTask) or its plan. Scoped by project; idempotent.
func (*MemoryStore) GetWorkPlan ¶
func (store *MemoryStore) GetWorkPlan(_ context.Context, projectID, planID string) (projectworkplan.WorkPlan, error)
func (*MemoryStore) GetWorkPlansByIDs ¶ added in v0.3.0
func (store *MemoryStore) GetWorkPlansByIDs(_ context.Context, projectID string, planIDs []string) ([]projectworkplan.WorkPlan, error)
func (*MemoryStore) GetWorkTask ¶
func (store *MemoryStore) GetWorkTask(_ context.Context, projectID, taskID string) (projectworkplan.WorkTask, error)
func (*MemoryStore) ListAttachments ¶
func (store *MemoryStore) ListAttachments(_ context.Context, projectID, taskID string) ([]projectworkplan.Attachment, error)
func (*MemoryStore) ListWorkPlans ¶
func (store *MemoryStore) ListWorkPlans(_ context.Context, filter projectworkplan.WorkPlanFilter) ([]projectworkplan.WorkPlan, error)
func (*MemoryStore) ListWorkTasks ¶
func (store *MemoryStore) ListWorkTasks(_ context.Context, filter projectworkplan.WorkTaskFilter) ([]projectworkplan.WorkTask, error)
func (*MemoryStore) ListWorkTasksByPlanIDs ¶ added in v0.3.0
func (store *MemoryStore) ListWorkTasksByPlanIDs(_ context.Context, projectID string, planIDs []string) ([]projectworkplan.WorkTask, error)
func (*MemoryStore) UpdateWorkPlan ¶
func (store *MemoryStore) UpdateWorkPlan(_ context.Context, plan projectworkplan.WorkPlan) (projectworkplan.WorkPlan, error)
func (*MemoryStore) UpdateWorkTask ¶
func (store *MemoryStore) UpdateWorkTask(_ context.Context, task projectworkplan.WorkTask) (projectworkplan.WorkTask, error)
type SQLiteAttachmentStore ¶ added in v0.3.0
type SQLiteAttachmentStore struct {
// contains filtered or unexported fields
}
SQLiteAttachmentStore is a purpose-built read index over Work Task attachments. It replaces the Ladybug graph's 6x full-project-prefix scan per GetWorkTask (listAttachmentNodes loops over 6 attachment labels, each an unindexed task_id scan) with a single indexed SQL query. The graph remains the source of truth for task *Refs slices and task/plan nodes; this index mirrors attachment nodes via dual-write at CreateAttachment time.
func NewSQLiteAttachmentStore ¶ added in v0.3.0
func NewSQLiteAttachmentStore(db *sql.DB) *SQLiteAttachmentStore
NewSQLiteAttachmentStore returns a SQLite-backed attachment read index. The work_task_attachments table is created by the shared schema bootstrap (internal/platform/sqlite/schema); this constructor only holds the connection.
func (*SQLiteAttachmentStore) CreateAttachment ¶ added in v0.3.0
func (store *SQLiteAttachmentStore) CreateAttachment(ctx context.Context, attachment projectworkplan.Attachment) error
CreateAttachment writes one attachment row. It is idempotent (INSERT OR IGNORE keyed on the composite primary key) so dual-write from the graph path is safe to retry. It does NOT validate the task exists; that guard is the caller's responsibility (the graph CreateAttachment already enforces it).
func (*SQLiteAttachmentStore) DeleteAttachmentsForTask ¶ added in v0.3.0
func (store *SQLiteAttachmentStore) DeleteAttachmentsForTask(ctx context.Context, projectID, taskID string) (int, error)
DeleteAttachmentsForTask removes every attachment row owned by the given task. Scoped by project_id + task_id. Idempotent: returns nil when no rows match. Returns the count of removed rows. Used by the cascade delete path to keep the read index consistent with the graph source of truth.
func (*SQLiteAttachmentStore) ListAttachments ¶ added in v0.3.0
func (store *SQLiteAttachmentStore) ListAttachments(ctx context.Context, projectID, taskID string) ([]projectworkplan.Attachment, error)
ListAttachments returns all attachments for a task, sorted by (CreatedAt, ID) to match the Ladybug store's ordering.
func (*SQLiteAttachmentStore) ListAttachmentsByKind ¶ added in v0.3.0
func (store *SQLiteAttachmentStore) ListAttachmentsByKind(ctx context.Context, projectID, taskID, kind string) ([]projectworkplan.Attachment, error)
ListAttachmentsByKind returns attachments for a task filtered by kind. Useful for the independence-gate path (validateIndependentReviewRefs) which only needs review_result_ref rows.