implemented resetAuth

This commit is contained in:
Kevin Jahns 2016-11-21 01:22:15 +01:00
parent 102bef4f92
commit e90f241ae0
4 changed files with 15 additions and 2 deletions

2
dist

@ -1 +1 @@
Subproject commit afa05b62a1698be509bf5d93a2aea3d4b46cf93a Subproject commit b613630cef15fc641d5def0db5513fa19234e0a9

View File

@ -60,6 +60,15 @@ module.exports = function (Y/* :any */) {
this.authInfo = opts.auth || null this.authInfo = opts.auth || null
this.checkAuth = opts.checkAuth || function () { return Promise.resolve('write') } // default is everyone has write access this.checkAuth = opts.checkAuth || function () { return Promise.resolve('write') } // default is everyone has write access
} }
resetAuth (auth) {
if (this.authInfo !== auth) {
this.authInfo = auth
this.broadcast({
type: 'auth',
auth: this.authInfo
})
}
}
reconnect () { reconnect () {
} }
disconnect () { disconnect () {
@ -296,7 +305,6 @@ module.exports = function (Y/* :any */) {
type: 'sync done' type: 'sync done'
}) })
} }
conn._setSyncedWith(sender)
}) })
} else if (message.type === 'sync step 2' && canWrite(auth)) { } else if (message.type === 'sync step 2' && canWrite(auth)) {
let conn = this let conn = this

View File

@ -188,6 +188,8 @@ module.exports = function (Y /* :any */) {
} }
stopGarbageCollector () { stopGarbageCollector () {
var self = this var self = this
this.gc = false
this.gcTimeout = -1
return new Promise(function (resolve) { return new Promise(function (resolve) {
self.requestTransaction(function * () { self.requestTransaction(function * () {
var ungc /* :Array<Struct> */ = self.gc1.concat(self.gc2) var ungc /* :Array<Struct> */ = self.gc1.concat(self.gc2)

View File

@ -369,6 +369,9 @@ module.exports = function (Y/* :any */) {
if (this.store.gc1.length > 0 || this.store.gc2.length > 0) { if (this.store.gc1.length > 0 || this.store.gc2.length > 0) {
console.warn('gc should be empty after sync') console.warn('gc should be empty after sync')
} }
if (!this.store.gc) {
return
}
yield* this.os.iterate(this, null, null, function * (op) { yield* this.os.iterate(this, null, null, function * (op) {
if (op.gc) { if (op.gc) {
delete op.gc delete op.gc