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
741b31d4
Commit
741b31d4
authored
Feb 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8d2589f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+7
-10
No files found.
t/neo/storage/fs1/filestorage.go
View file @
741b31d4
...
...
@@ -50,7 +50,7 @@ type TxnHeader struct {
// transaction metadata tself
zodb
.
TxnInfo
// underlying memory for loading and for user/desc/extension
// underlying memory for
header
loading and for user/desc/extension
workMem
[]
byte
}
...
...
@@ -73,12 +73,13 @@ func (e *ErrTxnRecord) Error() string {
// DataHeader represents header of a data record
type
DataHeader
struct
{
Pos
int64
// position of data record
Oid
zodb
.
Oid
Tid
zodb
.
Tid
Prev
DataRecPos
int64
// previous-record file-position XXX name
Prev
RevPos
int64
// position of this oid's previous-revision data record
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 XXX -> int64 too ?
DataLen
int64
// length of following data. if 0 -> following = 8 bytes backpointer XXX -> validate in code
// if backpointer == 0 -> oid deleted
//Data []byte
//DataRecPos uint64 // if Data == nil -> byte position of data record containing data
...
...
@@ -203,7 +204,7 @@ func (txnh *TxnHeader) loadStrings(r io.ReaderAt) error {
txnh
.
Extension
=
txnh
.
Extension
[
:
cap
(
txnh
.
Extension
)]
}
//
l
oadPrev reads and decodes previous transaction record header from a readerAt
//
L
oadPrev reads and decodes previous transaction record header from a readerAt
// txnh should be already initialized by previous call to load()
func
(
txnh
*
TxnHeader
)
LoadPrev
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
if
txnh
.
PrevLen
==
0
{
...
...
@@ -213,7 +214,7 @@ func (txnh *TxnHeader) LoadPrev(r io.ReaderAt, flags TxnLoadFlags) error {
return
txnh
.
Load
(
r
,
txnh
.
Pos
-
txnh
.
PrevLen
,
flags
)
}
//
l
oadNext reads and decodes next transaction record header from a readerAt
//
L
oadNext reads and decodes next transaction record header from a readerAt
// txnh should be already initialized by previous call to load()
func
(
txnh
*
TxnHeader
)
LoadNext
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
return
txnh
.
Load
(
r
,
txnh
.
Pos
+
txnh
.
Len
,
flags
)
...
...
@@ -226,13 +227,9 @@ func (txnh *TxnHeader) LoadNext(r io.ReaderAt, flags TxnLoadFlags) error {
// XXX io.ReaderAt -> *os.File (if iface conv costly)
func
(
dh
*
DataHeader
)
decode
(
r
io
.
ReaderAt
,
pos
int64
,
tmpBuf
*
[
dataHeaderSize
]
byte
)
error
{
n
,
err
:=
r
.
ReadAt
(
tmpBuf
[
:
],
pos
)
// XXX vvv if EOF is after header - record is broken
if
n
==
dataHeaderSize
{
err
=
nil
// we don't mind if it was EOF after full header read
}
if
err
!=
nil
{
return
&
ErrDataRecord
{
pos
,
"read"
,
err
}
return
&
ErrDataRecord
{
pos
,
"read"
,
noEof
(
err
)
}
}
dh
.
Oid
=
zodb
.
Oid
(
binary
.
BigEndian
.
Uint64
(
tmpBuf
[
0
:
]))
// XXX -> zodb.Oid.Decode() ?
...
...
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