Repository navigation
Add a storage-driver for speedy - #685
zhangcoldwater wants to merge 9 commits into
Conversation
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
There was a problem hiding this comment.
n can be > 0, so returning totalRead withoud adding n is not correct.
There was a problem hiding this comment.
in registry/storage/filewriter.go
// Write writes the buffer p at the current write offset.
func (fw *fileWriter) Write(p []byte) (n int, err error) {
nn, err := fw.ReadFrom(bytes.NewReader(p))
return int(nn), err
}
// ReadFrom reads reader r until io.EOF writing the contents at the current
// offset.
func (fw *fileWriter) ReadFrom(r io.Reader) (n int64, err error) {
if fw.err != nil {
return 0, fw.err
}
nn, err := fw.driver.WriteStream(fw.ctx, fw.path, fw.offset, r) //the problem about totoalRead+n is in Speedy.WriteStream
// We should forward the offset, whether or not there was an error.
// Basically, we keep the filewriter in sync with the reader's head. If an
// error is encountered, the whole thing should be retried but we proceed
// from an expected offset, even if the data didn't make it to the
// backend.
fw.offset += nn
if fw.offset > fw.size {
fw.size = fw.offset
}
return nn, err
}
go/src/pkg/bytes/reader.go
func (r *Reader) Read(b []byte) (n int, err error) {
if len(b) == 0 {
return 0, nil
}
if r.i >= int64(len(r.s)) {
return 0, io.EOF //we can find that when err is not nil, n == 0
}
r.prevRune = -1
n = copy(b, r.s[r.i:])
r.i += int64(n)
return
}
if err != nil, n == 0, so returning totalRead do not need add n.
At 2015-08-12 06:28:25, "Anton Tyurin" [email protected] wrote:
In registry/storage/driver/speedy/speedy.go:
var distance uint64if currentSize > uint64(offset) {distance = currentSize - uint64(offset)}
for distance > 0 {var readSize uint64if distance > tempSize {readSize = tempSize} else {readSize = distance}
n, err := reader.Read(tempBuf[0:readSize])if err != nil {return totalRead, err
n can be > 0, so returning totalRead withoud adding n is not correct.
—
Reply to this email directly or view it on GitHub.
|
Is Speedy even supported anymore? The project seems abandoned. |
|
The Speedy project has not been updated in 3 years. At this point, it doesn't feel like this driver is going to receive enough attention to pass the quality bar necessary for us to ship it as part of the registry. Closing for now. @zhangcoldwater if you still feel we should support this, please say so here so that we can discuss conditions for it to be merged. |
Add a storage-driver for speedy.
Speedy(https://github.com/jcloudpub/speedy) is a high performance distributed docker image storage solution written by go/c.
After testing, this driver works well with docker-1.6, distribution and speedy.