Displaying 1 result from an estimated 1 matches for "canmulticonn".
Did you mean:
can_multi_conn
2020 Apr 24
1
[PATCH nbdkit] golang: Pass Plugin and Connection by reference not value.
...We could just return the
+ // global "size" here, but make the example more interesting.
+ info, err := c.fd.Stat()
+ if err != nil {
+ return 0, err
+ }
+ return uint64(info.Size()), nil
+}
+
+// Multi-conn is NOT safe because each client sees a different disk.
+func (c *DiskConnection) CanMultiConn() (bool, error) {
+ return false, nil
+}
+
+func (c *DiskConnection) PRead(buf []byte, offset uint64,
+ flags uint32) error {
+ n, err := c.fd.ReadAt(buf, int64(offset))
+ if err != nil {
+ return err
+ }
+ // NBD requests must always read/write the whole requested
+ // amount, or else fail. Actu...