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
1dd5d4c1
Commit
1dd5d4c1
authored
Feb 19, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0fc00c67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
go/neo/storage/fs1/fs1.go
go/neo/storage/fs1/fs1.go
+11
-11
No files found.
go/neo/storage/fs1/fs1.go
View file @
1dd5d4c1
...
...
@@ -39,17 +39,18 @@ type Backend struct {
// 2 ? (data.fs)
// 3 packed/ (deltified objects)
//
//
XXX
we currently depend on extra functionality FS provides over
// plain zodb.IStorage (
e.g. loading with nextSerial) and even if
//
nextSerial will be gone in the future, we will probably depend on
//
particular
layout more and more -> directly work with fs1 & friends.
//
NOTE
we currently depend on extra functionality FS provides over
// plain zodb.IStorage (
loading with nextSerial) and even if nextSerial
//
will be gone in the future, we will probably depend on particular
// layout more and more -> directly work with fs1 & friends.
zstor
*
fs1
.
FileStorage
// underlying ZODB storage
}
var
_
storage
.
Backend
=
(
*
Backend
)(
nil
)
func
Open
(
ctx
context
.
Context
,
path
string
)
(
*
Backend
,
error
)
{
zstor
,
_
,
err
:=
fs1
.
Open
(
ctx
,
path
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
})
// XXX RO? +Watchq?
// XXX +Watchq? but nobody except us should change the file. -> lock?
zstor
,
_
,
err
:=
fs1
.
Open
(
ctx
,
path
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
})
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -69,7 +70,7 @@ func (f *Backend) LastOid(ctx context.Context) (zodb.Oid, error) {
}
func
(
f
*
Backend
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
*
proto
.
AnswerObject
,
error
)
{
//
FIXME
kill nextSerial support after neo/py cache does not depend on next_serial
//
TODO
kill nextSerial support after neo/py cache does not depend on next_serial
// see also: https://github.com/zopefoundation/ZODB/pull/323
buf
,
serial
,
nextSerial
,
err
:=
f
.
zstor
.
Load_XXXWithNextSerialXXX
(
ctx
,
xid
)
if
err
!=
nil
{
...
...
@@ -81,15 +82,14 @@ func (f *Backend) Load(ctx context.Context, xid zodb.Xid) (*proto.AnswerObject,
nextSerial
=
proto
.
INVALID_TID
}
return
&
proto
.
AnswerObject
{
Oid
:
xid
.
Oid
,
Serial
:
serial
,
NextSerial
:
nextSerial
,
Compression
:
false
,
Data
:
buf
,
Checksum
:
xsha1
.
NEOSum
(
buf
.
Data
),
// XXX computing every time
Compression
:
false
,
Data
:
buf
,
Checksum
:
xsha1
.
NEOSum
(
buf
.
Data
),
// XXX computing every time
// XXX .DataSerial
},
nil
...
...
@@ -103,7 +103,7 @@ func openBackend(ctx context.Context, path string) (storage.Backend, error) {
if
err
==
nil
{
return
b
,
nil
}
else
{
return
nil
,
err
//
XXX
don't return just b -> will be !nil interface
return
nil
,
err
// don't return just b -> will be !nil 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