MCPcopy Index your code
hub / github.com/totaljs/framework / process

Function process

graphdb.js:1700–1803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1698 };
1699
1700 var process = function() {
1701
1702 pageindex++;
1703
1704 // ==== DB:PAGE (20b)
1705 // type (1b) = from: 0
1706 // index (1b) = from: 1
1707 // documents (2b) = from: 2
1708 // freeslots (1b) = from: 4
1709 // parentindex (4b) = from: 5
1710
1711 // ==== DB:DOCUMENT (SIZE)
1712 // type (1b) = from: 0
1713 // index (1b) = from: 1
1714 // state (1b) = from: 2
1715 // pageindex (4b) = from: 3
1716 // relationindex (4b) = from: 7 (it's for relations between two documents in TYPE_RELATION page)
1717 // parentindex (4b) = from: 11
1718 // size/count (2b) = from: 15
1719 // data = from: 17
1720
1721 var buf = U.createBufferSize(size);
1722
1723 Fs.read(self.fd, buf, 0, buf.length, offset, function(err, size) {
1724
1725 if (!size) {
1726 finish();
1727 return;
1728 }
1729
1730 var newbuf = U.createBufferSize(newsize);
1731
1732 // Copies page info
1733 newbuf.fill(buf, 0, self.header.pagesize);
1734 buf = buf.slice(self.header.pagesize);
1735
1736 var index = self.header.pagesize;
1737 var documents = 0;
1738
1739 (self.header.pagelimit).async(function(i, next) {
1740
1741 // Unexpected problem
1742 if (!buf.length) {
1743 next();
1744 return;
1745 }
1746
1747 var docbuf = buf.slice(0, self.header.documentsize);
1748 var typeid = docbuf[0];
1749 var indexid = docbuf[1];
1750
1751 if (docbuf[2] !== STATE_REMOVED) {
1752 totaldocuments++;
1753 documents++;
1754 }
1755
1756 if (docbuf[2] !== STATE_REMOVED && meta.classes && typeid === TYPE_CLASS && meta.classes[indexid]) {
1757 readvalue(docbuf, function(value) {

Callers 2

graphdb.jsFile · 0.70
readerFunction · 0.70

Calls 8

readvalueFunction · 0.85
stringifyDataFunction · 0.85
parseDataFunction · 0.85
writevalueFunction · 0.85
readerFunction · 0.85
callbackFunction · 0.85
finishFunction · 0.70
nextFunction · 0.70

Tested by

no test coverage detected