updates
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// This file is autogenerated by the hyperschema compiler
|
||||
// Schema Version: 1
|
||||
// Schema Version: 2
|
||||
/* eslint-disable camelcase */
|
||||
/* eslint-disable quotes */
|
||||
/* eslint-disable space-before-function-paren */
|
||||
|
||||
import { c } from 'hyperschema/runtime'
|
||||
|
||||
const VERSION = 1
|
||||
const VERSION = 2
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let version = VERSION
|
||||
@@ -75,7 +75,7 @@ const encoding1 = {
|
||||
preencode(state, m) {
|
||||
c.string.preencode(state, m.localNodeId)
|
||||
c.string.preencode(state, m.remotePublicKey)
|
||||
state.end++ // max flag is 16 so always one byte
|
||||
state.end++ // max flag is 32 so always one byte
|
||||
|
||||
if (m.role) c.string.preencode(state, m.role)
|
||||
if (m.alias) c.string.preencode(state, m.alias)
|
||||
@@ -83,6 +83,7 @@ const encoding1 = {
|
||||
if (m.syncMode) c.string.preencode(state, m.syncMode)
|
||||
c.uint.preencode(state, m.linkedAt)
|
||||
if (m.lastSeen) c.uint.preencode(state, m.lastSeen)
|
||||
if (version >= 2 && m.discoveryKeyHex) c.string.preencode(state, m.discoveryKeyHex)
|
||||
},
|
||||
encode(state, m) {
|
||||
const flags =
|
||||
@@ -90,7 +91,8 @@ const encoding1 = {
|
||||
(m.alias ? 2 : 0) |
|
||||
(m.dbKeyHex ? 4 : 0) |
|
||||
(m.syncMode ? 8 : 0) |
|
||||
(m.lastSeen ? 16 : 0)
|
||||
(m.lastSeen ? 16 : 0) |
|
||||
((version >= 2 && m.discoveryKeyHex) ? 32 : 0)
|
||||
|
||||
c.string.encode(state, m.localNodeId)
|
||||
c.string.encode(state, m.remotePublicKey)
|
||||
@@ -102,6 +104,7 @@ const encoding1 = {
|
||||
if (m.syncMode) c.string.encode(state, m.syncMode)
|
||||
c.uint.encode(state, m.linkedAt)
|
||||
if (m.lastSeen) c.uint.encode(state, m.lastSeen)
|
||||
if (version >= 2 && m.discoveryKeyHex) c.string.encode(state, m.discoveryKeyHex)
|
||||
},
|
||||
decode(state) {
|
||||
const r0 = c.string.decode(state)
|
||||
@@ -116,7 +119,8 @@ const encoding1 = {
|
||||
dbKeyHex: (flags & 4) !== 0 ? c.string.decode(state) : null,
|
||||
syncMode: (flags & 8) !== 0 ? c.string.decode(state) : null,
|
||||
linkedAt: c.uint.decode(state),
|
||||
lastSeen: (flags & 16) !== 0 ? c.uint.decode(state) : 0
|
||||
lastSeen: (flags & 16) !== 0 ? c.uint.decode(state) : 0,
|
||||
discoveryKeyHex: (version >= 2 && (flags & 32) !== 0) ? c.string.decode(state) : null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,7 +368,7 @@ const encoding6 = {
|
||||
// @peardata/peer-link/hyperdb#1
|
||||
const encoding7 = {
|
||||
preencode(state, m) {
|
||||
state.end++ // max flag is 16 so always one byte
|
||||
state.end++ // max flag is 32 so always one byte
|
||||
|
||||
if (m.role) c.string.preencode(state, m.role)
|
||||
if (m.alias) c.string.preencode(state, m.alias)
|
||||
@@ -372,6 +376,7 @@ const encoding7 = {
|
||||
if (m.syncMode) c.string.preencode(state, m.syncMode)
|
||||
c.uint.preencode(state, m.linkedAt)
|
||||
if (m.lastSeen) c.uint.preencode(state, m.lastSeen)
|
||||
if (version >= 2 && m.discoveryKeyHex) c.string.preencode(state, m.discoveryKeyHex)
|
||||
},
|
||||
encode(state, m) {
|
||||
const flags =
|
||||
@@ -379,7 +384,8 @@ const encoding7 = {
|
||||
(m.alias ? 2 : 0) |
|
||||
(m.dbKeyHex ? 4 : 0) |
|
||||
(m.syncMode ? 8 : 0) |
|
||||
(m.lastSeen ? 16 : 0)
|
||||
(m.lastSeen ? 16 : 0) |
|
||||
((version >= 2 && m.discoveryKeyHex) ? 32 : 0)
|
||||
|
||||
c.uint.encode(state, flags)
|
||||
|
||||
@@ -389,6 +395,7 @@ const encoding7 = {
|
||||
if (m.syncMode) c.string.encode(state, m.syncMode)
|
||||
c.uint.encode(state, m.linkedAt)
|
||||
if (m.lastSeen) c.uint.encode(state, m.lastSeen)
|
||||
if (version >= 2 && m.discoveryKeyHex) c.string.encode(state, m.discoveryKeyHex)
|
||||
},
|
||||
decode(state) {
|
||||
const flags = c.uint.decode(state)
|
||||
@@ -401,7 +408,8 @@ const encoding7 = {
|
||||
dbKeyHex: (flags & 4) !== 0 ? c.string.decode(state) : null,
|
||||
syncMode: (flags & 8) !== 0 ? c.string.decode(state) : null,
|
||||
linkedAt: c.uint.decode(state),
|
||||
lastSeen: (flags & 16) !== 0 ? c.uint.decode(state) : 0
|
||||
lastSeen: (flags & 16) !== 0 ? c.uint.decode(state) : 0,
|
||||
discoveryKeyHex: (version >= 2 && (flags & 32) !== 0) ? c.string.decode(state) : null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user