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
113ab6ab
Commit
113ab6ab
authored
Mar 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b20eddfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
t/neo/storage/fs1/cmd/fstail/fstail.go
t/neo/storage/fs1/cmd/fstail/fstail.go
+35
-2
No files found.
t/neo/storage/fs1/cmd/fstail/fstail.go
View file @
113ab6ab
...
...
@@ -28,10 +28,43 @@ import (
"io"
"log"
"os"
"strconv"
"unicode/utf8"
"../../../../storage/fs1"
"lab.nexedi.com/kirr/go123/mem"
)
// pyQuote quotes string the way python would do it
// specifically quote char is ' (not " as in go)
// XXX s = 'a\'bc'; print repr(s) -> "a'bc" (not 'a\'bc'
func
pyQuote
(
s
string
)
string
{
out
:=
pyQuoteBytes
(
mem
.
Bytes
(
s
))
return
mem
.
String
(
out
)
}
func
pyQuoteBytes
(
b
[]
byte
)
[]
byte
{
s
:=
mem
.
String
(
b
)
buf
:=
make
([]
byte
,
0
,
len
(
s
))
buf
=
append
(
buf
,
'\'
'
)
fmt
.
Printf
(
"QUOTE %q
\n
"
,
s
)
for
i
,
r
:=
range
s
{
if
r
==
utf8
.
RuneError
{
buf
=
append
(
buf
,
[]
byte
(
fmt
.
Sprintf
(
"
\\
x%0x"
,
s
[
i
]))
...
)
}
else
{
rq
:=
strconv
.
QuoteRune
(
r
)
// "'\x01'"
rq
=
rq
[
1
:
len
(
rq
)
-
1
]
// "\x01"
buf
=
append
(
buf
,
rq
...
)
}
fmt
.
Printf
(
"%d %q
\t
%q
\n
"
,
i
,
r
,
buf
)
}
buf
=
append
(
buf
,
'\'
'
)
return
buf
}
func
fsDump
(
w
io
.
Writer
,
path
string
,
ntxn
int
)
(
err
error
)
{
// path & fsdump on error context
defer
func
()
{
...
...
@@ -108,9 +141,9 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) {
}
// print information about read txn record
_
,
err
=
fmt
.
Fprintf
(
w
,
"%s: hash=%x
\n
user=%
q description=%q
length=%d offset=%d (+%d)
\n\n
"
,
_
,
err
=
fmt
.
Fprintf
(
w
,
"%s: hash=%x
\n
user=%
s description=%s
length=%d offset=%d (+%d)
\n\n
"
,
txnh
.
Tid
.
Time
(),
sha1
.
Sum
(
data
),
txnh
.
User
,
txnh
.
Description
,
pyQuoteBytes
(
txnh
.
User
),
pyQuoteBytes
(
txnh
.
Description
)
,
// NOTE in zodb/py .length is len - 8, in zodb/go - whole txn record length
txnh
.
Len
-
8
,
txnh
.
Pos
,
txnh
.
HeaderLen
())
...
...
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