Commit 218a9c6f authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb/zodbtools: Refer to `zodb help tidrange` about how history range should be specified

This syncs to nexedi/zodbtools@f7eff5fe
(*: Refer to `zodb help tidrange` about how history range should be
specified) in zodbtools/py.
parent d36da842
// Copyright (C) 2017 Nexedi SA and Contributors. // Copyright (C) 2017-2019 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
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -142,6 +142,8 @@ Error: ...@@ -142,6 +142,8 @@ Error:
// //
// Both <tidmin> and <tidmax> can be empty, in which case defaults 0 and TidMax are used. // Both <tidmin> and <tidmax> can be empty, in which case defaults 0 and TidMax are used.
// //
// See `zodb help tidrange` for accepted tidrange syntax.
//
// XXX also check tidMin < tidMax here? or allow reverse ranges ? // XXX also check tidMin < tidMax here? or allow reverse ranges ?
func ParseTidRange(s string) (tidMin, tidMax Tid, err error) { func ParseTidRange(s string) (tidMin, tidMax Tid, err error) {
s1, s2, err := xstrings.Split2(s, "..") s1, s2, err := xstrings.Split2(s, "..")
......
...@@ -231,10 +231,11 @@ const dumpSummary = "dump content of a ZODB database" ...@@ -231,10 +231,11 @@ const dumpSummary = "dump content of a ZODB database"
func dumpUsage(w io.Writer) { func dumpUsage(w io.Writer) {
fmt.Fprintf(w, fmt.Fprintf(w,
`Usage: zodb dump [OPTIONS] <storage> [tidmin..tidmax] `Usage: zodb dump [OPTIONS] <storage> [<tidrange>]
Dump content of a ZODB database. Dump content of a ZODB database.
<storage> is an URL (see 'zodb help zurl') of a ZODB-storage. <storage> is an URL (see 'zodb help zurl') of a ZODB-storage.
<tidrange> is a history range (see 'zodb help tidrange') to dump.
Options: Options:
......
// Copyright (C) 2017 Nexedi SA and Contributors. // Copyright (C) 2017-2019 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
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -62,7 +62,40 @@ for example ...@@ -62,7 +62,40 @@ for example
0285cbac258bf266:0000000000000001 - oid 1 at first newest transaction changing it with tid <= 0285cbac258bf266 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{ var helpTopics = prog.HelpRegistry{
{"zurl", "specifying database URL", helpZURL}, {"zurl", "specifying database URL", helpZURL},
{"xid", "specifying object address", helpXid}, {"xid", "specifying object address", helpXid},
{"tidrange", "specifying history range", helpTidRange},
} }
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