Displaying 2 results from an estimated 2 matches for "pluginconnectioninterface".
2020 Apr 21
0
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...fake C "pointers"
So it would look like this:
// The plugin interface.
type PluginInterface interface {
// Open, GetSize and PRead are required for all plugins.
// Other methods are optional.
Config(key string, value string) error
ConfigComplete() error
Open(readonly bool) (PluginConnectionInterface, error)
}
type PluginConnectionInterface interface {
// Open, GetSize and PRead are required for all plugins.
// Other methods are optional.
Close()
GetSize() (uint64, error)
PRead(buf []byte, offset uint64, flags uint32) error
}
Now, we need todo some mapping
var connectionID ui...
2020 Apr 21
2
[PATCH nbdkit v2] Add the ability to write plugins in golang.
Thanks: Dan Berrangé
XXX UNFINISHED:
- Is using uintptr for the handle a good idea? Plugins must return
something != 0. In other languages we would allow plugins to
return an arbitrary object here, but this is not possible in golang
because of lack of GC roots.
- Default can_* methods are hard to implement. Ideally we would be
able to test if a user plugin implements a