module Croupier

Defined in:

croupier.cr
croupier/graph.cr
croupier/hash_state.cr
croupier/kv_store.cr
croupier/runner.cr
croupier/watcher.cr
task.cr
topo_sort.cr

Constant Summary

Log = ::Log.for("croupier")

Log with "croupier" as the source

ROOT_VERTEX = "\u0000start"

Virtual root vertex of the task graph. It contains a NUL byte, which no file path (and no sane task id) can contain, so a real vertex can never collide with it — it used to be literally "start", and a task named "start" would become the root of the whole graph.

TaskManager = TaskManagerType.new

The global task manager (singleton)

VERSION = {{ (`shards version /home/runner/work/croupier/croupier/src`).chomp.stringify }}

Class Method Summary

Class Method Detail

def self.hash_file(path : String) : String #

SHA1 of a file's contents, streamed so large files are never buffered whole. Shared by Task#run (no_save output verification) and the manager's input scanner; an unreadable file still raises from File.open, same as File.read did.


[View source]
def self.topological_sort(g) #

Sort the vertices of g (an adjacency hash, vertex => the vertices it points at) starting from the virtual root (ROOT_VERTEX), so every vertex comes after the vertices pointing at it.

Neighbors are visited in sorted order, so the order among independent vertices is deterministic instead of following hash-table layout. g[v]? tolerates plain hashes without a default block (and doesn't mutate the graph by inserting missing keys on read).


[View source]