Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
b9f8b95c
Commit
b9f8b95c
authored
Dec 20, 2016
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
61606aa2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
42 deletions
+121
-42
di-plugin.js
plugins/di/di-plugin.js
+11
-18
index.js
plugins/do/do-console/index.js
+12
-0
perform.js
plugins/do/do-console/perform.js
+19
-0
do-plugin.js
plugins/do/do-plugin.js
+65
-0
perform.js
plugins/dt/dt-noop/perform.js
+2
-2
dt-plugin.js
plugins/dt/dt-plugin.js
+11
-18
example.json
test/jobs/example.json
+1
-4
No files found.
plugins/di/di-plugin.js
View file @
b9f8b95c
...
...
@@ -38,38 +38,31 @@ function DIResponse(handle){
}
DIResponse
.
prototype
.
success
=
function
(
data
,
type
){
var
self
=
this
;
var
handle
=
this
.
handle
;
this
.
data
=
data
;
this
.
status
=
'success'
;
if
(
type
){
this
.
output_type
=
type
;}
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,
response
(
'success'
,
data
,
type
)
);
handle
.
emit
(
'done'
,
{
'status'
:
'success'
,
'data'
:
data
,
'type'
:
self
.
output_type
}
);
});
}
DIResponse
.
prototype
.
error
=
function
(
err
){
var
self
=
this
;
var
handle
=
this
.
handle
;
this
.
data
=
err
;
this
.
status
=
'error'
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,
response
(
'error'
,
err
)
);
handle
.
emit
(
'done'
,
{
'status'
:
'error'
,
'data'
:
err
}
);
});
}
DIResponse
.
prototype
.
reject
=
function
(){
var
handle
=
this
.
handle
;
this
.
status
=
'reject'
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,
response
(
'reject'
,
null
)
);
handle
.
emit
(
'done'
,
{
'status'
:
'reject'
}
);
});
}
function
response
(
status
,
data
,
type
){
var
resp
=
{
'status'
:
status
,
'data'
:
data
};
if
(
type
){
resp
.
type
=
type
;
this
.
output_type
=
type
;
}
else
{
resp
.
type
=
this
.
output_type
;
}
this
.
data
=
data
;
this
.
status
=
status
;
return
resp
;
}
plugins/do/do-console/index.js
0 → 100644
View file @
b9f8b95c
var
util
=
require
(
'util'
);
var
DOPlugin
=
require
(
'../do-plugin'
);
function
DOTask
(
context
,
request
){
DOPlugin
.
call
(
this
,
context
,
request
);
this
.
name
=
"console"
;
}
util
.
inherits
(
DOTask
,
DOPlugin
);
DOTask
.
prototype
.
perform
=
require
(
'./perform'
);
module
.
exports
=
DOTask
;
plugins/do/do-console/perform.js
0 → 100644
View file @
b9f8b95c
function
perform_function
(
context
,
request
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
param
=
context
.
jobconfig
.
data_out
.
param
;
var
memstore
=
context
.
task
.
memstore
var
output_type
=
request
.
input_type
;
var
data
=
request
.
data
;
console
.
log
(
data
);
response
.
success
();
//response.reject();
//response.error("error message")
}
module
.
exports
=
perform_function
;
plugins/do/do-plugin.js
0 → 100644
View file @
b9f8b95c
var
util
=
require
(
'util'
);
var
EventEmitter
=
require
(
'events'
).
EventEmitter
;
function
DOPlugin
(
context
,
request
){
EventEmitter
.
call
(
this
);
this
.
version
=
'0.1'
;
this
.
name
=
'base'
;
this
.
jobcontext
=
context
;
this
.
request
=
request
;
}
util
.
inherits
(
DOPlugin
,
EventEmitter
);
DOPlugin
.
prototype
.
getname
=
function
(){
return
this
.
name
;
}
DOPlugin
.
prototype
.
perform
=
function
(){}
DOPlugin
.
prototype
.
run
=
function
(){
this
.
emit
(
'start'
);
var
resp
=
new
DOResponse
(
this
);
this
.
perform
(
this
.
jobcontext
,
this
.
request
,
resp
);
}
module
.
exports
=
DOPlugin
;
/*
DOResponse
*/
function
DOResponse
(
handle
){
this
.
handle
=
handle
;
this
.
status
=
null
;
this
.
data
=
null
;
}
DOResponse
.
prototype
.
success
=
function
(
data
){
var
handle
=
this
.
handle
;
this
.
status
=
'success'
;
this
.
data
=
data
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,{
'status'
:
'success'
,
'data'
:
data
});
});
}
DOResponse
.
prototype
.
error
=
function
(
err
){
var
handle
=
this
.
handle
;
this
.
status
=
'error'
;
this
.
data
=
err
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,{
'status'
:
'error'
,
'data'
:
err
});
});
}
DOResponse
.
prototype
.
reject
=
function
(){
var
handle
=
this
.
handle
;
this
.
status
=
'reject'
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,{
'status'
:
'reject'
,
'data'
:
null
});
});
}
plugins/dt/dt-noop/perform.js
View file @
b9f8b95c
function
perform_function
(
context
,
request
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
param
=
context
.
jobconfig
.
data_
in
.
param
;
var
param
=
context
.
jobconfig
.
data_
transform
.
param
;
var
memstore
=
context
.
task
.
memstore
var
output_type
=
request
.
input_type
;
...
...
@@ -15,7 +15,7 @@ function perform_function(context,request,response){
// memstore.getItem('lasttransaction',function(err,value){
// response.success(value);
// });
data
=
data
+
"--DT--"
//
data = data + "--DT--"
response
.
success
(
data
,
output_type
);
//response.reject();
...
...
plugins/dt/dt-plugin.js
View file @
b9f8b95c
...
...
@@ -39,38 +39,31 @@ function DTResponse(handle){
}
DTResponse
.
prototype
.
success
=
function
(
data
,
type
){
var
self
=
this
;
var
handle
=
this
.
handle
;
this
.
data
=
data
;
this
.
status
=
'success'
;
if
(
type
){
this
.
output_type
=
type
;}
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,
response
(
'success'
,
data
,
type
)
);
handle
.
emit
(
'done'
,
{
'status'
:
'success'
,
'data'
:
data
,
'type'
:
self
.
output_type
}
);
});
}
DTResponse
.
prototype
.
error
=
function
(
err
){
var
self
=
this
;
var
handle
=
this
.
handle
;
this
.
data
=
err
;
this
.
status
=
'error'
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,
response
(
'error'
,
err
)
);
handle
.
emit
(
'done'
,
{
'status'
:
'error'
,
'data'
:
err
}
);
});
}
DTResponse
.
prototype
.
reject
=
function
(){
var
handle
=
this
.
handle
;
this
.
status
=
'reject'
;
process
.
nextTick
(
function
(){
handle
.
emit
(
'done'
,
response
(
'reject'
,
null
)
);
handle
.
emit
(
'done'
,
{
'status'
:
'reject'
}
);
});
}
function
response
(
status
,
data
,
type
){
var
resp
=
{
'status'
:
status
,
'data'
:
data
};
if
(
type
){
resp
.
type
=
type
;
this
.
output_type
=
type
;
}
else
{
resp
.
type
=
this
.
output_type
;
}
this
.
data
=
data
;
this
.
status
=
status
;
return
resp
;
}
test/jobs/example.json
View file @
b9f8b95c
...
...
@@ -12,9 +12,6 @@
"type"
:
"noop"
},
"data_out"
:
{
"type"
:
"bss-storage"
,
"param"
:
{
"name"
:
"sds.agritronics"
}
"type"
:
"console"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment