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
b90ada39
Commit
b90ada39
authored
Jul 27, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3529459c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
20 deletions
+16
-20
go/zodb/pyserialize.go
go/zodb/pyserialize.go
+1
-1
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+6
-12
go/zodb/storage/fs1/filestorage_test.go
go/zodb/storage/fs1/filestorage_test.go
+1
-1
go/zodb/storage/fs1/fs1tools/dump.go
go/zodb/storage/fs1/fs1tools/dump.go
+2
-3
go/zodb/storage/fs1/fs1tools/index.go
go/zodb/storage/fs1/fs1tools/index.go
+2
-0
go/zodb/storage/fs1/fs1tools/main.go
go/zodb/storage/fs1/fs1tools/main.go
+1
-1
go/zodb/storage/fs1/py/gen-testdata
go/zodb/storage/fs1/py/gen-testdata
+1
-1
go/zodb/storage/fs1/ztestdata_expect_test.go
go/zodb/storage/fs1/ztestdata_expect_test.go
+1
-1
go/zodb/zodb.go
go/zodb/zodb.go
+1
-0
No files found.
go/zodb/pyserialize.go
View file @
b90ada39
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
pickle
"github.com/kisielk/og-rek"
pickle
"github.com/kisielk/og-rek"
)
)
// PyData represent data stored into ZODB by Python applications.
// PyData represent
s
data stored into ZODB by Python applications.
//
//
// The format is based on python pickles. Basically every serialized object has
// The format is based on python pickles. Basically every serialized object has
// two parts: class description and object state. See
// two parts: class description and object state. See
...
...
go/zodb/storage/fs1/filestorage.go
View file @
b90ada39
...
@@ -792,7 +792,7 @@ func Iterate(r io.ReaderAt, posStart int64, dir IterDir) *Iter {
...
@@ -792,7 +792,7 @@ func Iterate(r io.ReaderAt, posStart int64, dir IterDir) *Iter {
case
IterBackward
:
case
IterBackward
:
it
.
Txnh
.
LenPrev
=
lenIterStart
it
.
Txnh
.
LenPrev
=
lenIterStart
default
:
default
:
panic
(
"
invalid dir
"
)
panic
(
"
dir invalid
"
)
}
}
return
it
return
it
}
}
...
@@ -1267,9 +1267,7 @@ func (fs *FileStorage) computeIndex(ctx context.Context) (index *Index, err erro
...
@@ -1267,9 +1267,7 @@ func (fs *FileStorage) computeIndex(ctx context.Context) (index *Index, err erro
// not want to load actual data - only data headers.
// not want to load actual data - only data headers.
fsSeq
:=
xbufio
.
NewSeqReaderAt
(
fs
.
file
)
fsSeq
:=
xbufio
.
NewSeqReaderAt
(
fs
.
file
)
// pre-setup txnh so that txnh.LoadNext starts loading from the beginning of file
it
:=
Iterate
(
fsSeq
,
index
.
TopPos
,
IterForward
)
txnh
:=
&
TxnHeader
{
Pos
:
index
.
TopPos
,
Len
:
lenIterStart
}
dh
:=
&
DataHeader
{}
loop
:
loop
:
for
{
for
{
...
@@ -1280,7 +1278,7 @@ loop:
...
@@ -1280,7 +1278,7 @@ loop:
default
:
default
:
}
}
err
=
txnh
.
LoadNext
(
fsSeq
,
LoadNoStrings
)
err
=
it
.
NextTxn
(
LoadNoStrings
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
okEOF
(
err
)
err
=
okEOF
(
err
)
break
break
...
@@ -1288,14 +1286,10 @@ loop:
...
@@ -1288,14 +1286,10 @@ loop:
// XXX check txnh.Status != TxnInprogress
// XXX check txnh.Status != TxnInprogress
index
.
TopPos
=
txnh
.
Pos
+
txnh
.
Len
index
.
TopPos
=
it
.
Txnh
.
Pos
+
it
.
Txnh
.
Len
// first data iteration will go to first data record
dh
.
Pos
=
txnh
.
DataPos
()
dh
.
DataLen
=
-
DataHeaderSize
for
{
for
{
err
=
dh
.
LoadNext
(
fsSeq
,
txnh
)
err
=
it
.
NextData
(
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
okEOF
(
err
)
err
=
okEOF
(
err
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -1304,7 +1298,7 @@ loop:
...
@@ -1304,7 +1298,7 @@ loop:
break
break
}
}
index
.
Set
(
dh
.
Oid
,
d
h
.
Pos
)
index
.
Set
(
it
.
Datah
.
Oid
,
it
.
Data
h
.
Pos
)
}
}
}
}
...
...
go/zodb/storage/fs1/filestorage_test.go
View file @
b90ada39
...
@@ -288,7 +288,7 @@ func TestComputeIndex(t *testing.T) {
...
@@ -288,7 +288,7 @@ func TestComputeIndex(t *testing.T) {
fs
:=
xfsopen
(
t
,
"testdata/1.fs"
)
// TODO open ro
fs
:=
xfsopen
(
t
,
"testdata/1.fs"
)
// TODO open ro
defer
exc
.
XRun
(
fs
.
Close
)
defer
exc
.
XRun
(
fs
.
Close
)
index
,
err
:=
fs
.
computeIndex
(
context
.
TODO
())
index
,
err
:=
fs
.
computeIndex
(
context
.
Background
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
go/zodb/storage/fs1/fs1tools/dump.go
View file @
b90ada39
...
@@ -50,13 +50,12 @@ type Dumper interface {
...
@@ -50,13 +50,12 @@ type Dumper interface {
// transaction if it needs to dump information about data records.
// transaction if it needs to dump information about data records.
//
//
// If dumper return io.EOF the whole dumping process finishes.
// If dumper return io.EOF the whole dumping process finishes.
// XXX -> better dedicated err?
DumpTxn
(
buf
*
xfmt
.
Buffer
,
it
*
fs1
.
Iter
)
error
DumpTxn
(
buf
*
xfmt
.
Buffer
,
it
*
fs1
.
Iter
)
error
}
}
// Dump dumps content of a FileStorage file @ path.
// Dump dumps content of a FileStorage file @ path.
// To do so it reads file header and then iterates over all transactions in the file.
// To do so it reads file header and then iterates over all transactions in the file.
// The logic to actually output information and
if needed read/process data
is implemented by Dumper d.
// The logic to actually output information and
, if needed read/process data,
is implemented by Dumper d.
func
Dump
(
w
io
.
Writer
,
path
string
,
dir
fs1
.
IterDir
,
d
Dumper
)
(
err
error
)
{
func
Dump
(
w
io
.
Writer
,
path
string
,
dir
fs1
.
IterDir
,
d
Dumper
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: %s"
,
path
,
d
.
DumperName
())
// XXX ok?
defer
xerr
.
Contextf
(
&
err
,
"%s: %s"
,
path
,
d
.
DumperName
())
// XXX ok?
...
@@ -78,7 +77,7 @@ func Dump(w io.Writer, path string, dir fs1.IterDir, d Dumper) (err error) {
...
@@ -78,7 +77,7 @@ func Dump(w io.Writer, path string, dir fs1.IterDir, d Dumper) (err error) {
return
err
return
err
}
}
// make sure to flush buffer
if we return prematurely e.g. with an error
// make sure to flush buffer
on return
defer
func
()
{
defer
func
()
{
err2
:=
flushBuf
()
err2
:=
flushBuf
()
err
=
xerr
.
First
(
err
,
err2
)
err
=
xerr
.
First
(
err
,
err2
)
...
...
go/zodb/storage/fs1/fs1tools/
re
index.go
→
go/zodb/storage/fs1/fs1tools/index.go
View file @
b90ada39
...
@@ -94,3 +94,5 @@ func reindexMain(argv []string) {
...
@@ -94,3 +94,5 @@ func reindexMain(argv []string) {
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
}
}
// TODO verify-index
go/zodb/storage/fs1/fs1tools/main.go
View file @
b90ada39
...
@@ -28,7 +28,7 @@ var commands = zodbtools.CommandRegistry{
...
@@ -28,7 +28,7 @@ var commands = zodbtools.CommandRegistry{
// + fsstats? (fsstats.py)
// + fsstats? (fsstats.py)
{
"reindex"
,
reindexSummary
,
reindexUsage
,
reindexMain
},
{
"reindex"
,
reindexSummary
,
reindexUsage
,
reindexMain
},
// XXX reindex -> reindex, verify-index
{
"verify-index"
,
verifyIdxSummary
,
verifyIdxUsage
,
verifyIdxMaxin
},
// recover (fsrecover.py)
// recover (fsrecover.py)
// verify (fstest.py)
// verify (fstest.py)
...
...
go/zodb/storage/fs1/py/gen-testdata
View file @
b90ada39
...
@@ -198,7 +198,7 @@ def main():
...
@@ -198,7 +198,7 @@ def main():
with
open
(
"ztestdata_expect_test.go"
,
"w"
)
as
f
:
with
open
(
"ztestdata_expect_test.go"
,
"w"
)
as
f
:
def
emit
(
v
):
def
emit
(
v
):
print
>>
f
,
v
print
>>
f
,
v
emit
(
"// Code generated by %s; DO NOT EDIT."
%
__
nam
e__
)
emit
(
"// Code generated by %s; DO NOT EDIT."
%
__
fil
e__
)
emit
(
"package fs1
\
n
"
)
emit
(
"package fs1
\
n
"
)
emit
(
"import
\
"
lab.nexedi.com/kirr/neo/go/zodb
\
"
\
n
"
)
emit
(
"import
\
"
lab.nexedi.com/kirr/neo/go/zodb
\
"
\
n
"
)
...
...
go/zodb/storage/fs1/ztestdata_expect_test.go
View file @
b90ada39
// Code generated by py/gen-testdata; DO NOT EDIT.
// Code generated by
./
py/gen-testdata; DO NOT EDIT.
package
fs1
package
fs1
import
"lab.nexedi.com/kirr/neo/go/zodb"
import
"lab.nexedi.com/kirr/neo/go/zodb"
...
...
go/zodb/zodb.go
View file @
b90ada39
...
@@ -165,6 +165,7 @@ type IStorage interface {
...
@@ -165,6 +165,7 @@ type IStorage interface {
// tpc_finish(txn, callback) XXX clarify about callback
// tpc_finish(txn, callback) XXX clarify about callback
// tpc_abort(txn)
// tpc_abort(txn)
// XXX allow iteration both ways (forward & backward)
// XXX text
// XXX text
Iterate
(
tidMin
,
tidMax
Tid
)
IStorageIterator
// XXX , error ?
Iterate
(
tidMin
,
tidMax
Tid
)
IStorageIterator
// XXX , error ?
}
}
...
...
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