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
ec6b7bd5
Commit
ec6b7bd5
authored
Apr 10, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'y/go' into t
* y/go: go/zodb/zodbtools/dump: Don't use goto
parents
dfea9d1c
5bf40022
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
28 deletions
+26
-28
go/zodb/zodbtools/dump.go
go/zodb/zodbtools/dump.go
+26
-28
No files found.
go/zodb/zodbtools/dump.go
View file @
ec6b7bd5
...
...
@@ -81,7 +81,15 @@ var _LF = []byte{'\n'}
// DumpData dumps one data record
func
(
d
*
dumper
)
DumpData
(
datai
*
zodb
.
DataInfo
)
error
{
func
(
d
*
dumper
)
DumpData
(
datai
*
zodb
.
DataInfo
)
(
err
error
)
{
// XXX do we need this context ?
// see for rationale in similar place in DumpTxn
defer
func
()
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"%v: %v"
,
datai
.
Oid
,
err
)
}
}()
buf
:=
&
d
.
buf
buf
.
Reset
()
...
...
@@ -115,35 +123,33 @@ func (d *dumper) DumpData(datai *zodb.DataInfo) error {
}
// TODO use writev(buf, data, "\n") via net.Buffers (it is already available)
_
,
err
:
=
d
.
W
.
Write
(
buf
.
Bytes
())
_
,
err
=
d
.
W
.
Write
(
buf
.
Bytes
())
if
err
!=
nil
{
goto
out
return
err
}
if
data
!=
nil
{
_
,
err
=
d
.
W
.
Write
(
datai
.
Data
)
if
err
!=
nil
{
goto
out
return
err
}
}
_
,
err
=
d
.
W
.
Write
(
_LF
)
if
err
!=
nil
{
goto
out
}
out
:
// XXX do we need this context ?
// see for rationale in similar place in DumpTxn
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%v: %v"
,
datai
.
Oid
,
err
)
}
return
nil
return
err
}
// DumpTxn dumps one transaction record
func
(
d
*
dumper
)
DumpTxn
(
ctx
context
.
Context
,
txni
*
zodb
.
TxnInfo
,
dataIter
zodb
.
IDataIterator
)
error
{
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
// if error is in writer - it will include its own context
defer
func
()
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"%v: %v"
,
txni
.
Tid
,
err
)
}
}()
var
datai
*
zodb
.
DataInfo
// LF in-between txn records
...
...
@@ -153,10 +159,10 @@ func (d *dumper) DumpTxn(ctx context.Context, txni *zodb.TxnInfo, dataIter zodb.
d
.
afterFirst
=
true
}
_
,
err
:
=
fmt
.
Fprintf
(
d
.
W
,
"%stxn %s %q
\n
user %q
\n
description %q
\n
extension %q
\n
"
,
_
,
err
=
fmt
.
Fprintf
(
d
.
W
,
"%stxn %s %q
\n
user %q
\n
description %q
\n
extension %q
\n
"
,
vskip
,
txni
.
Tid
,
string
(
txni
.
Status
),
txni
.
User
,
txni
.
Description
,
txni
.
Extension
)
if
err
!=
nil
{
goto
out
return
err
}
// data records
...
...
@@ -176,15 +182,7 @@ func (d *dumper) DumpTxn(ctx context.Context, txni *zodb.TxnInfo, dataIter zodb.
}
}
out
:
// XXX do we need this context ?
// rationale: dataIter.NextData() if error in db - will include db context
// if error is in writer - it will include its own context
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%v: %v"
,
txni
.
Tid
,
err
)
}
return
nil
return
err
}
// Dump dumps transaction records in between tidMin..tidMax
...
...
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