-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathezcompose2.slide
131 lines (86 loc) · 3.49 KB
/
ezcompose2.slide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Composing Channels for Easy Concurrency, Part 2
October 21, 2015, Dallas, Texas, USA
John Scott
Consultant, American Messaging, 2006-now
Founder, SetSpace, Inc, 1998-now
* The single biggest problem in communication is the illusion that it has taken place.
.caption George Bernard Shaw
.image ezcompose2/appenginegophercolor.jpg
* Share Memory by Communicating
* Go is a Blend of Sequential and Concurrent Coding
* The Big Threes of Systems Programming
- Modularity
- Composition
- Concurrency
* Modular
No Side Effects, Code is Local
* Composition
Create New Modules from Existing
* Concurrency
Concurrency is the composition of independently executing processes.
Parallelism is the simultaneous execution of any processes.
* Unix Shell Pipeline is Concurrency
find . -name '*.txt' | bzip2 >files.bz2
.caption Find All text Files and Compress into files.bz2
ps -el | grep postgres | grep -v grep | mail -s 'Postgres Processes' [email protected]
.caption Mail List of All PostgreSQL Processes to [email protected]
* Background Processes Running in Parallel
slow_job1 &
slow_job2 &
slow_job3 &
.caption Not Concurrent Since Not Composed into Single Process
* Cheap Broadcast by Closing Channel
*Read*on*Closed*Channel*Always*Returns*Nil*Or*Zero*
.code ezcompose2/cheap.go
* Complex Flow Graph Descibes Query
.image ezcompose2/flow-graph.png
.caption Query: (hostname like "%ru" or hostname like "%kp") and ip4 like "10.%"
* Flow Graph is Actually a Query Parse Tree
(hostname like "%ru" or hostname like "%kp") and ip4 like "10.%"
* Simple Six Instructions for "Query" Language
- Logical AND
- Logical OR
- Has a Prefix String
- Has a Suffix String
- Project (Push) Tuple Attribute (Column)
- Print
* How to Coordinate Many Go Routines
- Close a Single Broadcast Channel on Which Many GoRoutines Listen
- Send Next Request for Work to Single GoRoutine as Channel Over Channel
* Confluence - an act or process of merging.
* Flow Data Structures
Flow Coordinates Many Query Predicates Analyzing a Single Tuple
.caption One Flow Structure and Two Global Flows (A and B)
.code ezcompose2/flow.go /^type flow struct/,/^var flowA/
* Create a New Flow
.code ezcompose2/flow.go /^func .* new\(/,/^}$/
* Initialize the 0'th Flow and Victious Attack Data
.code ezcompose2/flow.go /^var attack /,/OMIT$/
* Coordinate Many Query Predicates
.code ezcompose2/flow.go /^func.*get()/,/^}$/
.caption Each Predicate GoRoutine Calls flow.get()
* "Instruction" to Match Suffix of String
.code ezcompose2/flow.go /^func.* has_suffix()/,/^}$/
* "Instruction" to Push Attribute of Input Tuple
.code ezcompose2/flow.go /^func.* project()/,/^}$/
* "Instruction" to Print Answer of Flow Over Tuple
.code ezcompose2/flow.go /^func.* print()/,/^}$/
* "Conflue" has Resolved flowA to Start flowB
.code ezcompose2/flow.go /^func.* conflue()/,/^}$/
* Simple Example Confluence
.code ezcompose2/flow.go /^func.* simple_conflue()/,/^}$/
* Run Simple Example Query
.play ezcompose2/flow.go /^func.* simple\(/,/OMIT$/
* "Instruction" to Logical AND
.code ezcompose2/flow.go /^func.* logical_AND()/,/^}$/
* "Instruction" to Logical OR
.code ezcompose2/flow.go /^func.* logical_OR()/,/^}$/
* "Instruction" to Match Prefix of String
.code ezcompose2/flow.go /^func.* has_prefix()/,/^}$/
* Compile Complex "Attack" Query
.code ezcompose2/flow.go /^func.* compile()/,/^}$/
* Attacking!!!!
.code ezcompose2/flow.go /^func.* attacking()/,/^}$/
.play ezcompose2/flow.go /^func.* main()/,/^}$/