search for: configcomplet

Displaying 4 results from an estimated 4 matches for "configcomplet".

Did you mean: configcomplete
2020 Apr 24
1
[PATCH nbdkit] golang: Pass Plugin and Connection by reference not value.
...value string) error { + if key == "size" { + var err error + size, err = strconv.ParseUint(value, 0, 64) + if err != nil { + return err + } + size_set = true + return nil + } else { + return nbdkit.PluginError{Errmsg: "unknown parameter"} + } +} + +func (p *DiskPlugin) ConfigComplete() error { + if !size_set { + return nbdkit.PluginError{Errmsg: "size parameter is required"} + } + return nil +} + +func (p *DiskPlugin) Open(readonly bool) (nbdkit.ConnectionInterface, error) { + // Open a temporary file. + fd, err := ioutil.TempFile("/var/tmp", "nbdkitd...
2020 Apr 21
0
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...ep a global variable mapping the GO objects to 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...
2020 Apr 21
2
[PATCH nbdkit v2] Add the ability to write plugins in golang.
...o %d)", e.Errmsg, e.Errno) + } +} + +func (e PluginError) Error() string { + return e.String() +} + +// 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) (uintptr, error) + Close(handle uintptr) + GetSize(handle uintptr) (uint64, error) + PRead(handle uintptr, buf []byte, offset uint64, + flags uint32) error +} + +// Default implementations for plugin interface methods. +type Plugin struct{} + +func (p Plugin) Config(...
2020 Apr 23
2
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...o %d)", e.Errmsg, e.Errno) + } +} + +func (e PluginError) Error() string { + return e.String() +} + +// The plugin interface. +type PluginInterface interface { + // Open is required for all plugins. + // Other methods are optional. + Load() + Unload() + Config(key string, value string) error + ConfigComplete() error + Open(readonly bool) (ConnectionInterface, error) +} + +// The client connection interface. +type ConnectionInterface interface { + // GetSize and PRead are required for all plugins. + // Other methods are optional. + Close() + GetSize() (uint64, error) + PRead(buf []byte, offset uint64,...