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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
3b04f1df
Commit
3b04f1df
authored
Apr 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c22731dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
t/neo/storage/fs1/cmd/fstail/fstail.go
t/neo/storage/fs1/cmd/fstail/fstail.go
+7
-7
t/neo/xcommon/xfmt/fmt.go
t/neo/xcommon/xfmt/fmt.go
+3
-3
t/neo/zodb/cmd/zodbdump/zodbdump.go
t/neo/zodb/cmd/zodbdump/zodbdump.go
+9
-9
No files found.
t/neo/storage/fs1/cmd/fstail/fstail.go
View file @
3b04f1df
...
...
@@ -91,7 +91,7 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
}
// buffer for formatting
x
buf
:=
xfmt
.
Buffer
{}
buf
:=
xfmt
.
Buffer
{}
// now loop loading transactions backwards until EOF / ntxn limit
for
i
:=
ntxn
;
i
>
0
;
i
--
{
...
...
@@ -115,20 +115,20 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
}
// print information about read txn record
x
buf
.
Reset
()
buf
.
Reset
()
dataSha1
:=
sha1
.
Sum
(
data
)
x
buf
.
V
(
txnh
.
Tid
.
Time
())
.
S
(
": hash="
)
.
Xb
(
dataSha1
[
:
])
buf
.
V
(
txnh
.
Tid
.
Time
())
.
S
(
": hash="
)
.
Xb
(
dataSha1
[
:
])
// fstail.py uses repr to print user/description:
// https://github.com/zopefoundation/ZODB/blob/5.2.0-5-g6047e2fae/src/ZODB/scripts/fstail.py#L39
x
buf
.
S
(
"
\n
user="
)
.
Qpyb
(
txnh
.
User
)
.
S
(
" description="
)
.
Qpyb
(
txnh
.
Description
)
buf
.
S
(
"
\n
user="
)
.
Qpyb
(
txnh
.
User
)
.
S
(
" description="
)
.
Qpyb
(
txnh
.
Description
)
// NOTE in zodb/py .length is len - 8, in zodb/go - whole txn record length
x
buf
.
S
(
" length="
)
.
D64
(
txnh
.
Len
-
8
)
x
buf
.
S
(
" offset="
)
.
D64
(
txnh
.
Pos
)
.
S
(
" (+"
)
.
D64
(
txnh
.
HeaderLen
())
.
S
(
")
\n\n
"
)
buf
.
S
(
" length="
)
.
D64
(
txnh
.
Len
-
8
)
buf
.
S
(
" offset="
)
.
D64
(
txnh
.
Pos
)
.
S
(
" (+"
)
.
D64
(
txnh
.
HeaderLen
())
.
S
(
")
\n\n
"
)
_
,
err
=
w
.
Write
(
x
buf
.
Bytes
())
_
,
err
=
w
.
Write
(
buf
.
Bytes
())
if
err
!=
nil
{
break
}
...
...
t/neo/xcommon/xfmt/fmt.go
View file @
3b04f1df
...
...
@@ -24,9 +24,9 @@
//
// xfmt analog would be
//
//
x
buf := xfmt.Buffer{}
//
x
buf .S("hello ") .Q("world") .C(' ') .D(1) .C(' ') .Xb([]byte("data"))
// s :=
x
buf.Bytes()
// buf := xfmt.Buffer{}
// buf .S("hello ") .Q("world") .C(' ') .D(1) .C(' ') .Xb([]byte("data"))
// s := buf.Bytes()
//
// xfmt.Buffer can be reused several times via Buffer.Reset() .
package
xfmt
...
...
t/neo/zodb/cmd/zodbdump/zodbdump.go
View file @
3b04f1df
...
...
@@ -52,7 +52,7 @@ type dumper struct {
afterFirst
bool
// true after first transaction has been dumped
x
buf
xfmt
.
Buffer
// reusable data buffer for formatting
buf
xfmt
.
Buffer
// reusable data buffer for formatting
}
var
_LF
=
[]
byte
{
'\n'
}
...
...
@@ -60,31 +60,31 @@ var _LF = []byte{'\n'}
// DumpData dumps one data record
func
(
d
*
dumper
)
DumpData
(
datai
*
zodb
.
StorageRecordInformation
)
error
{
xbuf
:=
&
d
.
x
buf
x
buf
.
Reset
()
buf
:=
&
d
.
buf
buf
.
Reset
()
x
buf
.
S
(
"obj "
)
.
V
(
&
datai
.
Oid
)
.
Cb
(
' '
)
buf
.
S
(
"obj "
)
.
V
(
&
datai
.
Oid
)
.
Cb
(
' '
)
writeData
:=
false
switch
{
case
datai
.
Data
==
nil
:
xbuf
.
S
(
"delete"
)
buf
.
S
(
"delete"
)
case
datai
.
Tid
!=
datai
.
DataTid
:
x
buf
.
S
(
"from "
)
.
V
(
&
datai
.
DataTid
)
buf
.
S
(
"from "
)
.
V
(
&
datai
.
DataTid
)
default
:
dataSha1
:=
sha1
.
Sum
(
datai
.
Data
)
x
buf
.
D
(
len
(
datai
.
Data
))
.
S
(
" sha1:"
)
.
Xb
(
dataSha1
[
:
])
buf
.
D
(
len
(
datai
.
Data
))
.
S
(
" sha1:"
)
.
Xb
(
dataSha1
[
:
])
writeData
=
true
}
x
buf
.
Cb
(
'\n'
)
buf
.
Cb
(
'\n'
)
// TODO use writev(data, "\n") via net.Buffers (it is already available)
_
,
err
:=
d
.
W
.
Write
(
x
buf
.
Bytes
())
_
,
err
:=
d
.
W
.
Write
(
buf
.
Bytes
())
if
err
!=
nil
{
goto
out
}
...
...
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