-
Notifications
You must be signed in to change notification settings - Fork 879
Adds prototype NG driver apis #630
Adds prototype NG driver apis #630
Conversation
Storage driver API is declared in driver/driver.go Out-of-process drivers can be launched with driver/ipc/client.go An example can be found at main/driverclient/driverclient.go
Also adds basic filesystem driver implementation
Also fixed up some formatting and import paths
Ping @wking @bacongobbler @noxiouz |
On Fri, Oct 10, 2014 at 04:41:18PM -0700, Brian Bland wrote:
I'm not up on Go / libchan, so I'm not sure how this is going to scale I'm also missing my independent configs for atomic and streaming On the content-addressable side, it might be easier to have middleware |
return nil, err | ||
} | ||
|
||
var response map[string]interface{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose, receiver.Receive supports unpacking into an anonymous struct. It should help to get rid of type conversions.
It looks like:
var response struct {
Contents []byte
Error string
}
err = receiver.Receive(&response)
if err != nil {
return nil, err
}
if p.Error != "" {
err = errors.New(p.Error)
// err = fmt.Errorf("blabla error %s", p.Error)
}
return p.Contents, err
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I could create a request and response object for each method to do the most compile-time checking.
It's a common practice in golang. Each goroutine needs ~4KB. Of course, golang has |
This could be especially valuable in the case of multiple registries pointing at the same storage backend for HA purposes. We can write the layer to Update: it looks like "move" operations in many (most?) storage systems aside from local filesystems involve full copies followed by deletion of the original file, so this might be a huge performance hit. |
I'm not yet committed to either approach, but if we decide to make these two interfaces, the IPC client Start() method can ask the driver what interface it is implementing and then return the appropriate wrapper. |
return fmt.Sprintf("images/%s/manifest.json", imageId) | ||
} | ||
|
||
func ImagePrivatePath(imageId string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should disappear entirely. Authorization is not up to the registry to decide, nor the driver.
Instead of creating a new send channel for each request, a single send channel can be created for sending all requests. A new goroutine can still be spawned for each decoded request. Since all channels in libchan are nested, the return channels are still unique even though they were sent through the same channel. This will save a round trip to establish the new channel, but that is likely not as important in the unix socket case. |
"io" | ||
) | ||
|
||
type Driver interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Driver
seems too generic. How about FileStore
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Driver
is probably needlessly generic. I'm open to naming suggestions.
Also converts testing to using gocheck Asserts
Required for resumable download functionality
Also adds tests for Move and List
var response PutContentResponse | ||
err = receiver.Receive(&response) | ||
if err != nil { | ||
panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need panic
or it's ok to return error
@BrianBland I sent your PR into next-generation branch. Should I have sent PR here instead of your fork? |
Thanks @noxiouz |
Includes an IPC system for out-of-process drivers so users won't have to recompile the registry to bring their own drivers. Also, drivers can potentially be written in any language with a functioning libchan implementation.