MCPcopy Index your code
hub / github.com/strongloop/loopback / replicate

Function replicate

test/replication.test.js:1805–1830  ·  view source on GitHub ↗
(source, target, since, next)

Source from the content-addressed store, hash-verified

1803
1804 const _since = {};
1805 function replicate(source, target, since, next) {
1806 if (typeof since === 'function') {
1807 next = since;
1808 since = undefined;
1809 }
1810
1811 const sinceIx = source.modelName + ':to:' + target.modelName;
1812 if (since === undefined) {
1813 since = useSinceFilter ?
1814 _since[sinceIx] || -1 :
1815 -1;
1816 }
1817
1818 debug('replicate from %s to %s since %j',
1819 source.modelName, target.modelName, since);
1820
1821 source.replicate(since, target, function(err, conflicts, cps) {
1822 if (err) return next(err);
1823
1824 if (conflicts.length === 0) {
1825 _since[sinceIx] = cps;
1826 }
1827
1828 next(err, conflicts, cps);
1829 });
1830 }
1831
1832 function createModel(Model, data) {
1833 return function create(next) {

Callers 3

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…