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
53f1a309
Commit
53f1a309
authored
Feb 23, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
baf0c4b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+39
-1
No files found.
t/neo/storage/fs1/filestorage.go
View file @
53f1a309
...
...
@@ -30,6 +30,9 @@ type FileStorage struct {
index
*
fsIndex
topPos
int64
// position pointing just past last committed transaction
// (= size(f) when no commit is in progress)
// min/max tids committed
tidMin
,
tidMax
zodb
.
Tid
}
// IStorage
...
...
@@ -207,7 +210,42 @@ func OpenFileStorage(path string) (*FileStorage, error) {
panic
(
err
)
// XXX err
}
return
&
FileStorage
{
f
:
f
,
index
:
index
,
topPos
:
topPos
},
nil
// read tidMin/tidMax
// FIXME support empty file case
txnh
:=
TxnHeader
{}
_
,
err
=
txnh
.
Decode
(
f
,
4
)
if
err
!=
nil
{
return
nil
,
err
// XXX +context
}
tidMin
:=
txnh
.
Tid
var
qqq
[
8
]
byte
n
,
err
:=
f
.
ReadAt
(
qqq
[
:
],
topPos
-
8
)
if
n
==
len
(
qqq
)
{
err
=
nil
// we are ok to get EOF after reading it all
}
txnLenm8
:=
binary
.
BigEndian
.
Uint64
(
qqq
[
:
])
_
,
err
=
txnh
.
Decode
(
f
,
topPos
-
8
-
int64
(
txnLenm8
))
// XXX overflow ?
if
err
!=
nil
{
return
nil
,
err
// XXX +context
}
if
txnh
.
RecLenm8
!=
txnLenm8
{
panic
(
"redunant length mismatch"
)
// XXX
}
tidMax
:=
txnh
.
Tid
return
&
FileStorage
{
f
:
f
,
index
:
index
,
topPos
:
topPos
,
tidMin
:
tidMin
,
tidMax
:
tidMax
,
},
nil
}
...
...
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