(self, relation, index, callback, between)
| 700 | } |
| 701 | |
| 702 | function addRelationDocument(self, relation, index, callback, between) { |
| 703 | |
| 704 | // meta.typeid (1 CLASS, 2 RELATION, 3 PRIVATE RELATION) |
| 705 | // meta.type (link to type class/relation) |
| 706 | // meta.state |
| 707 | // meta.parentindex |
| 708 | // meta.relationindex |
| 709 | // meta.size |
| 710 | // meta.data |
| 711 | |
| 712 | var meta = {}; |
| 713 | meta.typeid = between ? TYPE_RELATION_DOCUMENT : TYPE_RELATION; |
| 714 | meta.type = between ? { index: 0, pageindex: self.header.relationpageindex, documentindex: index, locked: false, private: true } : relation; |
| 715 | meta.state = 1; |
| 716 | meta.parentindex = 0; |
| 717 | meta.relationindex = 0; |
| 718 | meta.size = 0; |
| 719 | |
| 720 | // Creates a new node |
| 721 | addNode(self, meta, function(err, relationindex) { |
| 722 | |
| 723 | // Updates exiting document by updating relation index |
| 724 | updDocumentRelation(self, index, relationindex, function(err) { |
| 725 | // Returns a new relation index |
| 726 | callback(err, relationindex); |
| 727 | }); |
| 728 | }); |
| 729 | } |
| 730 | |
| 731 | function findDocumentFree(self, pageindex, callback, ready) { |
| 732 |
no test coverage detected