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
741b31d4
Commit
741b31d4
authored
Feb 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8d2589f8
Changes
1
Hide 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 {
...
@@ -50,7 +50,7 @@ type TxnHeader struct {
// transaction metadata tself
// transaction metadata tself
zodb
.
TxnInfo
zodb
.
TxnInfo
// underlying memory for loading and for user/desc/extension
// underlying memory for
header
loading and for user/desc/extension
workMem
[]
byte
workMem
[]
byte
}
}
...
@@ -73,12 +73,13 @@ func (e *ErrTxnRecord) Error() string {
...
@@ -73,12 +73,13 @@ func (e *ErrTxnRecord) Error() string {
// DataHeader represents header of a data record
// DataHeader represents header of a data record
type
DataHeader
struct
{
type
DataHeader
struct
{
Pos
int64
// position of data record
Oid
zodb
.
Oid
Oid
zodb
.
Oid
Tid
zodb
.
Tid
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
TxnPos
int64
// position of transaction record this data record belongs to
//_ uint16 // 2-bytes with zero values. (Was version length.)
//_ 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
// if backpointer == 0 -> oid deleted
//Data []byte
//Data []byte
//DataRecPos uint64 // if Data == nil -> byte position of data record containing data
//DataRecPos uint64 // if Data == nil -> byte position of data record containing data
...
@@ -203,7 +204,7 @@ func (txnh *TxnHeader) loadStrings(r io.ReaderAt) error {
...
@@ -203,7 +204,7 @@ func (txnh *TxnHeader) loadStrings(r io.ReaderAt) error {
txnh
.
Extension
=
txnh
.
Extension
[
:
cap
(
txnh
.
Extension
)]
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()
// txnh should be already initialized by previous call to load()
func
(
txnh
*
TxnHeader
)
LoadPrev
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
func
(
txnh
*
TxnHeader
)
LoadPrev
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
if
txnh
.
PrevLen
==
0
{
if
txnh
.
PrevLen
==
0
{
...
@@ -213,7 +214,7 @@ func (txnh *TxnHeader) LoadPrev(r io.ReaderAt, flags TxnLoadFlags) error {
...
@@ -213,7 +214,7 @@ func (txnh *TxnHeader) LoadPrev(r io.ReaderAt, flags TxnLoadFlags) error {
return
txnh
.
Load
(
r
,
txnh
.
Pos
-
txnh
.
PrevLen
,
flags
)
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()
// txnh should be already initialized by previous call to load()
func
(
txnh
*
TxnHeader
)
LoadNext
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
func
(
txnh
*
TxnHeader
)
LoadNext
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
return
txnh
.
Load
(
r
,
txnh
.
Pos
+
txnh
.
Len
,
flags
)
return
txnh
.
Load
(
r
,
txnh
.
Pos
+
txnh
.
Len
,
flags
)
...
@@ -226,13 +227,9 @@ func (txnh *TxnHeader) LoadNext(r io.ReaderAt, flags TxnLoadFlags) error {
...
@@ -226,13 +227,9 @@ func (txnh *TxnHeader) LoadNext(r io.ReaderAt, flags TxnLoadFlags) error {
// XXX io.ReaderAt -> *os.File (if iface conv costly)
// XXX io.ReaderAt -> *os.File (if iface conv costly)
func
(
dh
*
DataHeader
)
decode
(
r
io
.
ReaderAt
,
pos
int64
,
tmpBuf
*
[
dataHeaderSize
]
byte
)
error
{
func
(
dh
*
DataHeader
)
decode
(
r
io
.
ReaderAt
,
pos
int64
,
tmpBuf
*
[
dataHeaderSize
]
byte
)
error
{
n
,
err
:=
r
.
ReadAt
(
tmpBuf
[
:
],
pos
)
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
{
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() ?
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