icss 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.document +5 -0
  2. data/.rspec +3 -0
  3. data/.watchr +20 -0
  4. data/CHANGELOG.textile +8 -0
  5. data/Gemfile +17 -0
  6. data/Gemfile.lock +34 -0
  7. data/LICENSE.textile +20 -0
  8. data/README.textile +19 -0
  9. data/Rakefile +43 -0
  10. data/VERSION +1 -0
  11. data/examples/BulkData.avpr +21 -0
  12. data/examples/complicated.icss.yaml +158 -0
  13. data/examples/interop.avsc +32 -0
  14. data/examples/mail.avpr +20 -0
  15. data/examples/namespace.avpr +28 -0
  16. data/examples/org/apache/avro/ipc/HandshakeRequest.avsc +11 -0
  17. data/examples/org/apache/avro/ipc/HandshakeResponse.avsc +15 -0
  18. data/examples/org/apache/avro/ipc/trace/avroTrace.avdl +64 -0
  19. data/examples/org/apache/avro/ipc/trace/avroTrace.avpr +82 -0
  20. data/examples/org/apache/avro/mapred/tether/InputProtocol.avpr +59 -0
  21. data/examples/org/apache/avro/mapred/tether/OutputProtocol.avpr +75 -0
  22. data/examples/simple.avpr +70 -0
  23. data/examples/weather.avsc +9 -0
  24. data/icss.gemspec +104 -0
  25. data/icss_specification.textile +370 -0
  26. data/init.rb +3 -0
  27. data/lib/icss.rb +19 -0
  28. data/lib/icss/brevity.rb +136 -0
  29. data/lib/icss/code_asset.rb +16 -0
  30. data/lib/icss/core_ext.rb +4 -0
  31. data/lib/icss/data_asset.rb +22 -0
  32. data/lib/icss/message.rb +72 -0
  33. data/lib/icss/old.rb +96 -0
  34. data/lib/icss/protocol.rb +138 -0
  35. data/lib/icss/protocol_set.rb +48 -0
  36. data/lib/icss/sample_message_call.rb +140 -0
  37. data/lib/icss/target.rb +71 -0
  38. data/lib/icss/type.rb +517 -0
  39. data/lib/icss/type/factory.rb +196 -0
  40. data/lib/icss/validations.rb +16 -0
  41. data/lib/icss/view_helper.rb +28 -0
  42. data/spec/icss_spec.rb +7 -0
  43. data/spec/spec_helper.rb +31 -0
  44. metadata +218 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "HandshakeRequest", "namespace":"org.apache.avro.ipc",
