Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
8192b9bc
Commit
8192b9bc
authored
Apr 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5c6637ef
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
151 additions
and
26 deletions
+151
-26
t/neo/storage/fs1/index.go
t/neo/storage/fs1/index.go
+1
-1
t/neo/xcommon/xbufio/seqbuf_ioat.go
t/neo/xcommon/xbufio/seqbuf_ioat.go
+7
-2
t/neo/xcommon/xbufio/seqbuf_ioat_test.go
t/neo/xcommon/xbufio/seqbuf_ioat_test.go
+7
-2
t/neo/xcommon/xio/xio.go
t/neo/xcommon/xio/xio.go
+4
-1
t/neo/zodb/zodbtools/.gitignore
t/neo/zodb/zodbtools/.gitignore
+0
-0
t/neo/zodb/zodbtools/dump.go
t/neo/zodb/zodbtools/dump.go
+22
-16
t/neo/zodb/zodbtools/dump_test.go
t/neo/zodb/zodbtools/dump_test.go
+20
-4
t/neo/zodb/zodbtools/info.go
t/neo/zodb/zodbtools/info.go
+90
-0
t/neo/zodb/zodbtools/testdata/1.zdump.pyok
t/neo/zodb/zodbtools/testdata/1.zdump.pyok
+0
-0
No files found.
t/neo/storage/fs1/index.go
View file @
8192b9bc
...
...
@@ -37,7 +37,7 @@ import (
)
// fsIndex is Oid -> Data record position mapping used to associate Oid with
// Data record in latest transaction which changed it.
XXX text
// Data record in latest transaction which changed it.
type
fsIndex
struct
{
*
fsb
.
Tree
}
...
...
t/neo/xcommon/xbufio/seqbuf_ioat.go
View file @
8192b9bc
// Copyright (C) 2017 Nexedi SA and Contributors.
XXX -> GPLv3
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version
2
, or (at your
// it under the terms of the GNU General Public License version
3
, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
...
...
t/neo/xcommon/xbufio/seqbuf_ioat_test.go
View file @
8192b9bc
// Copyright (C) 2017 Nexedi SA and Contributors.
XXX -> GPLv3
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version
2
, or (at your
// it under the terms of the GNU General Public License version
3
, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
...
...
t/neo/xcommon/xio/xio.go
View file @
8192b9bc
...
...
@@ -10,6 +10,9 @@ import (
"os"
)
// XXX interface for a Reader/Writer which can report position
// -> Nread(), Nwrote() ?
// CountReader is an io.Reader that count total bytes read
type
CountReader
struct
{
io
.
Reader
...
...
@@ -25,7 +28,7 @@ func (r *CountReader) Read(p []byte) (int, error) {
// TODO func to get position (requiring io.Seeker to just Seek(0, SeekCurrent) is too much)
// XXX previously used InputOffset(), but generally e.g. for io.Writer "input" is not appropriate
// like io.LimitedReader but for writes
//
LimitedWriter is
like io.LimitedReader but for writes
type
LimitedWriter
struct
{
io
.
Writer
N
int64
...
...
t/neo/zodb/
cmd/zodbdump
/.gitignore
→
t/neo/zodb/
zodbtools
/.gitignore
View file @
8192b9bc
File moved
t/neo/zodb/
cmd/zodbdump/zodb
dump.go
→
t/neo/zodb/
zodbtools/
dump.go
View file @
8192b9bc
...
...
@@ -2,9 +2,14 @@
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version
2
, or (at your
// it under the terms of the GNU General Public License version
3
, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
...
...
@@ -29,7 +34,7 @@ txn ...
*/
package
main
package
zodbtools
import
(
"crypto/sha1"
...
...
@@ -41,8 +46,8 @@ import (
"lab.nexedi.com/kirr/go123/xfmt"
"../../
../
zodb"
"../../
../
storage/fs1"
"../../zodb"
"../../storage/fs1"
)
...
...
@@ -190,35 +195,36 @@ func (d *dumper) Dump(stor zodb.IStorage, tidMin, tidMax zodb.Tid) error {
return
nil
}
//
zodb
Dump dumps contents of a storage in between tidMin..tidMax range to a writer.
// Dump dumps contents of a storage in between tidMin..tidMax range to a writer.
// see top-level documentation for the dump format.
func
zodb
Dump
(
w
io
.
Writer
,
stor
zodb
.
IStorage
,
tidMin
,
tidMax
zodb
.
Tid
,
hashOnly
bool
)
error
{
func
Dump
(
w
io
.
Writer
,
stor
zodb
.
IStorage
,
tidMin
,
tidMax
zodb
.
Tid
,
hashOnly
bool
)
error
{
d
:=
dumper
{
W
:
w
,
HashOnly
:
hashOnly
}
return
d
.
Dump
(
stor
,
tidMin
,
tidMax
)
}
func
usage
(
)
{
fmt
.
Fprintf
(
os
.
Stderr
,
`zodbdump [options] <storage> [tidmin..tidmax]
func
dumpUsage
(
w
io
.
Writer
)
{
fmt
.
Fprintf
(
w
,
`zodb
dump [options] <storage> [tidmin..tidmax]
Dump content of a ZODB database.
<storage> is a
path to FileStorage XXX will become URL
<storage> is a
n URL (see 'zodb help zurl') of a ZODB-storage.
o
ptions:
O
ptions:
-h --help this help text.
-hashonly dump only hashes of objects without content.
`
)
}
func
main
(
)
{
func
DumpMain
(
argv
[]
string
)
{
hashOnly
:=
false
tidRange
:=
".."
// (0, +inf)
flag
.
Usage
=
usage
flag
.
BoolVar
(
&
hashOnly
,
"hashonly"
,
hashOnly
,
"dump only hashes of objects"
)
flag
.
Parse
()
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
dumpUsage
(
os
.
Stderr
)
}}
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
BoolVar
(
&
hashOnly
,
"hashonly"
,
hashOnly
,
"dump only hashes of objects"
)
flags
.
Parse
(
argv
)
argv
:=
flag
.
Args
()
if
len
(
argv
)
<
1
{
...
...
@@ -242,7 +248,7 @@ func main() {
log
.
Fatal
(
err
)
}
err
=
zodb
Dump
(
os
.
Stdout
,
stor
,
tidMin
,
tidMax
,
hashOnly
)
err
=
Dump
(
os
.
Stdout
,
stor
,
tidMin
,
tidMax
,
hashOnly
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
t/neo/zodb/
cmd/zodbdump/zodb
dump_test.go
→
t/neo/zodb/
zodbtools/
dump_test.go
View file @
8192b9bc
// TODO copyright/license
// Copyright (C) 2016-2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
package
main
...
...
@@ -10,8 +25,8 @@ import (
"regexp"
"testing"
"../../
../
storage/fs1"
"../../
../
zodb"
"../../storage/fs1"
"../../zodb"
"github.com/sergi/go-diff/diffmatchpatch"
"lab.nexedi.com/kirr/go123/exc"
...
...
@@ -56,7 +71,8 @@ func loadZdumpPy(t *testing.T, path string) string {
}
func
withTestdata1Fs
(
t
testing
.
TB
,
f
func
(
fs
*
fs1
.
FileStorage
))
{
fs
,
err
:=
fs1
.
Open
(
"../../../storage/fs1/testdata/1.fs"
)
// XXX read-only, path?
// XXX -> zodb.OpenURL
fs
,
err
:=
fs1
.
Open
(
"../../storage/fs1/testdata/1.fs"
)
// XXX read-only, path?
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
t/neo/zodb/zodbtools/info.go
0 → 100644
View file @
8192b9bc
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// Zodbinfo - Print general information about a ZODB database
package
zodbtools
#
{}
parameter_name
->
get_parameter
(
stor
)
infoDict
=
OrderedDict
([
(
"name"
,
lambda
stor
:
stor
.
getName
()),
(
"size"
,
lambda
stor
:
stor
.
getSize
()),
(
"last_tid"
,
lambda
stor
:
ashex
(
stor
.
lastTransaction
())),
])
def
zodbinfo
(
stor
,
parameterv
)
:
wantnames
=
False
if
not
parameterv
:
parameterv
=
infoDict
.
keys
()
wantnames
=
True
for
parameter
in
parameterv
:
get_parameter
=
infoDict
.
get
(
parameter
)
if
get_parameter
is
None
:
print
(
"invalid parameter: %s"
%
parameter
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
out
=
""
if
wantnames
:
out
+=
parameter
+
"="
out
+=
"%s"
%
(
get_parameter
(
stor
),)
print
(
out
)
#
----------------------------------------
import
getopt
summary
=
"print general information about a ZODB database"
def
usage
(
out
)
:
print
(
"""
\
Usage: zodb info [OPTIONS] <storage> [parameter ...]
Print general information about a ZODB database.
<storage> is an URL (see 'zodb help zurl') of a ZODB-storage.
By default info prints information about all storage parameters. If one or
more parameter names are given as arguments, info prints the value of each
named parameter on its own line.
Options:
-h --help show this help
"""
,
file
=
out
)
def
main
(
argv
)
:
try
:
optv
,
argv
=
getopt
.
getopt
(
argv
[
1
:
],
"h"
,
[
"help"
])
except
getopt
.
GetoptError
as
e
:
print
(
e
,
file
=
sys
.
stderr
)
usage
(
sys
.
stderr
)
sys
.
exit
(
2
)
for
opt
,
_
in
optv
:
if
opt
in
(
"-h"
,
"--help"
)
:
usage
(
sys
.
stdout
)
sys
.
exit
(
0
)
try
:
storurl
=
argv
[
0
]
except
IndexError
:
usage
(
sys
.
stderr
)
sys
.
exit
(
2
)
stor
=
storageFromURL
(
storurl
,
read_only
=
True
)
zodbinfo
(
stor
,
argv
[
1
:
])
t/neo/zodb/
cmd/zodbdump
/testdata/1.zdump.pyok
→
t/neo/zodb/
zodbtools
/testdata/1.zdump.pyok
View file @
8192b9bc
File moved
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