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
30b46dd7
Commit
30b46dd7
authored
Jan 24, 2017
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
185af7fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
serv-storage.js
serv-storage.js
+1
-1
main.js
storage-service/main.js
+25
-14
No files found.
serv-storage.js
View file @
30b46dd7
var
ctx
=
require
(
'./context'
);
var
ctx
=
require
(
'./context'
);
var
StorageService
=
ctx
.
getLib
(
'storage-service/main'
);
var
StorageService
=
ctx
.
getLib
(
'storage-service/main'
);
var
ss
=
new
StorageServic
e
(
ctx
.
config
);
var
ss
=
StorageService
.
creat
e
(
ctx
.
config
);
ss
.
start
();
ss
.
start
();
storage-service/main.js
View file @
30b46dd7
var
ctx
=
require
(
'../context'
);
var
ctx
=
require
(
'../context'
);
var
rpcserver
=
ctx
.
getLib
(
'lib/amqp/rpcserver'
);
var
rpcserver
=
ctx
.
getLib
(
'lib/amqp/rpcserver'
);
module
.
exports
=
StorageService
;
module
.
exports
.
create
=
function
(
cfg
)
function
StorageService
(
cfg
)
{
var
ss
=
new
SS
(
cfg
);
return
ss
;
}
var
SS
=
function
StorageService
(
cfg
)
{
{
this
.
config
=
cfg
;
this
.
config
=
cfg
;
}
}
S
torageService
.
prototype
.
start
=
function
()
S
S
.
prototype
.
start
=
function
()
{
{
console
.
log
(
'Starting Storage Service ...
\
n'
);
console
.
log
(
'Starting Storage Service ...
\
n'
);
amqp_start
(
this
.
config
);
this
.
amqp_start
(
);
http_start
(
this
.
config
);
this
.
http_start
(
);
}
}
function
amqp_start
(
cfg
)
SS
.
prototype
.
amqp_start
=
function
(
)
{
{
var
amqp_cfg
=
cf
g
.
amqp
;
var
amqp_cfg
=
this
.
confi
g
.
amqp
;
var
server
=
new
rpcserver
({
if
(
this
.
amqp_server
){
return
;}
this
.
amqp_server
=
new
rpcserver
({
url
:
amqp_cfg
.
url
,
url
:
amqp_cfg
.
url
,
name
:
'storage_request'
name
:
'storage_request'
});
});
server
.
set_remote_function
(
function
(
req
,
callback
){
this
.
amqp_
server
.
set_remote_function
(
function
(
req
,
callback
){
var
n
=
parseInt
(
req
.
t
);
var
n
=
parseInt
(
req
.
t
);
console
.
log
(
'REQUEST '
+
req
);
console
.
log
(
'REQUEST '
+
req
);
setTimeout
(
function
(){
setTimeout
(
function
(){
callback
(
null
,{
'time'
:
n
,
'data'
:
req
.
d
});
callback
(
null
,{
'time'
:
n
,
'data'
:
req
.
d
});
},
n
);
},
n
);
})
})
;
server
.
start
(
function
(
err
){
this
.
amqp_
server
.
start
(
function
(
err
){
if
(
!
err
){
if
(
!
err
){
console
.
log
(
'AMQP START
\
t
\
t
\
t[OK]'
);
console
.
log
(
'SS:AMQP START
\
t
\
t
\
t[OK]'
);
}
else
{
console
.
log
(
'SS:AMQP START
\
t
\
t
\
t[ERR]'
);
console
.
log
(
err
.
message
);
}
}
});
});
}
}
function
http_start
(
cfg
)
SS
.
prototype
.
http_start
=
function
(
)
{
{
var
http
=
require
(
'http'
);
var
http
=
require
(
'http'
);
http
.
createServer
(
function
(
req
,
res
)
{
http
.
createServer
(
function
(
req
,
res
)
{
...
@@ -46,5 +56,6 @@ function http_start(cfg)
...
@@ -46,5 +56,6 @@ function http_start(cfg)
});
});
res
.
end
(
"req http "
+
String
(
(
new
Date
()).
getTime
()
));
res
.
end
(
"req http "
+
String
(
(
new
Date
()).
getTime
()
));
}).
listen
(
9080
,
""
);
}).
listen
(
19080
,
""
);
console
.
log
(
'SS:DATA_API START
\
t
\
t[OK]'
);
}
}
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