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
873a7520
Commit
873a7520
authored
Jan 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f75bc6f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
19 deletions
+53
-19
go/zodb/str.go
go/zodb/str.go
+2
-2
go/zodb/zodbtools/catobj.go
go/zodb/zodbtools/catobj.go
+3
-3
go/zodb/zodbtools/dump.go
go/zodb/zodbtools/dump.go
+7
-6
go/zodb/zodbtools/help.go
go/zodb/zodbtools/help.go
+37
-4
go/zodb/zodbtools/info.go
go/zodb/zodbtools/info.go
+4
-4
No files found.
go/zodb/str.go
View file @
873a7520
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2017
-2019
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
...
...
go/zodb/zodbtools/catobj.go
View file @
873a7520
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2017
-2019
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
...
...
@@ -49,7 +49,7 @@ func Catobj(ctx context.Context, w io.Writer, stor zodb.IStorage, xid zodb.Xid)
return
err
}
// Dumpobj dumps content of one ZODB object with zodbdump-like header
// Dumpobj dumps content of one ZODB object with zodbdump-like header
.
func
Dumpobj
(
ctx
context
.
Context
,
w
io
.
Writer
,
stor
zodb
.
IStorage
,
xid
zodb
.
Xid
,
hashOnly
bool
)
error
{
var
objInfo
zodb
.
DataInfo
...
...
go/zodb/zodbtools/dump.go
View file @
873a7520
// Copyright (C) 2016-201
7
Nexedi SA and Contributors.
// Copyright (C) 2016-201
9
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -67,7 +67,7 @@ import (
)
// dumper dumps zodb record to a writer
// dumper dumps zodb record to a writer
.
type
dumper
struct
{
W
io
.
Writer
HashOnly
bool
// whether to dump only hashes of data without content
...
...
@@ -80,7 +80,7 @@ type dumper struct {
var
_LF
=
[]
byte
{
'\n'
}
// DumpData dumps one data record
// DumpData dumps one data record
.
func
(
d
*
dumper
)
DumpData
(
datai
*
zodb
.
DataInfo
)
(
err
error
)
{
// XXX do we need this context ?
// see for rationale in similar place in DumpTxn
...
...
@@ -139,7 +139,7 @@ func (d *dumper) DumpData(datai *zodb.DataInfo) (err error) {
return
err
}
// DumpTxn dumps one transaction record
// DumpTxn dumps one transaction record
.
func
(
d
*
dumper
)
DumpTxn
(
ctx
context
.
Context
,
txni
*
zodb
.
TxnInfo
,
dataIter
zodb
.
IDataIterator
)
(
err
error
)
{
// XXX do we need this context ?
// rationale: dataIter.NextData() if error in db - will include db context
...
...
@@ -185,7 +185,7 @@ func (d *dumper) DumpTxn(ctx context.Context, txni *zodb.TxnInfo, dataIter zodb.
return
err
}
// Dump dumps transaction records in between tidMin..tidMax
// Dump dumps transaction records in between tidMin..tidMax
.
func
(
d
*
dumper
)
Dump
(
ctx
context
.
Context
,
stor
zodb
.
IStorage
,
tidMin
,
tidMax
zodb
.
Tid
)
error
{
var
txni
*
zodb
.
TxnInfo
var
dataIter
zodb
.
IDataIterator
...
...
@@ -231,10 +231,11 @@ const dumpSummary = "dump content of a ZODB database"
func
dumpUsage
(
w
io
.
Writer
)
{
fmt
.
Fprintf
(
w
,
`Usage: zodb dump [OPTIONS] <storage> [
tidmin..tidmax
]
`Usage: zodb dump [OPTIONS] <storage> [
<tidrange>
]
Dump content of a ZODB database.
<storage> is an URL (see 'zodb help zurl') of a ZODB-storage.
<tidrange> is a history range (see 'zodb help tidrange') to dump.
Options:
...
...
go/zodb/zodbtools/help.go
View file @
873a7520
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2017
-2019
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
...
...
@@ -62,7 +62,40 @@ for example
0285cbac258bf266:0000000000000001 - oid 1 at first newest transaction changing it with tid <= 0285cbac258bf266
`
const
helpTidRange
=
`Many zodb commands can be invoked on specific range of database history and
accept <tidrange> parameter for that. The syntax for <tidrange> is
tidmin..tidmax
where tidmin and tidmax specify [tidmin, tidmax] range of transactions, ends
inclusive. Both tidmin and tidmax are optional and default to
tidmin: 0 (start of database history)
tidmax: +∞ (end of database history)
If a tid (tidmin or tidmax) is given, it has to be specified as follows:
- a 16-digit hex number specifying transaction ID, e.g. 0285cbac258bf266
TODO (recheck what git does and use dateparser):
- absolute timestamp,
- relative timestamp, e.g. yesterday, 1.week.ago
Example tid ranges:
.. whole database history
000000000000aaaa.. transactions starting from 000000000000aaaa till latest
..000000000000bbbb transactions starting from database beginning till 000000000000bbbb
000000000000aaaa..000000000000bbbb transactions starting from 000000000000aaaa till 000000000000bbbb
In commands <tidrange> is optional - if it is not given at all, it defaults to
0..+∞, i.e. to whole database history.
`
var
helpTopics
=
prog
.
HelpRegistry
{
{
"zurl"
,
"specifying database URL"
,
helpZURL
},
{
"xid"
,
"specifying object address"
,
helpXid
},
{
"zurl"
,
"specifying database URL"
,
helpZURL
},
{
"xid"
,
"specifying object address"
,
helpXid
},
{
"tidrange"
,
"specifying history range"
,
helpTidRange
},
}
go/zodb/zodbtools/info.go
View file @
873a7520
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2017
-2019
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
...
...
@@ -32,7 +32,7 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
)
// paramFunc is a function to retrieve 1 storage parameter
// paramFunc is a function to retrieve 1 storage parameter
.
type
paramFunc
func
(
ctx
context
.
Context
,
stor
zodb
.
IStorage
)
(
string
,
error
)
var
infov
=
[]
struct
{
name
string
;
getParam
paramFunc
}
{
...
...
@@ -56,7 +56,7 @@ func init() {
}
}
// Info prints general information about a ZODB storage
// Info prints general information about a ZODB storage
.
func
Info
(
ctx
context
.
Context
,
w
io
.
Writer
,
stor
zodb
.
IStorage
,
parameterv
[]
string
)
error
{
wantnames
:=
false
if
len
(
parameterv
)
==
0
{
...
...
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