Skip to content

Add a storage-driver for speedy - #685

Closed
zhangcoldwater wants to merge 9 commits into
distribution:masterfrom
zhangcoldwater:master
Closed

zhangcoldwater wants to merge 9 commits into
distribution:masterfrom
zhangcoldwater:master

Conversation

@zhangcoldwater

Copy link
Copy Markdown

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.

Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>
Signed-off-by: zhangcoldwater <[email protected]>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n can be > 0, so returning totalRead withoud adding n is not correct.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 uint64
    
  • if currentSize > uint64(offset) {
    
  •     distance = currentSize - uint64(offset)
    
  • }
    
  • for distance > 0 {
    
  •     var readSize uint64
    
  •     if 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.

@pdevine

pdevine commented Jul 2, 2018

Copy link
Copy Markdown

Is Speedy even supported anymore? The project seems abandoned.

@dmp42

dmp42 commented Aug 20, 2018

Copy link
Copy Markdown
Contributor

The Speedy project has not been updated in 3 years.
Comments from @noxiouz here haven't been addressed.

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.

@dmp42 dmp42 closed this Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants