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
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
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 @@
package
main
import
(
_
"../../storage"
// XXX rel ok?
//
_ "../../storage" // XXX rel ok?
neo
"../.."
"fmt"
"context"
...
...
t/neo/storage/fs1/cmd/fstail/fstail.go
View file @
1380e37e
...
...
@@ -30,6 +30,8 @@ import (
"os"
"../../../../storage/fs1"
"../../../../xcommon/xfmt"
)
...
...
@@ -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
)
}
// buffer for formatting
xbuf
:=
xfmt
.
Buffer
{}
// now loop loading transactions backwards until EOF / ntxn limit
for
i
:=
ntxn
;
i
>
0
;
i
--
{
err
=
txnh
.
LoadPrev
(
fSeq
,
fs1
.
LoadAll
)
...
...
@@ -114,17 +119,30 @@ func fsTail(w io.Writer, path string, ntxn int) (err error) {
}
// 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
"
,
txnh
.
Tid
.
Time
(),
sha1
.
Sum
(
data
),
xbuf
.
Reset
()
xbuf
.
S
(
txnh
.
Tid
.
Time
())
.
S
(
"hash="
)
.
X
(
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
),
// 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
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
txnh
.
Len
-
8
,
// NOTE in zodb/py .length is len - 8, in zodb/go - whole txn record length
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
{
break
}
...
...
t/neo/xcommon/xfmt/fmt_test.go
View file @
1380e37e
...
...
@@ -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
main
package
xmft
import
(
"bytes"
...
...
@@ -83,3 +81,16 @@ func pyAppendQuoteBytes(buf, b []byte) []byte {
buf
=
append
(
buf
,
quote
)
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
main
package
xfmt
import
(
"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