tasktree

package
v0.0.0-...-e86b535 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskTree

type TaskTree struct {
	// contains filtered or unexported fields
}

A TaskTree organizes the relationships between tasks. Thread-safe.

func NewTaskTree

func NewTaskTree() *TaskTree

NewTaskTree creates a new, empty TaskTree.

func (*TaskTree) AddTask

func (tree *TaskTree) AddTask(task task.Task) error

AddTask adds a Task object to the TaskTree.

func (*TaskTree) DeleteTask

func (tree *TaskTree) DeleteTask(id task.Id) error

DeleteTask deletes a task from the tree by id.

func (*TaskTree) GetAllBlockers

func (tree *TaskTree) GetAllBlockers(id task.Id) ([]task.Task, error)

GetAllBlockers gets all tasks that either:

  • directly block a task
  • block a task's ancestors

func (*TaskTree) GetAncestorTasks

func (tree *TaskTree) GetAncestorTasks(id task.Id) ([]task.Task, error)

GetAncestorTasks returns the ancestors of a task in order (parent task, grandparent task, great grandparent task, etc.)

func (*TaskTree) GetDirectBlockers

func (tree *TaskTree) GetDirectBlockers(id task.Id) ([]task.Task, error)

GetDirectBlockers gets tasks that are directly blocking the specific task.

func (*TaskTree) GetDirectSubtasksOf

func (tree *TaskTree) GetDirectSubtasksOf(parentId task.Id) ([]task.Task, error)

GetDirectSubtasksOf gets the direct children of a Task.

func (*TaskTree) GetParentTask

func (tree *TaskTree) GetParentTask(id task.Id) (parent task.Task, exists bool, err error)

GetParentTask gets the parent of a given task if it exists.

func (*TaskTree) GetRootTasks

func (tree *TaskTree) GetRootTasks() []task.Task

GetRootTasks returns the root tasks (i.e. tasks that aren't subtasks/don't have parents).

func (*TaskTree) GetTask

func (tree *TaskTree) GetTask(id task.Id) (task task.Task, exists bool)

GetTask gets a Task object in the TaskTree by its id.

func (*TaskTree) GobDecode

func (tree *TaskTree) GobDecode(buf []byte) error

GobDecode allows for gob decoding of a TaskTree. A custom implementation is necessary here because the TaskTree struct fields are private.

func (*TaskTree) GobEncode

func (tree *TaskTree) GobEncode() ([]byte, error)

GobEncode allows for gob encoding of a TaskTree. A custom implementation is necessary here because the TaskTree struct fields are private.

func (*TaskTree) IsBlocked

func (tree *TaskTree) IsBlocked(id task.Id) (bool, error)

IsBlocked checks if a task or any of its parent tasks are blocked.

func (*TaskTree) IsSubtask

func (tree *TaskTree) IsSubtask(id task.Id) (bool, error)

IsSubtask determines whether a Task is a subtask (i.e. has a parent Task).

func (*TaskTree) MarkBlocker

func (tree *TaskTree) MarkBlocker(blockerId task.Id, blockedId task.Id) error

MarkBlocker marks one task (blocker) as a prerequisite for another task (blocked).

func (*TaskTree) MarkSubtask

func (tree *TaskTree) MarkSubtask(parentId task.Id, subtaskId task.Id) error

MarkSubtask marks one task (subtask) as a subtask of another (parent).

func (*TaskTree) UnmarkBlocker

func (tree *TaskTree) UnmarkBlocker(blockerId task.Id, blockedId task.Id) error

UnmarkBlocker marks one task (blocker) as a no longer being a prerequisite for another task (blocked).

func (*TaskTree) UnmarkSubtask

func (tree *TaskTree) UnmarkSubtask(subtaskId task.Id) error

UnmarkSubtask marks a task as an independent task rather than a subtask. Does not error if task was already an independent task.

func (*TaskTree) UpdateTask

func (tree *TaskTree) UpdateTask(task task.Task) error

UpdateTask replaces a task in the tree with an updated version.

Jump to

Keyboard shortcuts

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