Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
68609005
Commit
68609005
authored
Jul 06, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2f69e47b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
52 deletions
+78
-52
go/zodb/zodbtools/catobj.go
go/zodb/zodbtools/catobj.go
+30
-18
go/zodb/zodbtools/dump.go
go/zodb/zodbtools/dump.go
+18
-11
go/zodb/zodbtools/info.go
go/zodb/zodbtools/info.go
+14
-7
go/zodb/zodbtools/watch.go
go/zodb/zodbtools/watch.go
+16
-16
No files found.
go/zodb/zodbtools/catobj.go
View file @
68609005
// Copyright (C) 2017-20
19
Nexedi SA and Contributors.
// Copyright (C) 2017-20
20
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -125,25 +125,37 @@ func catobjMain(argv []string) {
}
ctx
:=
context
.
Background
()
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
// TODO defer stor.Close()
catobj
:=
func
(
xid
zodb
.
Xid
)
error
{
if
raw
{
return
Catobj
(
ctx
,
os
.
Stdout
,
stor
,
xid
)
}
else
{
return
Dumpobj
(
ctx
,
os
.
Stdout
,
stor
,
xid
,
hashOnly
)
err
:=
func
()
(
err
error
)
{
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
return
err
}
defer
func
()
{
err2
:=
stor
.
Close
()
if
err
==
nil
{
err
=
err2
}
}()
catobj
:=
func
(
xid
zodb
.
Xid
)
error
{
if
raw
{
return
Catobj
(
ctx
,
os
.
Stdout
,
stor
,
xid
)
}
else
{
return
Dumpobj
(
ctx
,
os
.
Stdout
,
stor
,
xid
,
hashOnly
)
}
}
}
for
_
,
xid
:=
range
xidv
{
err
=
catobj
(
xid
)
if
err
!=
nil
{
prog
.
Fatal
(
err
)
for
_
,
xid
:=
range
xidv
{
err
=
catobj
(
xid
)
if
err
!=
nil
{
return
err
}
}
return
nil
}()
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
}
go/zodb/zodbtools/dump.go
View file @
68609005
...
...
@@ -256,20 +256,27 @@ func dumpMain(argv []string) {
tidRange
=
argv
[
1
]
}
tidMin
,
tidMax
,
err
:=
zodb
.
ParseTidRange
(
tidRange
)
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
ctx
:=
context
.
Background
()
err
:=
func
()
(
err
error
)
{
tidMin
,
tidMax
,
err
:=
zodb
.
ParseTidRange
(
tidRange
)
if
err
!=
nil
{
return
err
}
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
// TODO defer stor.Close()
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
return
err
}
defer
func
()
{
err2
:=
stor
.
Close
()
if
err
==
nil
{
err
=
err2
}
}()
return
Dump
(
ctx
,
os
.
Stdout
,
stor
,
tidMin
,
tidMax
,
hashOnly
)
}()
err
=
Dump
(
ctx
,
os
.
Stdout
,
stor
,
tidMin
,
tidMax
,
hashOnly
)
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
...
...
go/zodb/zodbtools/info.go
View file @
68609005
// Copyright (C) 2017-20
19
Nexedi SA and Contributors.
// Copyright (C) 2017-20
20
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -127,14 +127,21 @@ func infoMain(argv []string) {
zurl
:=
argv
[
0
]
ctx
:=
context
.
Background
()
err
:=
func
()
(
err
error
)
{
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
return
err
}
defer
func
()
{
err2
:=
stor
.
Close
()
if
err
==
nil
{
err
=
err2
}
}()
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
// TODO defer stor.Close()
return
Info
(
ctx
,
os
.
Stdout
,
stor
,
argv
[
1
:
])
}()
err
=
Info
(
ctx
,
os
.
Stdout
,
stor
,
argv
[
1
:
])
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
...
...
go/zodb/zodbtools/watch.go
View file @
68609005
...
...
@@ -152,23 +152,23 @@ func watchMain(argv []string) {
}
zurl
:=
argv
[
0
]
err
:=
watchMain_
(
context
.
Background
(),
zurl
,
verbose
)
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
}
func
watchMain_
(
ctx
context
.
Context
,
zurl
string
,
verbose
bool
)
(
err
error
)
{
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
return
err
}
defer
func
()
{
err2
:=
stor
.
Close
()
if
err
==
nil
{
err
=
err2
ctx
:=
context
.
Background
()
err
:=
func
()
(
err
error
)
{
stor
,
err
:=
zodb
.
Open
(
ctx
,
zurl
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
return
err
}
defer
func
()
{
err2
:=
stor
.
Close
()
if
err
==
nil
{
err
=
err2
}
}()
return
Watch
(
ctx
,
stor
,
os
.
Stdout
,
verbose
)
}()
return
Watch
(
ctx
,
stor
,
os
.
Stdout
,
verbose
)
if
err
!=
nil
{
prog
.
Fatal
(
err
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment