Mega patch

This is still a dirty prototype, so please excuse the mess. Please
excuse the fact that this is a mega patch. Once things settle down this
won't happen any more.

Some of the changes squashed into here include:
* Merge vertex loop with type loop
(The file watcher seems to cache events anyways)
* Improve pgraph library
* Add indegree, outdegree, and topological sort with tests
* Add reverse function for vertex list
* Tons of additional cleanup!

Amazingly, on my first successful compile, this seemed to run!

A special thanks to Ira Cooper who helped me talk through some of the
algorithmic decisions and for his help in finding better ones!
This commit is contained in:
James Shubin
2015-12-10 03:34:51 -05:00
parent 0ea6f30ef2
commit 6b4fa21074
20 changed files with 1411 additions and 363 deletions

44
examples/graph3a.yaml Normal file
View File

@@ -0,0 +1,44 @@
---
graph: mygraph
types:
noop:
- name: noop1
file:
- name: file1
path: /tmp/mgmt/f1
content: |
i am f1
state: exists
- name: file2
path: /tmp/mgmt/f2
content: |
i am f2
state: exists
- name: '@@file3'
path: /tmp/mgmt/f3
content: |
i am f3, exported from host A
state: exists
- name: '@@file4'
path: /tmp/mgmt/f4
content: |
i am f4, exported from host A
state: exists
collect:
- type: file
pattern: ''
edges:
- name: e1
from:
type: noop
name: noop1
to:
type: file
name: file1
- name: e2
from:
type: file
name: file1
to:
type: file
name: file2

44
examples/graph3b.yaml Normal file
View File

@@ -0,0 +1,44 @@
---
graph: mygraph
types:
noop:
- name: noop1
file:
- name: file1
path: /tmp/mgmt/f1
content: |
i am f1
state: exists
- name: file2
path: /tmp/mgmt/f2
content: |
i am f2
state: exists
- name: '@@file3'
path: /tmp/mgmt/f3
content: |
i am f3, exported from host B
state: exists
- name: '@@file4'
path: /tmp/mgmt/f4
content: |
i am f4, exported from host B
state: exists
collect:
- type: file
pattern: ''
edges:
- name: e1
from:
type: noop
name: noop1
to:
type: file
name: file1
- name: e2
from:
type: file
name: file1
to:
type: file
name: file2

18
examples/graph4.yaml Normal file
View File

@@ -0,0 +1,18 @@
---
graph: mygraph
types:
file:
- name: file1
path: /tmp/mgmt/f1
content: |
i am f1
state: exists
- name: '@@file3'
path: /tmp/mgmt/f3
content: |
i am f3, exported from host A
state: exists
collect:
- type: file
pattern: ''
edges:

13
examples/graph5.yaml Normal file
View File

@@ -0,0 +1,13 @@
---
graph: mygraph
types:
file:
- name: file1
path: /tmp/mgmt/f1
content: |
i am f1
state: exists
collect:
- type: file
pattern: ''
edges:

6
examples/graph6.yaml Normal file
View File

@@ -0,0 +1,6 @@
---
graph: mygraph
types:
noop:
- name: noop1
edges:

View File

@@ -0,0 +1,8 @@
[Unit]
Description=Fake service for testing
[Service]
ExecStart=/usr/bin/sleep 8h
[Install]
WantedBy=multi-user.target