3
+ "type": "record",
4
+ "fields": [
5
+ {"name": "clientHash",
6
+ "type": {"name": "MD5", "type": "fixed", "size": 16}},
7
+ {"name": "clientProtocol", "type": ["null", "string"]},
8
+ {"name": "serverHash", "type": "MD5"},
9
+ {"name": "meta", "type": ["null", {"type": "map", "values": "bytes"}]}
10
+ ]
11
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "HandshakeResponse", "namespace": "org.apache.avro.ipc",
3
+ "type": "record",
4
+ "fields": [
5
+ {"name": "match",
6
+ "type": {"name": "HandshakeMatch", "type": "enum",
7
+ "symbols": ["BOTH", "CLIENT", "NONE"]}},
8
+ {"name": "serverProtocol",
9
+ "type": ["null", "string"]},
10
+ {"name": "serverHash",
11
+ "type": ["null", {"name": "MD5", "type": "fixed", "size": 16}]},
12
+ {"name": "meta",
13
+ "type": ["null", {"type": "map", "values": "bytes"}]}
14
+ ]
15
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /**
20
+ * A Span is our basic unit of tracing. It tracks the critical points
21
+ * of a single RPC call and records other call meta-data. It also
22
+ * allows arbitrary string annotations. Both the client and server create
23
+ * Span objects, each of which is populated with half of the relevant event
24
+ * data. They share a span ID, which allows us to merge them into one complete
25
+ * span later on.
26
+ */
27
+ @namespace("org.apache.avro.ipc.trace")
28
+
29
+ protocol AvroTrace {
30
+ enum SpanEvent { SERVER_RECV, SERVER_SEND, CLIENT_RECV, CLIENT_SEND }
31
+
32
+ fixed ID(8);
33
+
34
+ record TimestampedEvent {
35
+ long timeStamp; // Unix time, in nanoseconds
36
+ union { SpanEvent, string} event;
37
+ }
38
+
39
+ record Span {
40
+ ID traceID; // ID shared by all Spans in a given trace
41
+ ID spanID; // Random ID for this Span
42
+ union { ID, null } parentSpanID; // Parent Span ID (null if root Span)
43
+ string messageName; // Function call represented
44
+ long requestPayloadSize; // Size (bytes) of the request
45
+ long responsePayloadSize; // Size (byts) of the response
46
+ union { string, null} requestorHostname; // Hostname of requestor
47
+ // int requestorPort; // Port of the requestor (currently unused)
48
+ union { string, null } responderHostname; // Hostname of the responder
49
+ // int responderPort; // Port of the responder (currently unused)
50
+ array<TimestampedEvent> events; // List of critical events
51
+ boolean complete; // Whether includes data from both sides
52
+ }
53
+
54
+ /**
55
+ * Get all spans stored on this host.
56
+ */
57
+ array<Span> getAllSpans();
58
+
59
+ /**
60
+ * Get spans occuring between start and end. Each is a unix timestamp
61
+ * in nanosecond units (for consistency with TimestampedEvent).
62
+ */
63
+ array<Span> getSpansInRange(long start, long end);
64
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "namespace" : "org.apache.avro.ipc.trace",
3
+ "protocol" : "AvroTrace",
4
+ "types" : [ {
5
+ "name" : "SpanEvent",
6
+ "type" : "enum",
7
+ "symbols" : [ "SERVER_RECV", "SERVER_SEND", "CLIENT_RECV", "CLIENT_SEND" ]
8
+ }, {
9
+ "name" : "ID",
10
+ "type" : "fixed",
11
+ "size" : 8
12
+ }, {
13
+ "name" : "TimestampedEvent",
14
+ "type" : "record",
15
+ "fields" : [ {
16
+ "name" : "timeStamp",
17
+ "type" : "long"
18
+ }, {
19
+ "name" : "event",
20
+ "type" : [ "SpanEvent", "string" ]
21
+ } ]
22
+ }, {
23
+ "name" : "Span",
24
+ "type" : "record",
25
+ "fields" : [ {
26
+ "name" : "traceID",
27
+ "type" : "ID"
28
+ }, {
29
+ "name" : "spanID",
30
+ "type" : "ID"
31
+ }, {
32
+ "name" : "parentSpanID",
33
+ "type" : [ "ID", "null" ]
34
+ }, {
35
+ "name" : "messageName",
36
+ "type" : "string"
37
+ }, {
38
+ "name" : "requestPayloadSize",
39
+ "type" : "long"
40
+ }, {
41
+ "name" : "responsePayloadSize",
42
+ "type" : "long"
43
+ }, {
44
+ "name" : "requestorHostname",
45
+ "type" : [ "string", "null" ]
46
+ }, {
47
+ "name" : "responderHostname",
48
+ "type" : [ "string", "null" ]
49
+ }, {
50
+ "name" : "events",
51
+ "type" : {
52
+ "type" : "array",
53
+ "items" : "TimestampedEvent"
54
+ }
55
+ }, {
56
+ "name" : "complete",
57
+ "type" : "boolean"
58
+ } ]
59
+ } ],
60
+ "messages" : {
61
+ "getAllSpans" : {
62
+ "request" : [ ],
63
+ "response" : {
64
+ "type" : "array",
65
+ "items" : "Span"
66
+ }
67
+ },
68
+ "getSpansInRange" : {
69
+ "request" : [ {
70
+ "name" : "start",
71
+ "type" : "long"
72
+ }, {
73
+ "name" : "end",
74
+ "type" : "long"
75
+ } ],
76
+ "response" : {
77
+ "type" : "array",
78
+ "items" : "Span"
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,59 @@
1
+ {"namespace":"org.apache.avro.mapred.tether",
2
+ "protocol": "InputProtocol",
3
+ "doc": "Transmit inputs to a map or reduce task sub-process.",
4
+
5
+ "types": [
6
+ {"name": "TaskType", "type": "enum", "symbols": ["MAP","REDUCE"]}
7
+ ],
8
+
9
+ "messages": {
10
+
11
+ "configure": {
12
+ "doc": "Configure the task. Sent before any other message.",
13
+ "request": [
14
+ {"name": "taskType", "type": "TaskType",
15
+ "doc": "Whether this is a map or reduce task."},
16
+ {"name": "inSchema", "type": "string",
17
+ "doc": "The Avro schema for task input data."},
18
+ {"name": "outSchema", "type": "string",
19
+ "doc": "The Avro schema for task output data."}
20
+ ],
21
+ "response": "null"
22
+ },
23
+
24
+ "partitions": {
25
+ "doc": "Set the number of map output partitions.",
26
+ "request": [
27
+ {"name": "partitions", "type": "int",
28
+ "doc": "The number of map output partitions."}
29
+ ],
30
+ "response": "null"
31
+ },
32
+
33
+ "input": {
34
+ "doc": "Send a block of input data to a task.",
35
+ "request": [
36
+ {"name": "data", "type": "bytes",
37
+ "doc": "A sequence of instances of the declared schema."},
38
+ {"name": "count", "type": "long",
39
+ "default": 1,
40
+ "doc": "The number of instances in this block."}
41
+ ],
42
+ "response": "null"
43
+ },
44
+
45
+ "abort": {
46
+ "doc": "Called to abort the task.",
47
+ "request": [],
48
+ "response": "null"
49
+ },
50
+
51
+ "complete": {
52
+ "doc": "Called when a task's input is complete.",
53
+ "request": [],
54
+ "response": "null"
55
+ }
56
+
57
+ }
58
+
59
+ }
@@ -0,0 +1,75 @@
1
+ {"namespace":"org.apache.avro.mapred.tether",
2
+ "protocol": "OutputProtocol",
3
+ "doc": "Transmit outputs from a map or reduce task to parent.",
4
+
5
+ "messages": {
6
+
7
+ "configure": {
8
+ "doc": "Configure task. Sent before any other message.",
9
+ "request": [
10
+ {"name": "port", "type": "int",
11
+ "doc": "The port to transmit inputs to this task on."}
12
+ ],
13
+ "response": "null"
14
+ },
15
+
16
+ "output": {
17
+ "doc": "Send an output datum.",
18
+ "request": [
19
+ {"name": "datum", "type": "bytes",
20
+ "doc": "A binary-encoded instance of the declared schema."}
21
+ ],
22
+ "response": "null"
23
+ },
24
+
25
+ "outputPartitioned": {
26
+ "doc": "Send map output datum explicitly naming its partition.",
27
+ "request": [
28
+ {"name": "partition", "type": "int",
29
+ "doc": "The map output partition for this datum."},
30
+ {"name": "datum", "type": "bytes",
31
+ "doc": "A binary-encoded instance of the declared schema."}
32
+ ],
33
+ "response": "null"
34
+ },
35
+
36
+ "status": {
37
+ "doc": "Update the task's status message. Also acts as keepalive.",
38
+ "request": [
39
+ {"name": "message", "type": "string",
40
+ "doc": "The new status message for the task."}
41
+ ],
42
+ "response": "null"
43
+ },
44
+
45
+ "count": {
46
+ "doc": "Increment a task/job counter.",
47
+ "request": [
48
+ {"name": "group", "type": "string",
49
+ "doc": "The name of the counter group."},
50
+ {"name": "name", "type": "string",
51
+ "doc": "The name of the counter to increment."},
52
+ {"name": "amount", "type": "long",
53
+ "doc": "The amount to incrment the counter."}
54
+ ],
55
+ "response": "null"
56
+ },
57
+
58
+ "fail": {
59
+ "doc": "Called by a failing task to abort.",
60
+ "request": [
61
+ {"name": "message", "type": "string",
62
+ "doc": "The reason for failure."}
63
+ ],
64
+ "response": "null"
65
+ },
66
+
67
+ "complete": {
68
+ "doc": "Called when a task's output has completed without error.",
69
+ "request": [],
70
+ "response": "null"
71
+ }
72
+
73
+ }
74
+
75
+ }
@@ -0,0 +1,70 @@
1
+ {"namespace": "org.apache.avro.test",
2
+ "protocol": "Simple",
3
+ "doc": "Protocol used for testing.",
4
+
5
+ "types": [
6
+ {"name": "Kind", "type": "enum", "symbols": ["FOO","BAR","BAZ"]},
7
+
8
+ {"name": "MD5", "type": "fixed", "size": 16},
9
+
10
+ {"name": "TestRecord", "type": "record",
11
+ "fields": [
12
+ {"name": "name", "type": "string", "order": "ignore"},
13
+ {"name": "kind", "type": "Kind", "order": "descending"},
14
+ {"name": "hash", "type": "MD5"}
15
+ ]
16
+ },
17
+
18
+ {"name": "TestError", "type": "error", "fields": [
19
+ {"name": "message", "type": "string"}
20
+ ]
21
+ },
22
+
23
+ {"name": "TestRecordWithUnion", "type": "record",
24
+ "fields": [
25
+ {"name": "kind", "type": ["null", "Kind"]},
26
+ {"name": "value", "type": ["null", "string"]}
27
+ ]
28
+ }
29
+
30
+ ],
31
+
32
+ "messages": {
33
+
34
+ "hello": {
35
+ "doc": "Send a greeting",
36
+ "request": [{"name": "greeting", "type": "string"}],
37
+ "response": "string"
38
+ },
39
+
40
+ "echo": {
41
+ "doc": "Pretend you're in a cave!",
42
+ "request": [{"name": "record", "type": "TestRecord"}],
43
+ "response": "TestRecord"
44
+ },
45
+
46
+ "add": {
47
+ "request": [{"name": "arg1", "type": "int"}, {"name": "arg2", "type": "int"}],
48
+ "response": "int"
49
+ },
50
+
51
+ "echoBytes": {
52
+ "request": [{"name": "data", "type": "bytes"}],
53
+ "response": "bytes"
54
+ },
55
+
56
+ "error": {
57
+ "doc": "Always throws an error.",
58
+ "request": [],
59
+ "response": "null",
60
+ "errors": ["TestError"]
61
+ },
62
+
63
+ "ack": {
64
+ "doc": "Send a one way message",
65
+ "request": [],
66
+ "response": "null"
67
+ }
68
+ }
69
+
70
+ }
@@ -0,0 +1,9 @@
1
+ {"name": "test.Weather",
2
+ "doc": "A weather reading.",
3
+ "type": "record",
4
+ "fields": [
5
+ {"name": "station", "type": "string", "order": "ignore"},
6
+ {"name": "time", "type": "long"},
7
+ {"name": "temp", "type": "int"}
8
+ ]
9
+ }
data/icss.gemspec ADDED
@@ -0,0 +1,104 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{icss}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Philip (flip) Kromer for Infochimps"]
12
+ s.date = %q{2011-06-07}
13
+ s.description = %q{Infochimps Stupid Schema library: an avro-compatible data description standard. ICSS completely describes a collection of data (and associated assets) in a way that is expressive, scalable and sufficient to drive remarkably complex downstream processes.}
14
+ s.email = %q{coders@infochimps.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.textile",
17
+ "README.textile"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ ".watchr",
23
+ "CHANGELOG.textile",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE.textile",
27
+ "README.textile",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "examples/BulkData.avpr",
31
+ "examples/complicated.icss.yaml",
32
+ "examples/interop.avsc",
33
+ "examples/mail.avpr",
34
+ "examples/namespace.avpr",
35
+ "examples/org/apache/avro/ipc/HandshakeRequest.avsc",
36
+ "examples/org/apache/avro/ipc/HandshakeResponse.avsc",
37
+ "examples/org/apache/avro/ipc/trace/avroTrace.avdl",
38
+ "examples/org/apache/avro/ipc/trace/avroTrace.avpr",
39
+ "examples/org/apache/avro/mapred/tether/InputProtocol.avpr",
40
+ "examples/org/apache/avro/mapred/tether/OutputProtocol.avpr",
41
+ "examples/simple.avpr",
42
+ "examples/weather.avsc",
43
+ "icss.gemspec",
44
+ "icss_specification.textile",
45
+ "init.rb",
46
+ "lib/icss.rb",
47
+ "lib/icss/brevity.rb",
48
+ "lib/icss/code_asset.rb",
49
+ "lib/icss/core_ext.rb",
50
+ "lib/icss/data_asset.rb",
51
+ "lib/icss/message.rb",
52
+ "lib/icss/old.rb",
53
+ "lib/icss/protocol.rb",
54
+ "lib/icss/protocol_set.rb",
55
+ "lib/icss/sample_message_call.rb",
56
+ "lib/icss/target.rb",
57
+ "lib/icss/type.rb",
58
+ "lib/icss/type/factory.rb",
59
+ "lib/icss/validations.rb",
60
+ "lib/icss/view_helper.rb",
61
+ "spec/icss_spec.rb",
62
+ "spec/spec_helper.rb"
63
+ ]
64
+ s.homepage = %q{http://github.com/mrflip/icss}
65
+ s.licenses = ["MIT"]
66
+ s.require_paths = ["lib"]
67
+ s.rubygems_version = %q{1.7.2}
68
+ s.summary = %q{Infochimps Stupid Schema library: an avro-compatible data description standard. ICSS completely describes a collection of data (and associated assets) in a way that is expressive, scalable and sufficient to drive remarkably complex downstream processes.}
69
+ s.test_files = [
70
+ "spec/icss_spec.rb",
71
+ "spec/spec_helper.rb"
72
+ ]
73
+
74
+ if s.respond_to? :specification_version then
75
+ s.specification_version = 3
76
+
77
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
78
+ s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
79
+ s.add_runtime_dependency(%q<gorillib>, ["~> 0.0.7"])
80
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
81
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
82
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
83
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
84
+ s.add_development_dependency(%q<rcov>, [">= 0"])
85
+ else
86
+ s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
87
+ s.add_dependency(%q<gorillib>, ["~> 0.0.7"])
88
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
89
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
90
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
91
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
92
+ s.add_dependency(%q<rcov>, [">= 0"])
93
+ end
94
+ else
95
+ s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
96
+ s.add_dependency(%q<gorillib>, ["~> 0.0.7"])
97
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
98
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
99
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
100
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
101
+ s.add_dependency(%q<rcov>, [">= 0"])
102
+ end
103
+ end
104
+