Commit 34f4f310 authored by Kirill Smelkov's avatar Kirill Smelkov

~staticcheck

parent d99bf118
...@@ -388,7 +388,7 @@ func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener, bugv .. ...@@ -388,7 +388,7 @@ func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener, bugv ..
ctx := context.Background() ctx := context.Background()
watchq := make(chan zodb.Event) watchq := make(chan zodb.Event)
zdrv, at0, err := zdrvOpen(ctx, u, &zodb.DriverOptions{ReadOnly: true, Watchq: watchq}) zdrv, at0, err := zdrvOpen(ctx, u, &zodb.DriverOptions{ReadOnly: true, Watchq: watchq}); X(err)
if at0 != at { if at0 != at {
t.Fatalf("opened @ %s ; want %s", at0, at) t.Fatalf("opened @ %s ; want %s", at0, at)
} }
......
...@@ -457,9 +457,7 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) ( ...@@ -457,9 +457,7 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (
} }
name := u.Path name := u.Path
if strings.HasPrefix(name, "/") { name = strings.TrimPrefix(name, "/")
name = name[1:]
}
if name == "" { if name == "" {
return nil, zodb.InvalidTid, fmt.Errorf("cluster name not specified") return nil, zodb.InvalidTid, fmt.Errorf("cluster name not specified")
} }
......
...@@ -76,12 +76,12 @@ type _MasteredNode struct { ...@@ -76,12 +76,12 @@ type _MasteredNode struct {
type _MasteredNodeFlags int type _MasteredNodeFlags int
const ( const (
// δPartTabPassThrough tells mlink.Recv1 not to filter out messages related // δPartTabPassThrough tells mlink.Recv1 not to filter out messages related
// to partition table changes. When mlink.Recv1 receives such messages there // to partition table changes. When mlink.Recv1 receives such messages they
// are already processed internally to update .state.PartTab correspondingly. // are already processed internally to update .state.PartTab correspondingly.
// //
// Storage uses this mode to receive δPartTab notifications to know // Storage uses this mode to receive δPartTab notifications to know
// when to persist it. // when to persist it.
δPartTabPassThrough _MasteredNodeFlags = iota δPartTabPassThrough _MasteredNodeFlags = 1 << iota
) )
// newMasteredNode creates new _MasteredNode that connects to masterAddr/cluster via net. // newMasteredNode creates new _MasteredNode that connects to masterAddr/cluster via net.
......
// Copyright (c) 2001, 2002 Zope Foundation and Contributors. // Copyright (c) 2001, 2002 Zope Foundation and Contributors.
// All Rights Reserved. // All Rights Reserved.
// //
// Copyright (C) 2018-2019 Nexedi SA and Contributors. // Copyright (C) 2018-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This software is subject to the provisions of the Zope Public License, // This software is subject to the provisions of the Zope Public License,
...@@ -609,7 +609,7 @@ func (bt *btreeState) PySetState(pystate interface{}) (err error) { ...@@ -609,7 +609,7 @@ func (bt *btreeState) PySetState(pystate interface{}) (err error) {
} }
if i > 1 && !(key > kprev) { if i > 1 && !(key > kprev) {
fmt.Errorf("data: [%d]: key not ↑", i) return fmt.Errorf("data: [%d]: key not ↑", i)
} }
kprev = key kprev = key
...@@ -629,7 +629,7 @@ func (bt *btreeState) PySetState(pystate interface{}) (err error) { ...@@ -629,7 +629,7 @@ func (bt *btreeState) PySetState(pystate interface{}) (err error) {
childrenKind = kind childrenKind = kind
} }
if kind != childrenKind { if kind != childrenKind {
fmt.Errorf("data: [%d]: children must be of the same type", i) return fmt.Errorf("data: [%d]: children must be of the same type", i)
} }
bt.data = append(bt.data, Entry{key: kkey, child: child.(Node)}) bt.data = append(bt.data, Entry{key: kkey, child: child.(Node)})
......
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018-2020 Nexedi SA and Contributors. # Copyright (C) 2018-2021 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
from ZODB.DB import DB from ZODB.DB import DB
from BTrees.LOBTree import LOBucket, LOBTree from BTrees.LOBTree import LOBucket, LOBTree
from ZODB.utils import u64 from ZODB.utils import u64
from zodbtools.test.gen_testdata import run_with_zodb3py2_compat from zodbtools.test.gen_testdata import run_with_zodb4py2_compat
import os, os.path, transaction import os, os.path, transaction
from golang.gcompat import qq from golang.gcompat import qq
...@@ -89,7 +89,7 @@ def main2(): ...@@ -89,7 +89,7 @@ def main2():
db.close() db.close()
def main(): def main():
run_with_zodb3py2_compat(main2) run_with_zodb4py2_compat(main2)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Copyright (c) 2001, 2002 Zope Foundation and Contributors. // Copyright (c) 2001, 2002 Zope Foundation and Contributors.
// All Rights Reserved. // All Rights Reserved.
// //
// Copyright (C) 2018-2019 Nexedi SA and Contributors. // Copyright (C) 2018-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This software is subject to the provisions of the Zope Public License, // This software is subject to the provisions of the Zope Public License,
...@@ -197,6 +197,8 @@ func (t *IOBTree) VGet(ctx context.Context, key int32, visit func(node IONode)) ...@@ -197,6 +197,8 @@ func (t *IOBTree) VGet(ctx context.Context, key int32, visit func(node IONode))
return key < t.data[j].key return key < t.data[j].key
}) })
// FIXME panic index out of range (empty T without children;
// logically incorrect, but Restructure generated it once)
child := t.data[i].child child := t.data[i].child
t.PDeactivate() t.PDeactivate()
err = child.PActivate(ctx) err = child.PActivate(ctx)
...@@ -609,7 +611,7 @@ func (bt *iobtreeState) PySetState(pystate interface{}) (err error) { ...@@ -609,7 +611,7 @@ func (bt *iobtreeState) PySetState(pystate interface{}) (err error) {
} }
if i > 1 && !(key > kprev) { if i > 1 && !(key > kprev) {
fmt.Errorf("data: [%d]: key not ↑", i) return fmt.Errorf("data: [%d]: key not ↑", i)
} }
kprev = key kprev = key
...@@ -629,7 +631,7 @@ func (bt *iobtreeState) PySetState(pystate interface{}) (err error) { ...@@ -629,7 +631,7 @@ func (bt *iobtreeState) PySetState(pystate interface{}) (err error) {
childrenKind = kind childrenKind = kind
} }
if kind != childrenKind { if kind != childrenKind {
fmt.Errorf("data: [%d]: children must be of the same type", i) return fmt.Errorf("data: [%d]: children must be of the same type", i)
} }
bt.data = append(bt.data, IOEntry{key: kkey, child: child.(IONode)}) bt.data = append(bt.data, IOEntry{key: kkey, child: child.(IONode)})
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Copyright (c) 2001, 2002 Zope Foundation and Contributors. // Copyright (c) 2001, 2002 Zope Foundation and Contributors.
// All Rights Reserved. // All Rights Reserved.
// //
// Copyright (C) 2018-2019 Nexedi SA and Contributors. // Copyright (C) 2018-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This software is subject to the provisions of the Zope Public License, // This software is subject to the provisions of the Zope Public License,
...@@ -611,7 +611,7 @@ func (bt *lobtreeState) PySetState(pystate interface{}) (err error) { ...@@ -611,7 +611,7 @@ func (bt *lobtreeState) PySetState(pystate interface{}) (err error) {
} }
if i > 1 && !(key > kprev) { if i > 1 && !(key > kprev) {
fmt.Errorf("data: [%d]: key not ↑", i) return fmt.Errorf("data: [%d]: key not ↑", i)
} }
kprev = key kprev = key
...@@ -631,7 +631,7 @@ func (bt *lobtreeState) PySetState(pystate interface{}) (err error) { ...@@ -631,7 +631,7 @@ func (bt *lobtreeState) PySetState(pystate interface{}) (err error) {
childrenKind = kind childrenKind = kind
} }
if kind != childrenKind { if kind != childrenKind {
fmt.Errorf("data: [%d]: children must be of the same type", i) return fmt.Errorf("data: [%d]: children must be of the same type", i)
} }
bt.data = append(bt.data, LOEntry{key: kkey, child: child.(LONode)}) bt.data = append(bt.data, LOEntry{key: kkey, child: child.(LONode)})
......
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2017-2020 Nexedi SA and Contributors. # Copyright (C) 2017-2021 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"""generate reference pickle objects encoding for tests""" """generate reference pickle objects encoding for tests"""
from ZODB import serialize from ZODB import serialize
from zodbtools.test.gen_testdata import run_with_zodb3py2_compat from zodbtools.test.gen_testdata import run_with_zodb4py2_compat
from golang.gcompat import qq from golang.gcompat import qq
def main2(): def main2():
...@@ -56,7 +56,7 @@ def main2(): ...@@ -56,7 +56,7 @@ def main2():
emit("}") emit("}")
def main(): def main():
run_with_zodb3py2_compat(main2) run_with_zodb4py2_compat(main2)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -207,7 +207,7 @@ func (txnh *TxnHeader) CloneFrom(txnh2 *TxnHeader) { ...@@ -207,7 +207,7 @@ func (txnh *TxnHeader) CloneFrom(txnh2 *TxnHeader) {
type TxnLoadFlags int type TxnLoadFlags int
const ( const (
LoadAll TxnLoadFlags = 0x00 // load whole transaction header LoadAll TxnLoadFlags = 0x00 // load whole transaction header
LoadNoStrings = 0x01 // do not load user/desc/ext strings LoadNoStrings TxnLoadFlags = 0x01 // do not load user/desc/ext strings
) )
// Load reads and decodes transaction record header @ pos. // Load reads and decodes transaction record header @ pos.
......
// Copyright (C) 2018-2020 Nexedi SA and Contributors. // Copyright (C) 2018-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
...@@ -54,7 +54,7 @@ type msg struct { ...@@ -54,7 +54,7 @@ type msg struct {
type msgFlags int64 type msgFlags int64
const ( const (
msgAsync msgFlags = 1 // message does not need a reply msgAsync msgFlags = 1 // message does not need a reply
msgExcept = 2 // exception was raised on remote side (ZEO5) msgExcept msgFlags = 2 // exception was raised on remote side (ZEO5)
) )
// encoding represents messages encoding. // encoding represents messages encoding.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment