Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:noflo/noflo-groups

  • Loading branch information...
commit 4325a4a3b1b3444145eda9f144f44dcb0962b0e3 2 parents 0f9bf3f + 84d2369
@bergie bergie authored
View
16 components/CollectGroups.coffee
@@ -10,11 +10,17 @@ class CollectGroups extends noflo.Component
# Breadcrumb of each level of IPs as partitioned by groups
@parents = []
- @inPorts =
- in: new noflo.Port 'all'
- @outPorts =
- out: new noflo.Port 'object'
- error: new noflo.Port 'object'
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to collect'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'object'
+ description: 'An object containing input IPs sorted by their group
+ names'
+ error:
+ datatype: 'object'
@inPorts.in.on 'connect', =>
# Make sure working memory is clean
View
22 components/CollectObject.coffee
@@ -10,14 +10,20 @@ class CollectObject extends noflo.Component
@data = {}
@groups = {}
- @inPorts =
- keys: new noflo.ArrayPort 'string'
- allpackets: new noflo.ArrayPort 'string'
- collect: new noflo.ArrayPort 'all'
- release: new noflo.Port 'bang'
- clear: new noflo.Port 'bang'
- @outPorts =
- out: new noflo.Port 'object'
+ @inPorts = new noflo.InPorts
+ keys:
+ datatype: 'string'
+ allpackets:
+ datatype: 'string'
+ collect:
+ datatype: 'all'
+ release:
+ datatype: 'bang'
+ clear:
+ datatype: 'bang'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'object'
@inPorts.keys.on 'data', (key) =>
keys = key.split ','
View
13 components/CollectTree.coffee
@@ -7,11 +7,14 @@ class CollectTree extends noflo.Component
constructor: ->
@data = null
@groups = []
- @inPorts =
- in: new noflo.Port 'all'
- @outPorts =
- out: new noflo.Port 'all'
- error: new noflo.Port 'object'
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
+ error:
+ datatype: 'object'
@inPorts.in.on 'connect', =>
@data = {}
View
21 components/FilterByGroup.coffee
@@ -10,13 +10,20 @@ class FilterByGroup extends noflo.Component
@regexp = null
@matchedLevel = null
- @inPorts =
- in: new noflo.Port
- regexp: new noflo.Port
- @outPorts =
- out: new noflo.Port
- group: new noflo.Port
- empty: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to filter groups from'
+ regexp:
+ datatype: 'string'
+ description: 'Regexp use as a filter for IPs'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
+ group:
+ datatype: 'string'
+ empty:
+ datatype: 'bang'
@inPorts.regexp.on "data", (regexp) =>
@regexp = new RegExp(regexp)
View
12 components/FirstGroup.coffee
@@ -1,13 +1,17 @@
noflo = require 'noflo'
class FirstGroup extends noflo.Component
+ description: 'Forward incoming IPs and filter groups except the first one'
constructor: ->
@depth = 0
- @inPorts =
- in: new noflo.Port
- @outPorts =
- out: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to forward'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.in.on 'begingroup', (group) =>
@outPorts.out.beginGroup group if @depth is 0
View
11 components/GenerateGroup.coffee
@@ -6,10 +6,13 @@ class GenerateGroup extends noflo.Component
description: 'Wrap IPs into a random uuid generated group'
constructor: ->
- @inPorts =
- in: new noflo.Port 'all'
- @outPorts =
- out: new noflo.Port 'all'
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to forward'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@groups = []
View
20 components/Group.coffee
@@ -5,12 +5,20 @@ class Group extends noflo.Component
constructor: ->
@newGroups = []
- @inPorts =
- in: new noflo.Port 'all'
- group: new noflo.Port 'string'
- clear: new noflo.Port 'bang'
- @outPorts =
- out: new noflo.Port 'all'
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to forward'
+ group:
+ datatype: 'string'
+ description: 'Groups to encapsulate incoming packets into'
+ clear:
+ datatype: 'bang'
+ description: 'Clear encapsulating groups'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
+ description: 'Forwarded IPs with encapsulating groups'
@inPorts.in.on "connect", () =>
@outPorts.out.beginGroup group for group in @newGroups
View
15 components/GroupByObjectKey.coffee
@@ -5,11 +5,14 @@ class GroupByObjectKey extends noflo.Component
@data = []
@key = null
- @inPorts =
- in: new noflo.Port()
- key: new noflo.Port()
- @outPorts =
- out: new noflo.Port()
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ key:
+ datatype: 'string'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.in.on 'connect', =>
@data = []
@@ -25,7 +28,7 @@ class GroupByObjectKey extends noflo.Component
# Data already sent
@outPorts.out.disconnect()
return
-
+
# No key, data will be sent when we get it
return unless @key
View
13 components/GroupZip.coffee
@@ -4,11 +4,14 @@ class GroupZip extends noflo.Component
constructor: ->
@newGroups = []
- @inPorts =
- in: new noflo.Port
- group: new noflo.Port
- @outPorts =
- out: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ group:
+ datatype: 'string'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.in.on "connect", () =>
@count = 0
View
13 components/LastGroup.coffee
@@ -1,11 +1,16 @@
noflo = require 'noflo'
class LastGroup extends noflo.Component
+ description: 'Forward packets wrapped only using the latest emitted
+ group'
constructor: ->
- @inPorts =
- in: new noflo.Port
- @outPorts =
- out: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to forward'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@groups = []
@groupSent = 0
View
16 components/MapGroup.coffee
@@ -5,12 +5,16 @@ class MapGroup extends noflo.Component
@map = {}
@regexps = {}
- @inPorts =
- map: new noflo.ArrayPort()
- regexp: new noflo.ArrayPort()
- in: new noflo.Port()
- @outPorts =
- out: new noflo.Port()
+ @inPorts = new noflo.InPorts
+ map:
+ datatype: 'all'
+ regexp:
+ datatype: 'all'
+ in:
+ datatype: 'all'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.map.on 'data', (data) =>
@prepareMap data
View
10 components/MergeGroups.coffee
@@ -5,10 +5,12 @@ class MergeGroups extends noflo.Component
constructor: ->
@groups = {}
@data = {}
- @inPorts =
- in: new noflo.ArrayPort
- @outPorts =
- out: new noflo.ArrayPort
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.in.on 'begingroup', (group, socket) =>
@addGroup socket, group
View
13 components/Objectify.coffee
@@ -10,11 +10,14 @@ class Objectify extends noflo.Component
@regexp = null
@match = null
- @inPorts =
- in: new noflo.Port
- regexp: new noflo.Port
- @outPorts =
- out: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ regexp:
+ datatype: 'string'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.regexp.on "data", (regexp) =>
@regexp = new RegExp(regexp)
View
13 components/ReadGroup.coffee
@@ -4,11 +4,14 @@ class ReadGroup extends noflo.Component
constructor: ->
@groups = []
- @inPorts =
- in: new noflo.ArrayPort
- @outPorts =
- out: new noflo.Port
- group: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
+ group:
+ datatype: 'string'
@inPorts.in.on 'begingroup', (group) =>
@groups.push group
View
19 components/ReadGroups.coffee
@@ -6,13 +6,18 @@ class ReadGroups extends noflo.Component
@strip = false
@threshold = Infinity
- @inPorts =
- in: new noflo.ArrayPort
- strip: new noflo.Port
- threshold: new noflo.Port
- @outPorts =
- out: new noflo.Port
- group: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ strip:
+ datatype: 'string'
+ threshold:
+ datatype: 'all'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
+ group:
+ datatype: 'string'
@inPorts.threshold.on 'data', (threshold) =>
@threshold = parseInt threshold
View
13 components/Regroup.coffee
@@ -8,11 +8,14 @@ class Regroup extends noflo.Component
constructor: ->
@groups = []
- @inPorts =
- in: new noflo.Port
- group: new noflo.Port
- @outPorts =
- out: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ group:
+ datatype: ''
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.group.on "connect", =>
@groups = []
View
15 components/RemoveGroups.coffee
@@ -7,11 +7,16 @@ class RemoveGroups extends noflo.Component
constructor: ->
@regexp = null
- @inPorts =
- in: new noflo.Port
- regexp: new noflo.Port
- @outPorts =
- out: new noflo.Port
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'all'
+ description: 'IPs to forward'
+ regexp:
+ datatype: 'string'
+ description: 'Regexp used to remove groups'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
@inPorts.regexp.on "data", (regexp) =>
@regexp = new RegExp(regexp)
View
17 components/SendByGroup.coffee
@@ -11,12 +11,17 @@ class SendByGroup extends noflo.Component
@dataGroups = []
@inGroups = []
- @inPorts =
- in: new noflo.Port 'bang'
- data: new noflo.Port 'all'
-
- @outPorts =
- out: new noflo.ArrayPort 'all'
+ @inPorts = new noflo.InPorts
+ in:
+ datatype: 'bang'
+ description: 'Signal to release IPs associated with the emitted group'
+ data:
+ datatype: 'all'
+ description: 'IPs to store by group'
+ @outPorts = new noflo.OutPorts
+ out:
+ datatype: 'all'
+ description: 'IP associated with a group received on the in port'
@inPorts.data.on 'begingroup', (group) =>
@dataGroups.push group
View
8 spec/CollectGroups.coffee
@@ -13,10 +13,10 @@ describe 'CollectGroups component', ->
beforeEach ->
c = CollectGroups.getComponent()
- c.inPorts.in.attach noflo.internalSocket.createSocket()
- c.outPorts.out.attach noflo.internalSocket.createSocket()
- ins = c.inPorts.in
- out = c.outPorts.out
+ ins = noflo.internalSocket.createSocket()
+ out = noflo.internalSocket.createSocket()
+ c.inPorts.in.attach ins
+ c.outPorts.out.attach out
describe 'when instantiated', ->
it 'should have input ports', ->
View
12 spec/CollectTree.coffee
@@ -14,12 +14,12 @@ describe 'CollectTree component', ->
beforeEach ->
c = CollectTree.getComponent()
- c.inPorts.in.attach noflo.internalSocket.createSocket()
- c.outPorts.out.attach noflo.internalSocket.createSocket()
- c.outPorts.error.attach noflo.internalSocket.createSocket()
- ins = c.inPorts.in
- out = c.outPorts.out
- err = c.outPorts.error
+ ins = noflo.internalSocket.createSocket()
+ out = noflo.internalSocket.createSocket()
+ err = noflo.internalSocket.createSocket()
+ c.inPorts.in.attach ins
+ c.outPorts.out.attach out
+ c.outPorts.error.attach err
describe 'without any groups provided', ->
it 'should send an error and no data', (done) ->
View
8 spec/ReadGroup.coffee
@@ -13,10 +13,10 @@ describe 'ReadGroup component', ->
beforeEach ->
c = ReadGroup.getComponent()
- c.inPorts.in.attach noflo.internalSocket.createSocket()
- c.outPorts.group.attach noflo.internalSocket.createSocket()
- ins = c.inPorts.in
- group = c.outPorts.group
+ ins = noflo.internalSocket.createSocket()
+ group = noflo.internalSocket.createSocket()
+ c.inPorts.in.attach ins
+ c.outPorts.group.attach group
describe 'when instantiated', ->
it 'should have input ports', ->
Please sign in to comment.
Something went wrong with that request. Please try again.