-
Notifications
You must be signed in to change notification settings - Fork 137
[WIP] Initial Commit of Graph API #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@dave-tucker you can rebase cause I merged #32 |
Fixes docker#4 Signed-off-by: Dave Tucker <[email protected]>
|
@runcom 😎 |
|
Might be nice to have an implementation that just takes a graphdriver Init function and automatically maps the resulting graphdriver to the handler functions rather than everyone writing the same code. NewHandler(initFn graphdriver.InitFunc) *HandlerWDYT? |
|
@cpuguy83 not sure I understand your comment... typical usage would be: d := MyGraphDriver{}
h := graph.NewHandler(d)
h.ServeUnix("root", "mygraph")In this case, |
|
@dave-tucker This requires someone to write basiclaly a pass-through from the graphdriver itself to the plugin helper, whereas this code should be exactly the same for everyone. For instance, to test this out I started writing a shim like this: type driver struct {
vfs graphdriver.Driver
}
func (d *driver) Init(req *graph.InitRequest) error {
fs, err := vfs.Init(req.Home, req.Opts, nil, nil)
if err != nil {
return err
}
d.vfs = graphdriver.NewNaiveDiffDriver(fs, nil, nil)
return nil
}
func (d *driver) Create(req *graph.IDParentRequest) error {
return d.vfs.Create(req.ID, req.Parent, "")
}
func (d *driver) Remove(req *graph.OperationRequest) error {
return d.vfs.Remove(req.ID)
}
func (d *driver) Get(req *graph.GetRequest) (*graph.GetResponse, error) {
dir, err := d.vfs.Get(req.ID, req.MountLabel)
return &graph.GetResponse{Dir: dir}, err
}But I think we can make it so people don't even have to write the shim. |
|
@cpuguy83 ah i see! you're talking about existing, in-tree graphdrivers right? |
|
@dave-tucker That's the example yes, but this would mean people can write a graphdriver as if they are in-tree, and not care about the plugin API layer. |
|
@cpuguy83 got it. will try to find some time to hack on it within the next week or so |
|
I have started working on the pass-through graph drivers (mentioning it to avoid duplicated efforts) |
|
(I'll also rebase this PR) |
|
@samoht awesome! |
Thanks to @dave-tucker for the original version of this patch (see. docker#33). I've changed the interface slightly to simplify the creation of new plugins and I've added some tests, inspired from the volume helpers. Signed-off-by: Thomas Gazagnaire <[email protected]>
Thanks to @dave-tucker for the original version of this patch (see. docker#33). I've changed the interface slightly to simplify the creation of new plugins and I've added some tests, inspired from the volume helpers. Signed-off-by: Thomas Gazagnaire <[email protected]>
Thanks to @dave-tucker for the original version of this patch (see. docker#33). I've changed the interface slightly to simplify the creation of new plugins and I've added some tests, inspired from the volume helpers. Signed-off-by: Thomas Gazagnaire <[email protected]>
|
Closing in favor of #42 |
Fixes #4
Signed-off-by: Dave Tucker [email protected]