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
af648a62
Commit
af648a62
authored
Feb 21, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
39fbb668
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
t/NOTES.go
t/NOTES.go
+4
-0
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+13
-8
No files found.
t/NOTES.go
View file @
af648a62
...
...
@@ -20,3 +20,7 @@
graphite
-
clickhous
/
helper
/
pickle
.
go
particular
fsIndex
:
by
hand
-
file
size
/
file
offset
(
off_t
)
is
defined
to
be
_signed_
by
posix
->
so
use
int64
(
not
uint64
)
for
file
pos
/
size
t/neo/storage/fs1/filestorage.go
View file @
af648a62
...
...
@@ -53,10 +53,10 @@ type TxnRecHead struct {
type
DataHeader
struct
{
Oid
zodb
.
Oid
Tid
zodb
.
Tid
PrevDataRecPos
uint64
// previous-record file-position
TxnPos
uint64
// position of transaction record this data record belongs to
PrevDataRecPos
int64
// previous-record file-position
TxnPos
int64
// position of transaction record this data record belongs to
_
uint16
// 2-bytes with zero values. (Was version length.)
DataLen
uint64
// length of following data. if 0 -> following = 8 bytes backpointer
DataLen
uint64
// length of following data. if 0 -> following = 8 bytes backpointer
XXX -> int64 too ?
// if backpointer == 0 -> oid deleted
//Data []byte
//DataRecPos uint64 // if Data == nil -> byte position of data record containing data
...
...
@@ -94,10 +94,10 @@ func (dh *DataHeader) decode(r io.ReaderAt, pos int64, tmpBuf *[DataHeaderSize]b
return
&
ErrDataRecord
{
pos
,
"read"
,
err
}
}
dh
.
Oid
.
Decode
(
tmpBuf
[
0
:
])
dh
.
Tid
.
Decode
(
tmpBuf
[
8
:
])
dh
.
PrevDataRecPos
=
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
16
:
]
)
dh
.
TxnPos
=
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
24
:
]
)
dh
.
Oid
=
zodb
.
Oid
(
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
0
:
]))
// XXX -> zodb.Oid.Decode() ?
dh
.
Tid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
8
:
]))
// XXX -> zodb.Tid.Decode() ?
dh
.
PrevDataRecPos
=
int64
(
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
16
:
])
)
dh
.
TxnPos
=
int64
(
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
24
:
])
)
verlen
:=
binary
.
BigEndian
.
Uint16
(
tmpBuf
[
32
:
])
dh
.
DataLen
=
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
34
:
])
...
...
@@ -128,6 +128,11 @@ func NewFileStorage(path string) (*FileStorage, error) {
// TODO read/recreate index
}
func
(
fs
*
FileStorage
)
LastTid
()
zodb
.
Tid
{
panic
(
"TODO"
)
}
// ErrXidLoad is returned when there is an error while loading xid
type
ErrXidLoad
struct
{
Xid
zodb
.
Xid
...
...
@@ -154,7 +159,7 @@ func (fs *FileStorage) Load(xid zodb.Xid) (data []byte, tid zodb.Tid, err error)
// search backwards for when we first have data record with tid satisfying xid.XTid
for
{
prevTid
:=
dh
.
Tid
//
prevTid := dh.Tid
err
=
dh
.
Decode
(
fs
.
f
,
dataPos
)
if
err
!=
nil
{
return
nil
,
zodb
.
Tid
(
0
),
&
ErrXidLoad
{
xid
,
err
}
...
...
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