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
193859ea
Commit
193859ea
authored
Feb 16, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
20d53f7a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
t/neo/storage/fs1/index.go
t/neo/storage/fs1/index.go
+5
-5
t/neo/storage/fs1/index_test.go
t/neo/storage/fs1/index_test.go
+3
-1
No files found.
t/neo/storage/fs1/index.go
View file @
193859ea
...
@@ -58,7 +58,7 @@ func fsIndexNew() *fsIndex {
...
@@ -58,7 +58,7 @@ func fsIndexNew() *fsIndex {
//
//
//
//
// fsBucket:
// fsBucket:
// oid[6:8]oid[6:8]oid[6:8]...pos[
0:6]pos[0:6]pos[0:6
]...
// oid[6:8]oid[6:8]oid[6:8]...pos[
2:8]pos[2:8]pos[2:8
]...
const
(
const
(
...
@@ -91,7 +91,7 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
...
@@ -91,7 +91,7 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
var
posb
[
8
]
byte
var
posb
[
8
]
byte
var
oidPrefixCur
zodb
.
Oid
// current oid[0:6] with [6:8] = 00
var
oidPrefixCur
zodb
.
Oid
// current oid[0:6] with [6:8] = 00
oidBuf
:=
[]
byte
{}
// current oid[6:8]oid[6:8]...
oidBuf
:=
[]
byte
{}
// current oid[6:8]oid[6:8]...
posBuf
:=
[]
byte
{}
// current pos[
0:6]pos[0:6
]...
posBuf
:=
[]
byte
{}
// current pos[
2:8]pos[2:8
]...
var
t
[
2
]
interface
{}
// tuple for (oid, fsBucket.toString())
var
t
[
2
]
interface
{}
// tuple for (oid, fsBucket.toString())
e
,
_
:=
fsi
.
SeekFirst
()
e
,
_
:=
fsi
.
SeekFirst
()
...
@@ -103,8 +103,8 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
...
@@ -103,8 +103,8 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
oidPrefix
:=
oid
&
oidPrefixMask
oidPrefix
:=
oid
&
oidPrefixMask
if
oidPrefix
!=
oidPrefixCur
||
errStop
!=
nil
{
if
oidPrefix
!=
oidPrefixCur
||
errStop
!=
nil
{
// emit (oid[0:6], oid[6:8]oid[6:8]...pos[
0:6]pos[0:6
]...)
// emit (oid[0:6], oid[6:8]oid[6:8]...pos[
2:8]pos[2:8
]...)
binary
.
BigEndian
.
PutUint64
(
oidb
[
:
],
uint64
(
oid
))
binary
.
BigEndian
.
PutUint64
(
oidb
[
:
],
uint64
(
oid
PrefixCur
))
t
[
0
]
=
oidb
[
0
:
6
]
t
[
0
]
=
oidb
[
0
:
6
]
t
[
1
]
=
bytes
.
Join
([][]
byte
{
oidBuf
,
posBuf
},
nil
)
t
[
1
]
=
bytes
.
Join
([][]
byte
{
oidBuf
,
posBuf
},
nil
)
err
=
p
.
Encode
(
t
)
err
=
p
.
Encode
(
t
)
...
@@ -131,7 +131,7 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
...
@@ -131,7 +131,7 @@ func (fsi *fsIndex) Save(topPos int64, w io.Writer) error {
binary
.
BigEndian
.
PutUint64
(
posb
[
:
],
uint64
(
pos
))
binary
.
BigEndian
.
PutUint64
(
posb
[
:
],
uint64
(
pos
))
oidBuf
=
append
(
oidBuf
,
oidb
[
6
:
8
]
...
)
oidBuf
=
append
(
oidBuf
,
oidb
[
6
:
8
]
...
)
posBuf
=
append
(
posBuf
,
posb
[
0
:
6
]
...
)
posBuf
=
append
(
posBuf
,
posb
[
2
:
8
]
...
)
}
}
}
}
...
...
t/neo/storage/fs1/index_test.go
View file @
193859ea
...
@@ -162,7 +162,9 @@ func TestIndexSaveLoad(t *testing.T) {
...
@@ -162,7 +162,9 @@ func TestIndexSaveLoad(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
false
{
defer
os
.
RemoveAll
(
workdir
)
defer
os
.
RemoveAll
(
workdir
)
}
topPos
:=
int64
(
786
)
topPos
:=
int64
(
786
)
fsi
:=
fsIndexNew
()
fsi
:=
fsIndexNew
()
...
...
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