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
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
Stefane Fermigier
neo
Commits
64199d5f
Commit
64199d5f
authored
Apr 04, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4c602537
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
t/neo/storage/fs1/xbufio.go
t/neo/storage/fs1/xbufio.go
+0
-1
t/neo/storage/fs1/xbufio_test.go
t/neo/storage/fs1/xbufio_test.go
+9
-4
No files found.
t/neo/storage/fs1/xbufio.go
View file @
64199d5f
...
@@ -134,7 +134,6 @@ func (sb *SeqBufReader) ReadAt(p []byte, pos int64) (int, error) {
...
@@ -134,7 +134,6 @@ func (sb *SeqBufReader) ReadAt(p []byte, pos int64) (int, error) {
sb
.
pos
=
xpos
sb
.
pos
=
xpos
sb
.
buf
=
sb
.
buf
[
:
nn
]
sb
.
buf
=
sb
.
buf
[
:
nn
]
// here we know:
// here we know:
// - some data was read
// - some data was read
// - in case of successful read pos/p lies completely inside sb.pos/sb.buf
// - in case of successful read pos/p lies completely inside sb.pos/sb.buf
...
...
t/neo/storage/fs1/xbufio_test.go
View file @
64199d5f
...
@@ -40,7 +40,7 @@ func (r *XReader) ReadAt(p []byte, pos int64) (n int, err error) {
...
@@ -40,7 +40,7 @@ func (r *XReader) ReadAt(p []byte, pos int64) (n int, err error) {
// read @pos/len -> rb.pos, len(rb.buf)
// read @pos/len -> rb.pos, len(rb.buf)
var
xSeqBufTestv
=
[]
struct
{
pos
int64
;
Len
int
;
bufPos
int64
;
bufLen
int
}
{
// XXX add ioPos ?
var
xSeqBufTestv
=
[]
struct
{
pos
int64
;
Len
int
;
bufPos
int64
;
bufLen
int
}
{
{
40
,
5
,
40
,
10
},
// 1st access, forward by default
{
40
,
5
,
40
,
10
},
// 1st access, forward by default
{
45
,
7
,
50
,
10
},
// part taken from buf, part read next, forward
{
45
,
7
,
50
,
10
},
// part taken from buf, part read next, forward
{
52
,
5
,
50
,
10
},
// everything taken from buf
{
52
,
5
,
50
,
10
},
// everything taken from buf
...
@@ -52,8 +52,10 @@ var xSeqBufTestv = []struct {pos int64; Len int; bufPos int64; bufLen int} { //
...
@@ -52,8 +52,10 @@ var xSeqBufTestv = []struct {pos int64; Len int; bufPos int64; bufLen int} { //
{
97
,
4
,
100
,
0
},
// this triggers user-visible EIO, buffer scratched
{
97
,
4
,
100
,
0
},
// this triggers user-visible EIO, buffer scratched
{
101
,
5
,
101
,
0
},
// EIO again
{
101
,
5
,
101
,
0
},
// EIO again
{
105
,
5
,
105
,
10
},
// past EIO range - buffer refilled
{
105
,
5
,
105
,
10
},
// past EIO range - buffer refilled
{
110
,
70
,
105
,
10
},
// very big access forward, buf untouched
{
88
,
8
,
88
,
10
},
// go back again a bit before EIO range
{
180
,
70
,
105
,
10
},
// big access ~ forward
{
96
,
6
,
98
,
2
},
// this uses both buffered data + result of next read which hits EIO
{
110
,
70
,
98
,
2
},
// very big access forward, buf untouched
{
180
,
70
,
98
,
2
},
// big access ~ forward
{
172
,
5
,
170
,
10
},
// backward: buffer refilled up to posLastIO
{
172
,
5
,
170
,
10
},
// backward: buffer refilled up to posLastIO
{
168
,
4
,
160
,
10
},
// backward: buffer refilled backward
{
168
,
4
,
160
,
10
},
// backward: buffer refilled backward
...
@@ -68,7 +70,10 @@ var xSeqBufTestv = []struct {pos int64; Len int; bufPos int64; bufLen int} { //
...
@@ -68,7 +70,10 @@ var xSeqBufTestv = []struct {pos int64; Len int; bufPos int64; bufLen int} { //
{
136
,
20
,
131
,
10
},
// big forward starting from inside filled buf
{
136
,
20
,
131
,
10
},
// big forward starting from inside filled buf
{
128
,
4
,
126
,
10
},
// backward: buf refilled up to posLastIO
{
128
,
4
,
126
,
10
},
// backward: buf refilled up to posLastIO
{
40
,
0
,
126
,
10
},
// zero-sized out-of-buffer read do not change buffer
{
5
,
4
,
5
,
10
},
// forward near file start
{
2
,
3
,
0
,
10
},
// backward: buf does not go beyong 0
{
40
,
0
,
0
,
10
},
// zero-sized out-of-buffer read do not change buffer
// backward vs EIO
// backward vs EIO
{
110
,
1
,
110
,
10
},
// reset state: forward @110
{
110
,
1
,
110
,
10
},
// reset state: forward @110
...
...
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