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
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
Levin Zimmermann
neoppod
Commits
1380e37e
Commit
1380e37e
authored
Mar 25, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6a52ac1a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
15 deletions
+50
-15
t/neo/cmd/neostorage-go/neostorage.go
t/neo/cmd/neostorage-go/neostorage.go
+1
-1
t/neo/storage/fs1/cmd/fstail/fstail.go
t/neo/storage/fs1/cmd/fstail/fstail.go
+26
-8
t/neo/xcommon/xfmt/fmt_test.go
t/neo/xcommon/xfmt/fmt_test.go
+8
-0
t/neo/xcommon/xfmt/python.go
t/neo/xcommon/xfmt/python.go
+14
-3
t/neo/xcommon/xfmt/python_test.go
t/neo/xcommon/xfmt/python_test.go
+1
-3
No files found.
t/neo/cmd/neostorage-go/neostorage.go
View file @
1380e37e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
package
main
package
main
import
(
import
(
_
"../../storage"
// XXX rel ok?
//
_ "../../storage" // XXX rel ok?
neo
"../.."
neo
"../.."
"fmt"
"fmt"
"context"
"context"
...
...
t/neo/storage/fs1/cmd/fstail/fstail.go
View file @
1380e37e
...
@@ -30,6 +30,8 @@ import (
...
@@ -30,6 +30,8 @@ import (
"os"
"os"
"../../../../storage/fs1"
"../../../../storage/fs1"
"../../../../xcommon/xfmt"
)
)
...
@@ -86,6 +88,9 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
...
@@ -86,6 +88,9 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
return
fmt
.
Errorf
(
"@%v: previous record could not be read"
,
topPos
)
return
fmt
.
Errorf
(
"@%v: previous record could not be read"
,
topPos
)
}
}
// buffer for formatting
xbuf
:=
xfmt
.
Buffer
{}
// now loop loading transactions backwards until EOF / ntxn limit
// now loop loading transactions backwards until EOF / ntxn limit
for
i
:=
ntxn
;
i
>
0
;
i
--
{
for
i
:=
ntxn
;
i
>
0
;
i
--
{
err
=
txnh
.
LoadPrev
(
fSeq
,
fs1
.
LoadAll
)
err
=
txnh
.
LoadPrev
(
fSeq
,
fs1
.
LoadAll
)
...
@@ -114,17 +119,30 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
...
@@ -114,17 +119,30 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
}
}
// print information about read txn record
// print information about read txn record
_
,
err
=
fmt
.
Fprintf
(
w
,
"%s: hash=%x
\n
user=%s description=%s length=%d offset=%d (+%d)
\n\n
"
,
xbuf
.
Reset
()
txnh
.
Tid
.
Time
(),
sha1
.
Sum
(
data
),
xbuf
.
S
(
txnh
.
Tid
.
Time
())
.
S
(
"hash="
)
.
X
(
sha1
.
Sum
(
data
))
// fstail.py uses repr to print user/description:
// fstail.py uses repr to print user/description:
// https://github.com/zopefoundation/ZODB/blob/5.2.0-4-g359f40ec7/src/ZODB/scripts/fstail.py#L39
// https://github.com/zopefoundation/ZODB/blob/5.2.0-4-g359f40ec7/src/ZODB/scripts/fstail.py#L39
pyQuoteBytes
(
txnh
.
User
),
pyQuoteBytes
(
txnh
.
Description
),
xbuf
.
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
// NOTE in zodb/py .length is len - 8, in zodb/go - whole txn record length
txnh
.
Len
-
8
,
xbuf
.
S
(
" length="
)
.
D
(
txnh
.
Len
-
8
)
xbuf
.
S
(
" offset="
)
.
D
(
txnh
.
Pos
)
.
S
(
" (+"
)
.
D
(
txnh
.
HeaderLen
())
.
S
(
")
\n\n
"
)
txnh
.
Pos
,
txnh
.
HeaderLen
())
// // print information about read txn record
// _, err = fmt.Fprintf(w, "%s: hash=%x\nuser=%s description=%s length=%d offset=%d (+%d)\n\n",
// txnh.Tid.Time(), sha1.Sum(data),
//
// // fstail.py uses repr to print user/description:
// // https://github.com/zopefoundation/ZODB/blob/5.2.0-4-g359f40ec7/src/ZODB/scripts/fstail.py#L39
// 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())
_
,
err
=
w
.
Write
(
xbuf
.
Bytes
())
if
err
!=
nil
{
if
err
!=
nil
{
break
break
}
}
...
...
t/neo/xcommon/xfmt/fmt_test.go
View file @
1380e37e
...
@@ -80,3 +80,11 @@ func TestXFmt(t *testing.T) {
...
@@ -80,3 +80,11 @@ func TestXFmt(t *testing.T) {
}
}
}
}
}
}
func
BenchmarkFmt
(
t
*
testing
.
T
)
{
// TODO
}
func
BenchmarkXFmt
(
t
*
testing
.
T
)
{
// TODO
}
t/neo/
storage/fs1/cmd/fstail/xstrconv
.go
→
t/neo/
xcommon/xfmt/python
.go
View file @
1380e37e
// XXX move me out of here
package
xmft
package
main
import
(
import
(
"bytes"
"bytes"
...
@@ -83,3 +81,16 @@ func pyAppendQuoteBytes(buf, b []byte) []byte {
...
@@ -83,3 +81,16 @@ func pyAppendQuoteBytes(buf, b []byte) []byte {
buf
=
append
(
buf
,
quote
)
buf
=
append
(
buf
,
quote
)
return
buf
return
buf
}
}
// Qpy appends string quoted as Python would do
func
(
b
*
Buffer
)
Qpy
(
s
string
)
*
Buffer
{
*
b
=
...
// TODO
return
b
}
// Qpyb appends []byte quoted as Python would do
func
(
b
*
Buffer
)
Qpyb
(
x
[]
byte
)
*
Buffer
{
*
b
=
...
// TODO
return
b
}
t/neo/
storage/fs1/cmd/fstail/xstrconv
_test.go
→
t/neo/
xcommon/xfmt/python
_test.go
View file @
1380e37e
// XXX move me to common place
package
xfmt
package
main
import
(
import
(
"testing"
"testing"
...
...
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