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
53b772dd
Commit
53b772dd
authored
Feb 23, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0921f02d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
11 deletions
+28
-11
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+4
-4
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+23
-6
t/neo/zodb/zodb.go
t/neo/zodb/zodb.go
+1
-1
No files found.
t/neo/storage/fs1/filestorage.go
View file @
53b772dd
...
...
@@ -116,7 +116,7 @@ func (dh *DataHeader) Decode(r io.ReaderAt, pos int64) error {
func
New
FileStorage
(
path
string
)
(
*
FileStorage
,
error
)
{
func
Open
FileStorage
(
path
string
)
(
*
FileStorage
,
error
)
{
f
,
err
:=
os
.
Open
(
path
)
// XXX opens in O_RDONLY
if
err
!=
nil
{
return
nil
,
err
// XXX err more context ?
...
...
@@ -248,9 +248,9 @@ func (fs *FileStorage) StorageName() string {
return
"FileStorage v1"
}
func
(
fs
*
FileStorage
)
Iterate
(
start
,
stop
zodb
.
Tid
)
zodb
.
IStorageIterator
{
if
start
!=
zodb
.
Tid0
||
stop
!=
zodb
.
TidMax
{
panic
(
"TODO
start/stop
support"
)
func
(
fs
*
FileStorage
)
Iterate
(
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
IStorageIterator
{
if
tidMin
!=
zodb
.
Tid0
||
tidMax
!=
zodb
.
TidMax
{
panic
(
"TODO
tidMin/tidMax
support"
)
}
// TODO
...
...
t/neo/storage/fs1/filestorage_test.go
View file @
53b772dd
...
...
@@ -37,10 +37,6 @@ type oidLoadedOk struct {
data
[]
byte
}
// current knowledge of what was "before" for an oid as we scan over
// data base entries
type
beforeMap
map
[
zodb
.
Oid
]
oidLoadedOk
func
checkLoad
(
t
*
testing
.
T
,
fs
*
FileStorage
,
xid
zodb
.
Xid
,
expect
oidLoadedOk
)
{
data
,
tid
,
err
:=
fs
.
Load
(
xid
)
if
err
!=
nil
{
...
...
@@ -55,12 +51,15 @@ func checkLoad(t *testing.T, fs *FileStorage, xid zodb.Xid, expect oidLoadedOk)
}
func
TestLoad
(
t
*
testing
.
T
)
{
fs
,
err
:=
New
FileStorage
(
"testdata/1.fs"
)
fs
,
err
:=
Open
FileStorage
(
"testdata/1.fs"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
//defer xclose(fs)
before
:=
beforeMap
{}
// current knowledge of what was "before" for an oid as we scan over
// data base entries
before
:=
map
[
zodb
.
Oid
]
oidLoadedOk
{}
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
for
_
,
txe
:=
range
dbe
.
Entryv
{
...
...
@@ -93,4 +92,22 @@ func TestLoad(t *testing.T) {
xid
:=
zodb
.
Xid
{
zodb
.
XTid
{
zodb
.
TidMax
,
true
},
oid
}
checkLoad
(
t
,
fs
,
xid
,
expect
)
}
// check iterating XXX move to separate test ?
// tids we will use for tid{Min,Max}
tidv
:=
[]
zodb
.
Tid
{
zodb
.
Tid
(
0
)}
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
tidv
=
append
(
tidv
,
dbe
.
Header
.
Tid
)
}
tidv
=
append
(
tidv
,
zodb
.
TidMax
)
for
i
,
tidMin
:=
range
tidv
{
for
j
,
tidMax
:=
range
tidv
{
iter
:=
fs
.
Iterate
(
tidMin
,
tidMax
)
if
tidMin
>
tidMax
{
// expect error / panic or empty iteration ?
}
}
}
}
t/neo/zodb/zodb.go
View file @
53b772dd
...
...
@@ -153,7 +153,7 @@ type IStorage interface {
// tpc_finish(txn, callback) XXX clarify about callback
// tpc_abort(txn)
Iterate
(
start
,
stop
Tid
)
IStorageIterator
// XXX -> Iter() ?
Iterate
(
tidMin
,
tidMax
Tid
)
IStorageIterator
// XXX -> Iter() ?
}
type
IStorageIterator
interface
{
...
...
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