Commit 873a7520 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f75bc6f7
// Copyright (C) 2017 Nexedi SA and Contributors.
// 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
......
// Copyright (C) 2017 Nexedi SA and Contributors.
// 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
......@@ -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
......
// Copyright (C) 2016-2017 Nexedi SA and Contributors.
// Copyright (C) 2016-2019 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:
......
// Copyright (C) 2017 Nexedi SA and Contributors.
// 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
......@@ -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},
{"tidrange", "specifying history range", helpTidRange},
}
// Copyright (C) 2017 Nexedi SA and Contributors.
// 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
......@@ -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 {
......
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