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
6399c040
Commit
6399c040
authored
Feb 02, 2017
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
2fcd4226
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
8 deletions
+46
-8
perform.js
plugins/do/do-storage/perform.js
+45
-7
dataevent.js
storage-service/lib/dataevent.js
+1
-1
No files found.
plugins/do/do-storage/perform.js
View file @
6399c040
...
@@ -4,6 +4,8 @@ var RPCCaller = ctx.getLib('lib/amqp/rpccaller');
...
@@ -4,6 +4,8 @@ var RPCCaller = ctx.getLib('lib/amqp/rpccaller');
var
BinStream
=
ctx
.
getLib
(
'lib/bss/binarystream_v1_1'
);
var
BinStream
=
ctx
.
getLib
(
'lib/bss/binarystream_v1_1'
);
var
bsdata
=
ctx
.
getLib
(
'lib/model/bsdata'
);
var
bsdata
=
ctx
.
getLib
(
'lib/model/bsdata'
);
var
async
=
require
(
'async'
);
function
perform_function
(
context
,
request
,
response
){
function
perform_function
(
context
,
request
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
transaction_id
=
context
.
transaction
.
id
;
...
@@ -26,8 +28,48 @@ function perform_function(context,request,response){
...
@@ -26,8 +28,48 @@ function perform_function(context,request,response){
"_tid"
:
transaction_id
,
"_tid"
:
transaction_id
,
"_ts"
:
Math
.
round
((
new
Date
).
getTime
()
/
1000
)
"_ts"
:
Math
.
round
((
new
Date
).
getTime
()
/
1000
)
}
}
var
dc_data
=
bsdata
.
create
(
data
).
serialize
(
'object-encoded'
);
if
(
Array
.
isArray
(
data
)){
var
idx
=
0
;
async
.
whilst
(
function
()
{
return
idx
<
data
.
length
;
},
function
(
callback
)
{
var
el_data
=
bsdata
.
create
(
data
[
idx
]).
serialize
(
'object-encoded'
);
send_storage
(
caller
,
dc_meta
,
el_data
,
storage_name
,
function
(
err
){
idx
++
;
if
(
!
err
){
callback
(
null
);
}
else
{
callback
(
err
);
}
});
},
function
(
err
)
{
if
(
!
err
){
response
.
success
();
}
else
{
response
.
error
(
"storage error"
);
}
}
);
}
else
{
var
dc_data
=
bsdata
.
create
(
data
).
serialize
(
'object-encoded'
);
send_storage
(
caller
,
dc_meta
,
dc_data
,
storage_name
,
function
(
err
){
if
(
!
err
){
response
.
success
();
}
else
{
response
.
error
(
"storage error"
);
}
});
}
}
function
send_storage
(
caller
,
dc_meta
,
dc_data
,
storage_name
,
cb
)
{
var
req
=
{
var
req
=
{
'object_type'
:
'storage_request'
,
'object_type'
:
'storage_request'
,
'command'
:
'write'
,
'command'
:
'write'
,
...
@@ -44,16 +86,12 @@ function perform_function(context,request,response){
...
@@ -44,16 +86,12 @@ function perform_function(context,request,response){
caller
.
call
(
req
,
function
(
err
,
resp
){
caller
.
call
(
req
,
function
(
err
,
resp
){
if
(
!
err
&&
resp
.
status
==
'OK'
){
if
(
!
err
&&
resp
.
status
==
'OK'
){
response
.
success
(
);
cb
(
null
);
}
else
{
}
else
{
response
.
error
(
"storage error"
)
cb
(
"error"
);
}
}
});
});
// response.success();
// response.reject();
// response.error("error message")
}
}
module
.
exports
=
perform_function
;
module
.
exports
=
perform_function
;
storage-service/lib/dataevent.js
View file @
6399c040
...
@@ -25,7 +25,7 @@ module.exports.newdata = function(prm,cb){
...
@@ -25,7 +25,7 @@ module.exports.newdata = function(prm,cb){
'resource_id'
:
objId
,
'resource_id'
:
objId
,
'resource_location'
:
obj_api_url
+
'/'
+
storageId
+
'.'
+
objId
'resource_location'
:
obj_api_url
+
'/'
+
storageId
+
'.'
+
objId
}
}
//console.log(objMsg);
var
msg
=
JSON
.
stringify
(
objMsg
);
var
msg
=
JSON
.
stringify
(
objMsg
);
ch
.
assertExchange
(
ex
,
'topic'
,
{
durable
:
false
});
ch
.
assertExchange
(
ex
,
'topic'
,
{
durable
:
false
});
...
...
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