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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
edee1820
Commit
edee1820
authored
Jul 21, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
deb3bdd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+36
-2
No files found.
go/zodb/storage/fs1/filestorage.go
View file @
edee1820
...
@@ -668,8 +668,8 @@ func (dh *DataHeader) LoadData(r io.ReaderAt /* *os.File */, buf *[]byte) error
...
@@ -668,8 +668,8 @@ func (dh *DataHeader) LoadData(r io.ReaderAt /* *os.File */, buf *[]byte) error
return
nil
return
nil
}
}
//
Open opens FileStorage XXX text
//
open opens FileStorage without loading index
func
Open
(
ctx
context
.
Context
,
path
string
)
(
*
FileStorage
,
error
)
{
func
open
(
path
string
)
(
*
FileStorage
,
error
)
{
fs
:=
&
FileStorage
{}
fs
:=
&
FileStorage
{}
f
,
err
:=
os
.
Open
(
path
)
// XXX opens in O_RDONLY
f
,
err
:=
os
.
Open
(
path
)
// XXX opens in O_RDONLY
...
@@ -688,6 +688,7 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
...
@@ -688,6 +688,7 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
return
nil
,
fmt
.
Errorf
(
"%s: invalid magic %q"
,
path
,
xxx
)
// XXX err?
return
nil
,
fmt
.
Errorf
(
"%s: invalid magic %q"
,
path
,
xxx
)
// XXX err?
}
}
/*
// TODO recreate index if missing / not sane (cancel this job on ctx.Done)
// TODO recreate index if missing / not sane (cancel this job on ctx.Done)
// TODO verify index sane / topPos matches
// TODO verify index sane / topPos matches
topPos, index, err := LoadIndexFile(path + ".index")
topPos, index, err := LoadIndexFile(path + ".index")
...
@@ -695,6 +696,16 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
...
@@ -695,6 +696,16 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
panic(err) // XXX err
panic(err) // XXX err
}
}
fs.index = index
fs.index = index
*/
// determine topPos from file size
// if it is invalid (e.g. a transaction half-way commit) we'll catch it
// while loading/recreating index
fi
,
err
:=
f
.
Stat
()
if
err
!=
nil
{
return
nil
,
err
// XXX err ctx
}
topPos
:=
fi
.
Size
()
// read tidMin/tidMax
// read tidMin/tidMax
// FIXME support empty file case
// FIXME support empty file case
...
@@ -723,6 +734,29 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
...
@@ -723,6 +734,29 @@ func Open(ctx context.Context, path string) (*FileStorage, error) {
return
fs
,
nil
return
fs
,
nil
}
}
// Open opens FileStorage XXX text
func
Open
(
ctx
context
.
Context
,
path
string
)
(
*
FileStorage
,
error
)
{
fs
,
err
:=
open
(
path
)
if
err
!=
nil
{
return
nil
,
err
}
// TODO recreate index if missing / not sane (cancel this job on ctx.Done)
topPos
,
index
,
err
:=
LoadIndexFile
(
path
+
".index"
)
if
err
!=
nil
{
panic
(
err
)
// XXX err
}
// TODO verify index sane / topPos matches
if
topPos
!=
fs
.
txnhMax
.
Pos
+
fs
.
txnhMax
.
Len
{
panic
(
"inconsistent index topPos"
)
// XXX
}
fs
.
index
=
index
return
fs
,
nil
}
func
(
fs
*
FileStorage
)
LastTid
()
(
zodb
.
Tid
,
error
)
{
func
(
fs
*
FileStorage
)
LastTid
()
(
zodb
.
Tid
,
error
)
{
// XXX check we have transactions at all
// XXX check we have transactions at all
...
...
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