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
68f80523
Commit
68f80523
authored
8 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
461b9ef4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+12
-18
No files found.
t/neo/storage/fs1/filestorage.go
View file @
68f80523
...
...
@@ -172,54 +172,48 @@ func (txnh *TxnHeader) Load(r io.ReaderAt, pos int64) error {
txnh
.
Description
=
work
[
luser
:
luser
:
ldesc
]
txnh
.
Extension
=
work
[
luser
+
ldesc
:
luser
+
ldesc
:
lext
]
// XXX make
loading strings
optional
// XXX make
strings loading
optional
txnh
.
loadString
()
return
txnHeaderFixSize
+
lstr
,
nil
}
// loadStrings makes sure strings that are part of transaction header are loaded
func
(
txnh
*
TxnHeader
)
loadStrings
(
r
io
.
ReaderAt
)
error
{
// XXX make it no-op if strings are already loaded?
// we rely on Load leaving len(workMem) = sum of all strings length ...
nstr
,
err
=
r
.
ReadAt
(
txnh
.
workMem
,
txnh
.
Pos
+
txnHeaderFixSize
)
if
err
!=
nil
{
return
0
,
&
ErrTxnRecord
{
txnh
.
Pos
,
"read"
,
noEof
(
err
)}
return
0
,
&
ErrTxnRecord
{
txnh
.
Pos
,
"read"
,
noEof
(
err
)}
// XXX -> "read strings" ?
}
// ... and presetting x to point to appropriate places in .workMem .
// so set len(x) = cap(x) to indicate strings are now loaded.
txnh
.
User
=
txnh
.
User
[
:
cap
(
txnh
.
User
)]
txnh
.
Description
=
txnh
.
User
[
:
cap
(
txnh
.
Description
)]
txnh
.
Extension
=
txnh
.
User
[
:
cap
(
txnh
.
Extension
)]
txnh
.
Description
=
txnh
.
Description
[
:
cap
(
txnh
.
Description
)]
txnh
.
Extension
=
txnh
.
Extension
[
:
cap
(
txnh
.
Extension
)]
}
// loadPrev 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
,
tmpBuf
*
[
txnXHeaderFixSize
]
byte
)
error
{
func
(
txnh
*
TxnHeader
)
LoadPrev
(
r
io
.
ReaderAt
)
error
{
if
txnh
.
PrevLen
==
0
{
return
io
.
EOF
}
return
txnh
.
load
(
r
,
txnh
.
Pos
-
txnh
.
PrevLen
,
tmpBuf
)
return
txnh
.
Load
(
r
,
txnh
.
Pos
-
txnh
.
PrevLen
)
}
// loadNext 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
,
tmpBuf
*
[
txnXHeaderFixSize
]
byte
)
error
{
return
txnh
.
load
(
r
,
txnh
.
Pos
+
txnh
.
Len
,
tmpBuf
)
func
(
txnh
*
TxnHeader
)
LoadNext
(
r
io
.
ReaderAt
)
error
{
return
txnh
.
Load
(
r
,
txnh
.
Pos
+
txnh
.
Len
)
}
// XXX do we need Decode when decode() is there?
func
(
th
*
TxnHeader
)
Decode
(
r
io
.
ReaderAt
,
pos
int64
)
(
n
int
,
err
error
)
{
var
tmpBuf
[
txnXHeaderFixSize
]
byte
return
th
.
decode
(
r
,
pos
,
&
tmpBuf
)
}
func
(
th
*
TxnHeader
)
DecodePrev
(
r
io
.
ReaderAt
,
pos
int64
)
(
posPrev
int64
,
n
int
,
err
error
)
{
var
tmpBuf
[
txnXHeaderFixSize
]
byte
return
th
.
decodePrev
(
r
,
pos
,
&
tmpBuf
)
}
// XXX -> Load ?
// decode reads and decodes data record header from a readerAt
// XXX io.ReaderAt -> *os.File (if iface conv costly)
func
(
dh
*
DataHeader
)
decode
(
r
io
.
ReaderAt
,
pos
int64
,
tmpBuf
*
[
dataHeaderSize
]
byte
)
error
{
...
...
This diff is collapsed.
Click to expand it.
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