func (afb *AioFileBackend) HasFlush(ctx context.Context) bool {
	return false
}
Size implements Backend.HasFua
package nbd
import (
	"github.com/traetox/goaio"
	"golang.org/x/net/context"
	"os"
)
type AioFileBackend struct {
	aio  *goaio.AIO
	size uint64
}
func (afb *AioFileBackend) WriteAt(ctx context.Context, b []byte, offset int64, fua bool) (int, error) {
	if err := afb.aio.Wait(); err != nil {
		return 0, err
	}
	requestId, err := afb.aio.WriteAt(b, offset)
	if err != nil {
		return 0, err
	}
	n, err := afb.aio.WaitFor(requestId)
	if err != nil {
		return 0, err
	}
	if fua {
		if err := afb.aio.Flush(); err != nil {
			return 0, err
		}
	}
	return n, err
}
func (afb *AioFileBackend) ReadAt(ctx context.Context, b []byte, offset int64) (int, error) {
	if err := afb.aio.Wait(); err != nil {
		return 0, err
	}
	requestId, err := afb.aio.ReadAt(b, offset)
	if err != nil {
		return 0, err
	}
	n, err := afb.aio.WaitFor(requestId)
	if err != nil {
		return 0, err
	}
	return n, err
}
func (afb *AioFileBackend) TrimAt(ctx context.Context, length int, offset int64) (int, error) {
	return length, nil
}
func (afb *AioFileBackend) Flush(ctx context.Context) error {
	return afb.aio.Flush()
}
func (afb *AioFileBackend) Close(ctx context.Context) error {
	return afb.aio.Close()
}
func (afb *AioFileBackend) Geometry(ctx context.Context) (uint64, uint64, uint64, uint64, error) {
	return afb.size, 1, 32 * 1024, 128 * 1024 * 1024, nil
}
func (afb *AioFileBackend) HasFua(ctx context.Context) bool {
	return false
}