2 constructor(seqnum, machineid, prevhmac, hmac) {
4 this.RESERVED_SPACE = 64;
6 (typeof seqnum === "number") ? this.seqnum = seqnum: throw new Error("seqnum should be a number");
7 (typeof machineid === "number") ? this.machineid = seqnum: throw new Error("machine should be a number");
9 this.seqnumlive = true;
10 (prevhmac && prevhmac instanceof Uint8Array) ? this.prevhmac = prevhmac: this.prevhmac = new Uint8Array(this.HMAC_SIZE));
11 (hmac && hmac instanceof Uint8Array) ? this.hmac = hmac: this.hmac = null;
13 this.freespace = this.SLOT_SIZE - getBaseSize(); //???????
22 if (entry && entry instanceof Entry) {
24 this.entries.push(_.extend(obj, entry));
26 freespace -= entry.getSize();
29 addShallowEntry(entry){
30 if(entry && entry instanceof Entry){
31 this.entries.push(entry);
33 freespace -= entry.getSize();
37 var newfreespace = this.freespace - entry.getSize();
38 return newfreespace > this.RESERVED_SPACE;
41 var newfreespace = this.freespace - entry.getSize();
42 return newfreespace >= 0;
48 var cond1 = (array && array instanceof Uint8Array);