Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
fd0edf32
Commit
fd0edf32
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
JS API: added `routing` method
parent
2227dcb9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/webmin.controller.js
+1
-8
1 addition, 8 deletions
app/controllers/webmin.controller.js
index.js
+1
-8
1 addition, 8 deletions
index.js
server.js
+14
-0
14 additions, 0 deletions
server.js
with
16 additions
and
16 deletions
app/controllers/webmin.controller.js
+
1
−
8
View file @
fd0edf32
...
@@ -19,7 +19,6 @@ let bma = require('../lib/streams/bma');
...
@@ -19,7 +19,6 @@ let bma = require('../lib/streams/bma');
let
Identity
=
require
(
'
../lib/entity/identity
'
);
let
Identity
=
require
(
'
../lib/entity/identity
'
);
let
network
=
require
(
'
../lib/network
'
);
let
network
=
require
(
'
../lib/network
'
);
let
AbstractController
=
require
(
'
../controllers/abstract
'
);
let
AbstractController
=
require
(
'
../controllers/abstract
'
);
var
multicaster
=
require
(
'
../lib/streams/multicaster
'
);
var
logger
=
require
(
'
../lib/logger
'
)(
'
webmin
'
);
var
logger
=
require
(
'
../lib/logger
'
)(
'
webmin
'
);
module
.
exports
=
(
dbConf
,
overConf
)
=>
{
module
.
exports
=
(
dbConf
,
overConf
)
=>
{
...
@@ -49,13 +48,7 @@ function WebAdmin (dbConf, overConf) {
...
@@ -49,13 +48,7 @@ function WebAdmin (dbConf, overConf) {
yield
pluggedConfP
;
yield
pluggedConfP
;
// Routing documents
// Routing documents
server
server
.
routing
();
// The router asks for multicasting of documents
.
pipe
(
server
.
router
())
// The documents get sent to peers
.
pipe
(
multicaster
(
server
.
conf
))
// The multicaster may answer 'unreachable peer'
.
pipe
(
server
.
router
());
return
plugForDAL
();
return
plugForDAL
();
});
});
...
...
This diff is collapsed.
Click to expand it.
index.js
+
1
−
8
View file @
fd0edf32
...
@@ -5,7 +5,6 @@ var Server = require('./server');
...
@@ -5,7 +5,6 @@ var Server = require('./server');
var
bma
=
require
(
'
./app/lib/streams/bma
'
);
var
bma
=
require
(
'
./app/lib/streams/bma
'
);
var
webmin
=
require
(
'
./app/lib/streams/webmin
'
);
var
webmin
=
require
(
'
./app/lib/streams/webmin
'
);
var
upnp
=
require
(
'
./app/lib/upnp
'
);
var
upnp
=
require
(
'
./app/lib/upnp
'
);
var
multicaster
=
require
(
'
./app/lib/streams/multicaster
'
);
var
logger
=
require
(
'
./app/lib/logger
'
)(
'
ucoin
'
);
var
logger
=
require
(
'
./app/lib/logger
'
)(
'
ucoin
'
);
module
.
exports
=
function
(
dbConf
,
overConf
)
{
module
.
exports
=
function
(
dbConf
,
overConf
)
{
...
@@ -27,13 +26,7 @@ module.exports.statics = {
...
@@ -27,13 +26,7 @@ module.exports.statics = {
let
bmapi
=
yield
bma
(
server
,
null
,
conf
.
httplogs
);
let
bmapi
=
yield
bma
(
server
,
null
,
conf
.
httplogs
);
// Routing documents
// Routing documents
server
server
.
routing
();
// The router asks for multicasting of documents
.
pipe
(
server
.
router
())
// The documents get sent to peers
.
pipe
(
multicaster
(
server
.
conf
))
// The multicaster may answer 'unreachable peer'
.
pipe
(
server
.
router
());
// Services
// Services
yield
module
.
exports
.
statics
.
startServices
(
server
);
yield
module
.
exports
.
statics
.
startServices
(
server
);
...
...
This diff is collapsed.
Click to expand it.
server.js
+
14
−
0
View file @
fd0edf32
...
@@ -17,6 +17,7 @@ var signature = require('./app/lib/signature');
...
@@ -17,6 +17,7 @@ var signature = require('./app/lib/signature');
var
directory
=
require
(
'
./app/lib/directory
'
);
var
directory
=
require
(
'
./app/lib/directory
'
);
var
dos2unix
=
require
(
'
./app/lib/dos2unix
'
);
var
dos2unix
=
require
(
'
./app/lib/dos2unix
'
);
var
Synchroniser
=
require
(
'
./app/lib/sync
'
);
var
Synchroniser
=
require
(
'
./app/lib/sync
'
);
var
multicaster
=
require
(
'
./app/lib/streams/multicaster
'
);
function
Server
(
dbConf
,
overrideConf
)
{
function
Server
(
dbConf
,
overrideConf
)
{
...
@@ -429,6 +430,19 @@ function Server (dbConf, overrideConf) {
...
@@ -429,6 +430,19 @@ function Server (dbConf, overrideConf) {
};
};
};
};
/**
* Enable routing features:
* - The server will try to send documents to the network
* - The server will eventually be notified of network failures
*/
this
.
routing
=
()
=>
{
// The router asks for multicasting of documents
this
.
pipe
(
this
.
router
())
// The documents get sent to peers
.
pipe
(
multicaster
(
this
.
conf
))
// The multicaster may answer 'unreachable peer'
.
pipe
(
this
.
router
());
};
}
}
util
.
inherits
(
Server
,
stream
.
Duplex
);
util
.
inherits
(
Server
,
stream
.
Duplex
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment