Displaying 2 results from an estimated 2 matches for "nextconnectionid".
2020 Apr 23
2
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...) GetSize() (uint64, error) {
+ panic("plugin must implement GetSize()")
+}
+
+func (c Connection) PRead(buf []byte, offset uint64, flags uint32) error {
+ panic("plugin must implement PRead()")
+}
+
+// The implementation of the user plugin.
+var pluginImpl PluginInterface
+var nextConnectionId uintptr
+var connectionMap map[uintptr]ConnectionInterface
+
+// Callbacks from the server. These translate C to Go and back.
+
+func set_error(err error) {
+ perr, ok := err.(PluginError)
+ if ok {
+ if perr.Errno != 0 {
+ SetError(perr.Errno)
+ }
+ Error(perr.Errmsg)
+ } else {
+ Error(err...
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