(self, type)
| 1080 | } |
| 1081 | |
| 1082 | function updMeta(self, type) { |
| 1083 | var buf; |
| 1084 | switch (type) { |
| 1085 | |
| 1086 | case META_PAGE_ADD: |
| 1087 | buf = U.createBufferSize(4); |
| 1088 | buf.writeUInt32LE(self.header.pages); |
| 1089 | Fs.write(self.fd, buf, 0, buf.length, 31, self.cb_error); |
| 1090 | break; |
| 1091 | |
| 1092 | case META_PAGE_ADD3: |
| 1093 | buf = U.createBufferSize(4); |
| 1094 | buf.writeUInt32LE(self.header.pages, 0); |
| 1095 | Fs.write(self.fd, buf, 0, buf.length, 31, function() { |
| 1096 | buf.writeUInt32LE(self.header.relationpageindex, 0); |
| 1097 | Fs.write(self.fd, buf, 0, buf.length, 47, self.cb_error); |
| 1098 | }); |
| 1099 | break; |
| 1100 | |
| 1101 | case META_RELATIONPAGEINDEX: |
| 1102 | buf = U.createBufferSize(4); |
| 1103 | buf.writeUInt32LE(self.header.relationpageindex, 0); |
| 1104 | Fs.write(self.fd, buf, 0, buf.length, 47, self.cb_error); |
| 1105 | break; |
| 1106 | |
| 1107 | case META_CLASSESRELATIONS: |
| 1108 | |
| 1109 | var obj = {}; |
| 1110 | obj.c = []; // classes |
| 1111 | obj.r = []; // relations |
| 1112 | |
| 1113 | for (var i = 0; i < self.header.classindex; i++) { |
| 1114 | var item = self.$classes[i + 1]; |
| 1115 | obj.c.push({ n: item.name, i: item.index, p: item.pageindex, r: item.schema.raw, d: item.documentindex }); |
| 1116 | } |
| 1117 | |
| 1118 | for (var i = 0; i < self.header.relationindex; i++) { |
| 1119 | var item = self.$relations[i + 1]; |
| 1120 | obj.r.push({ n: item.name, i: item.index, p: item.pageindex, b: item.both ? 1 :0, d: item.documentindex }); |
| 1121 | } |
| 1122 | |
| 1123 | buf = U.createBufferSize(HEADERSIZE - 45); |
| 1124 | buf.writeUInt8(self.header.classindex, 0); |
| 1125 | buf.writeUInt8(self.header.relationindex, 1); |
| 1126 | buf.writeUInt32LE(self.header.relationpageindex, 2); |
| 1127 | buf.write(JSON.stringify(obj), 6); |
| 1128 | Fs.write(self.fd, buf, 0, buf.length, 45, self.cb_error); |
| 1129 | break; |
| 1130 | } |
| 1131 | } |
| 1132 | |
| 1133 | function insDocument(self) { |
| 1134 |
no outgoing calls
no test coverage detected