Documentation ¶
Index ¶
- Constants
- type AioBlockStatus64Optargs
- type AioBlockStatusFilterOptargs
- type AioBlockStatusOptargs
- type AioBuffer
- type AioCacheOptargs
- type AioDisconnectOptargs
- type AioFlushOptargs
- type AioOptExtendedHeadersOptargs
- type AioOptGoOptargs
- type AioOptInfoOptargs
- type AioOptListMetaContextOptargs
- type AioOptListMetaContextQueriesOptargs
- type AioOptListOptargs
- type AioOptSetMetaContextOptargs
- type AioOptSetMetaContextQueriesOptargs
- type AioOptStarttlsOptargs
- type AioOptStructuredReplyOptargs
- type AioPreadOptargs
- type AioPreadStructuredOptargs
- type AioPwriteOptargs
- type AioTrimOptargs
- type AioZeroOptargs
- type AllowTransport
- type BlockStatus64Optargs
- type BlockStatusFilterOptargs
- type BlockStatusOptargs
- type CacheOptargs
- type ChunkCallback
- type CmdFlag
- type CompletionCallback
- type ContextCallback
- type DebugCallback
- type Extent64Callback
- type ExtentCallback
- type FlushOptargs
- type HandshakeFlag
- type Libnbd
- func (h *Libnbd) AddMetaContext(name string) error
- func (h *Libnbd) AioBlockStatus(count uint64, offset uint64, extent ExtentCallback, ...) (uint64, error)
- func (h *Libnbd) AioBlockStatus64(count uint64, offset uint64, extent64 Extent64Callback, ...) (uint64, error)
- func (h *Libnbd) AioBlockStatusFilter(count uint64, offset uint64, contexts []string, extent64 Extent64Callback, ...) (uint64, error)
- func (h *Libnbd) AioCache(count uint64, offset uint64, optargs *AioCacheOptargs) (uint64, error)
- func (h *Libnbd) AioCommandCompleted(cookie uint64) (bool, error)
- func (h *Libnbd) AioConnect(addr string) error
- func (h *Libnbd) AioConnectCommand(argv []string) error
- func (h *Libnbd) AioConnectSocket(sock int) error
- func (h *Libnbd) AioConnectSystemdSocketActivation(argv []string) error
- func (h *Libnbd) AioConnectTcp(hostname string, port string) error
- func (h *Libnbd) AioConnectUnix(unixsocket string) error
- func (h *Libnbd) AioConnectUri(uri string) error
- func (h *Libnbd) AioConnectVsock(cid uint32, port uint32) error
- func (h *Libnbd) AioDisconnect(optargs *AioDisconnectOptargs) error
- func (h *Libnbd) AioFlush(optargs *AioFlushOptargs) (uint64, error)
- func (h *Libnbd) AioGetDirection() (uint, error)
- func (h *Libnbd) AioGetFd() (int, error)
- func (h *Libnbd) AioInFlight() (uint, error)
- func (h *Libnbd) AioIsClosed() (bool, error)
- func (h *Libnbd) AioIsConnecting() (bool, error)
- func (h *Libnbd) AioIsCreated() (bool, error)
- func (h *Libnbd) AioIsDead() (bool, error)
- func (h *Libnbd) AioIsNegotiating() (bool, error)
- func (h *Libnbd) AioIsProcessing() (bool, error)
- func (h *Libnbd) AioIsReady() (bool, error)
- func (h *Libnbd) AioNotifyRead() error
- func (h *Libnbd) AioNotifyWrite() error
- func (h *Libnbd) AioOptAbort() error
- func (h *Libnbd) AioOptExtendedHeaders(optargs *AioOptExtendedHeadersOptargs) error
- func (h *Libnbd) AioOptGo(optargs *AioOptGoOptargs) error
- func (h *Libnbd) AioOptInfo(optargs *AioOptInfoOptargs) error
- func (h *Libnbd) AioOptList(list ListCallback, optargs *AioOptListOptargs) error
- func (h *Libnbd) AioOptListMetaContext(context ContextCallback, optargs *AioOptListMetaContextOptargs) (uint, error)
- func (h *Libnbd) AioOptListMetaContextQueries(queries []string, context ContextCallback, ...) (uint, error)
- func (h *Libnbd) AioOptSetMetaContext(context ContextCallback, optargs *AioOptSetMetaContextOptargs) (uint, error)
- func (h *Libnbd) AioOptSetMetaContextQueries(queries []string, context ContextCallback, ...) (uint, error)
- func (h *Libnbd) AioOptStarttls(optargs *AioOptStarttlsOptargs) error
- func (h *Libnbd) AioOptStructuredReply(optargs *AioOptStructuredReplyOptargs) error
- func (h *Libnbd) AioPeekCommandCompleted() (uint64, error)
- func (h *Libnbd) AioPread(buf AioBuffer, offset uint64, optargs *AioPreadOptargs) (uint64, error)
- func (h *Libnbd) AioPreadStructured(buf AioBuffer, offset uint64, chunk ChunkCallback, ...) (uint64, error)
- func (h *Libnbd) AioPwrite(buf AioBuffer, offset uint64, optargs *AioPwriteOptargs) (uint64, error)
- func (h *Libnbd) AioTrim(count uint64, offset uint64, optargs *AioTrimOptargs) (uint64, error)
- func (h *Libnbd) AioZero(count uint64, offset uint64, optargs *AioZeroOptargs) (uint64, error)
- func (h *Libnbd) BlockStatus(count uint64, offset uint64, extent ExtentCallback, ...) error
- func (h *Libnbd) BlockStatus64(count uint64, offset uint64, extent64 Extent64Callback, ...) error
- func (h *Libnbd) BlockStatusFilter(count uint64, offset uint64, contexts []string, extent64 Extent64Callback, ...) error
- func (h *Libnbd) Cache(count uint64, offset uint64, optargs *CacheOptargs) error
- func (h *Libnbd) CanBlockStatusPayload() (bool, error)
- func (h *Libnbd) CanCache() (bool, error)
- func (h *Libnbd) CanDf() (bool, error)
- func (h *Libnbd) CanFastZero() (bool, error)
- func (h *Libnbd) CanFlush() (bool, error)
- func (h *Libnbd) CanFua() (bool, error)
- func (h *Libnbd) CanMetaContext(metacontext string) (bool, error)
- func (h *Libnbd) CanMultiConn() (bool, error)
- func (h *Libnbd) CanTrim() (bool, error)
- func (h *Libnbd) CanZero() (bool, error)
- func (h *Libnbd) ClearDebugCallback() error
- func (h *Libnbd) ClearMetaContexts() error
- func (h *Libnbd) Close() *LibnbdError
- func (h *Libnbd) ConnectCommand(argv []string) error
- func (h *Libnbd) ConnectSocket(sock int) error
- func (h *Libnbd) ConnectSystemdSocketActivation(argv []string) error
- func (h *Libnbd) ConnectTcp(hostname string, port string) error
- func (h *Libnbd) ConnectUnix(unixsocket string) error
- func (h *Libnbd) ConnectUri(uri string) error
- func (h *Libnbd) ConnectVsock(cid uint32, port uint32) error
- func (h *Libnbd) ConnectionState() (*string, error)
- func (h *Libnbd) Flush(optargs *FlushOptargs) error
- func (h *Libnbd) GetBlockSize(size_type Size) (uint64, error)
- func (h *Libnbd) GetCanonicalExportName() (*string, error)
- func (h *Libnbd) GetDebug() (bool, error)
- func (h *Libnbd) GetExportDescription() (*string, error)
- func (h *Libnbd) GetExportName() (*string, error)
- func (h *Libnbd) GetExtendedHeadersNegotiated() (bool, error)
- func (h *Libnbd) GetFullInfo() (bool, error)
- func (h *Libnbd) GetHandleName() (*string, error)
- func (h *Libnbd) GetHandshakeFlags() (HandshakeFlag, error)
- func (h *Libnbd) GetMetaContext(i int) (*string, error)
- func (h *Libnbd) GetNrMetaContexts() (uint, error)
- func (h *Libnbd) GetOptMode() (bool, error)
- func (h *Libnbd) GetPackageName() (*string, error)
- func (h *Libnbd) GetPreadInitialize() (bool, error)
- func (h *Libnbd) GetPrivateData() (uint, error)
- func (h *Libnbd) GetProtocol() (*string, error)
- func (h *Libnbd) GetRequestBlockSize() (bool, error)
- func (h *Libnbd) GetRequestExtendedHeaders() (bool, error)
- func (h *Libnbd) GetRequestMetaContext() (bool, error)
- func (h *Libnbd) GetRequestStructuredReplies() (bool, error)
- func (h *Libnbd) GetSize() (uint64, error)
- func (h *Libnbd) GetSocketActivationName() (*string, error)
- func (h *Libnbd) GetStrictMode() (Strict, error)
- func (h *Libnbd) GetStructuredRepliesNegotiated() (bool, error)
- func (h *Libnbd) GetTls() (Tls, error)
- func (h *Libnbd) GetTlsNegotiated() (bool, error)
- func (h *Libnbd) GetTlsUsername() (*string, error)
- func (h *Libnbd) GetTlsVerifyPeer() (bool, error)
- func (h *Libnbd) GetUri() (*string, error)
- func (h *Libnbd) GetVersion() (*string, error)
- func (h *Libnbd) IsReadOnly() (bool, error)
- func (h *Libnbd) IsRotational() (bool, error)
- func (h *Libnbd) KillSubprocess(signum int) error
- func (h *Libnbd) OptAbort() error
- func (h *Libnbd) OptExtendedHeaders() (bool, error)
- func (h *Libnbd) OptGo() error
- func (h *Libnbd) OptInfo() error
- func (h *Libnbd) OptList(list ListCallback) (uint, error)
- func (h *Libnbd) OptListMetaContext(context ContextCallback) (uint, error)
- func (h *Libnbd) OptListMetaContextQueries(queries []string, context ContextCallback) (uint, error)
- func (h *Libnbd) OptSetMetaContext(context ContextCallback) (uint, error)
- func (h *Libnbd) OptSetMetaContextQueries(queries []string, context ContextCallback) (uint, error)
- func (h *Libnbd) OptStarttls() (bool, error)
- func (h *Libnbd) OptStructuredReply() (bool, error)
- func (h *Libnbd) Poll(timeout int) (uint, error)
- func (h *Libnbd) Poll2(fd int, timeout int) (uint, error)
- func (h *Libnbd) Pread(buf []byte, offset uint64, optargs *PreadOptargs) error
- func (h *Libnbd) PreadStructured(buf []byte, offset uint64, chunk ChunkCallback, ...) error
- func (h *Libnbd) Pwrite(buf []byte, offset uint64, optargs *PwriteOptargs) error
- func (h *Libnbd) SetDebug(debug bool) error
- func (h *Libnbd) SetDebugCallback(debug DebugCallback) error
- func (h *Libnbd) SetExportName(export_name string) error
- func (h *Libnbd) SetFullInfo(request bool) error
- func (h *Libnbd) SetHandleName(handle_name string) error
- func (h *Libnbd) SetHandshakeFlags(flags HandshakeFlag) error
- func (h *Libnbd) SetOptMode(enable bool) error
- func (h *Libnbd) SetPreadInitialize(request bool) error
- func (h *Libnbd) SetPrivateData(private_data uint) (uint, error)
- func (h *Libnbd) SetRequestBlockSize(request bool) error
- func (h *Libnbd) SetRequestExtendedHeaders(request bool) error
- func (h *Libnbd) SetRequestMetaContext(request bool) error
- func (h *Libnbd) SetRequestStructuredReplies(request bool) error
- func (h *Libnbd) SetSocketActivationName(socket_name string) error
- func (h *Libnbd) SetStrictMode(flags Strict) error
- func (h *Libnbd) SetTls(tls Tls) error
- func (h *Libnbd) SetTlsCertificates(dir string) error
- func (h *Libnbd) SetTlsPskFile(filename string) error
- func (h *Libnbd) SetTlsUsername(username string) error
- func (h *Libnbd) SetTlsVerifyPeer(verify bool) error
- func (h *Libnbd) SetUriAllowLocalFile(allow bool) error
- func (h *Libnbd) SetUriAllowTls(tls Tls) error
- func (h *Libnbd) SetUriAllowTransports(mask AllowTransport) error
- func (h *Libnbd) Shutdown(optargs *ShutdownOptargs) error
- func (h *Libnbd) StatsBytesReceived() (uint64, error)
- func (h *Libnbd) StatsBytesSent() (uint64, error)
- func (h *Libnbd) StatsChunksReceived() (uint64, error)
- func (h *Libnbd) StatsChunksSent() (uint64, error)
- func (h *Libnbd) String() string
- func (h *Libnbd) SupportsTls() (bool, error)
- func (h *Libnbd) SupportsUri() (bool, error)
- func (h *Libnbd) SupportsVsock() (bool, error)
- func (h *Libnbd) Trim(count uint64, offset uint64, optargs *TrimOptargs) error
- func (h *Libnbd) Zero(count uint64, offset uint64, optargs *ZeroOptargs) error
- type LibnbdError
- type LibnbdExtent
- type ListCallback
- type PreadOptargs
- type PreadStructuredOptargs
- type PwriteOptargs
- type Shutdown
- type ShutdownOptargs
- type Size
- type Strict
- type Tls
- type TrimOptargs
- type ZeroOptargs
Constants ¶
const ( SIZE_MINIMUM = Size(0) SIZE_PREFERRED = Size(1) SIZE_MAXIMUM = Size(2) SIZE_PAYLOAD = Size(3) )
const ( CMD_FLAG_FUA = CmdFlag(0x01) CMD_FLAG_NO_HOLE = CmdFlag(0x02) CMD_FLAG_DF = CmdFlag(0x04) CMD_FLAG_REQ_ONE = CmdFlag(0x08) CMD_FLAG_FAST_ZERO = CmdFlag(0x10) CMD_FLAG_PAYLOAD_LEN = CmdFlag(0x20) CMD_FLAG_MASK = CmdFlag(0x3f) )
const ( HANDSHAKE_FLAG_FIXED_NEWSTYLE = HandshakeFlag(0x01) HANDSHAKE_FLAG_NO_ZEROES = HandshakeFlag(0x02) HANDSHAKE_FLAG_MASK = HandshakeFlag(0x03) )
const ( STRICT_COMMANDS = Strict(0x01) STRICT_FLAGS = Strict(0x02) STRICT_BOUNDS = Strict(0x04) STRICT_ZERO_SIZE = Strict(0x08) STRICT_ALIGN = Strict(0x10) STRICT_PAYLOAD = Strict(0x20) STRICT_AUTO_FLAG = Strict(0x40) STRICT_MASK = Strict(0x7f) )
const ( ALLOW_TRANSPORT_TCP = AllowTransport(0x01) ALLOW_TRANSPORT_UNIX = AllowTransport(0x02) ALLOW_TRANSPORT_VSOCK = AllowTransport(0x04) ALLOW_TRANSPORT_MASK = AllowTransport(0x07) )
const ( SHUTDOWN_ABANDON_PENDING = Shutdown(0x10000) SHUTDOWN_MASK = Shutdown(0x10000) )
const ( AIO_DIRECTION_READ uint32 = 1 AIO_DIRECTION_WRITE uint32 = 2 AIO_DIRECTION_BOTH uint32 = 3 READ_DATA uint32 = 1 READ_HOLE uint32 = 2 READ_ERROR uint32 = 3 /* Meta-context namespace "base" */ NAMESPACE_BASE = "base:" CONTEXT_BASE_ALLOCATION = "base:allocation" /* Defined bits in "base:allocation" */ STATE_HOLE uint32 = 1 STATE_ZERO uint32 = 2 /* Meta-context namespace "qemu" */ NAMESPACE_QEMU = "qemu:" CONTEXT_QEMU_DIRTY_BITMAP = "qemu:dirty-bitmap:" /* Defined bits in "qemu:dirty-bitmap:" */ STATE_DIRTY uint32 = 1 CONTEXT_QEMU_ALLOCATION_DEPTH = "qemu:allocation-depth" )
Constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AioBlockStatus64Optargs ¶ added in v1.18.0
type AioBlockStatus64Optargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioBlockStatus64.
type AioBlockStatusFilterOptargs ¶ added in v1.18.0
type AioBlockStatusFilterOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioBlockStatusFilter.
type AioBlockStatusOptargs ¶
type AioBlockStatusOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioBlockStatus.
type AioBuffer ¶
Asynchronous I/O buffer.
func FromBytes ¶
FromBytes makes a new buffer backed by a C allocated array, initialized by copying the given Go slice.
func MakeAioBuffer ¶
MakeAioBuffer makes a new buffer backed by an uninitialized C allocated array.
func MakeAioBufferZero ¶ added in v1.12.0
MakeAioBuffer makes a new buffer backed by a C allocated array. The underlying buffer is set to zero.
func (*AioBuffer) Bytes ¶
Bytes copies the underlying C array to Go allocated memory and return a slice. Modifying the returned slice does not modify the underlying buffer backing array.
func (*AioBuffer) Free ¶
func (b *AioBuffer) Free()
Free deallocates the underlying C allocated array. Using the buffer after Free() will panic.
func (*AioBuffer) Get ¶
Get returns a pointer to a byte in the underlying C array. The pointer can be used to modify the underlying array. The pointer must not be used after calling Free().
type AioCacheOptargs ¶
type AioCacheOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioCache.
type AioDisconnectOptargs ¶
type AioDisconnectOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioDisconnect.
type AioFlushOptargs ¶
type AioFlushOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioFlush.
type AioOptExtendedHeadersOptargs ¶ added in v1.18.0
type AioOptExtendedHeadersOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptExtendedHeaders.
type AioOptGoOptargs ¶
type AioOptGoOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptGo.
type AioOptInfoOptargs ¶
type AioOptInfoOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptInfo.
type AioOptListMetaContextOptargs ¶
type AioOptListMetaContextOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptListMetaContext.
type AioOptListMetaContextQueriesOptargs ¶ added in v1.18.0
type AioOptListMetaContextQueriesOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptListMetaContextQueries.
type AioOptListOptargs ¶
type AioOptListOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptList.
type AioOptSetMetaContextOptargs ¶ added in v1.18.0
type AioOptSetMetaContextOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptSetMetaContext.
type AioOptSetMetaContextQueriesOptargs ¶ added in v1.18.0
type AioOptSetMetaContextQueriesOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptSetMetaContextQueries.
type AioOptStarttlsOptargs ¶ added in v1.18.0
type AioOptStarttlsOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptStarttls.
type AioOptStructuredReplyOptargs ¶ added in v1.18.0
type AioOptStructuredReplyOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback }
Struct carrying optional arguments for AioOptStructuredReply.
type AioPreadOptargs ¶
type AioPreadOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioPread.
type AioPreadStructuredOptargs ¶
type AioPreadStructuredOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioPreadStructured.
type AioPwriteOptargs ¶
type AioPwriteOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioPwrite.
type AioTrimOptargs ¶
type AioTrimOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioTrim.
type AioZeroOptargs ¶
type AioZeroOptargs struct { /* CompletionCallback field is ignored unless CompletionCallbackSet == true. */ CompletionCallbackSet bool CompletionCallback CompletionCallback /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for AioZero.
type BlockStatus64Optargs ¶ added in v1.18.0
type BlockStatus64Optargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for BlockStatus64.
type BlockStatusFilterOptargs ¶ added in v1.18.0
type BlockStatusFilterOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for BlockStatusFilter.
type BlockStatusOptargs ¶
type BlockStatusOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for BlockStatus.
type CacheOptargs ¶
type CacheOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for Cache.
type ChunkCallback ¶
type Extent64Callback ¶ added in v1.18.0
type Extent64Callback func(metacontext string, offset uint64, entries []LibnbdExtent, error *int) int
type ExtentCallback ¶
type FlushOptargs ¶
type FlushOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for Flush.
type Libnbd ¶
type Libnbd struct {
// contains filtered or unexported fields
}
Handle.
func (*Libnbd) AddMetaContext ¶
AddMetaContext: ask server to negotiate metadata context
func (*Libnbd) AioBlockStatus ¶
func (h *Libnbd) AioBlockStatus(count uint64, offset uint64, extent ExtentCallback, optargs *AioBlockStatusOptargs) (uint64, error)
AioBlockStatus: send block status command, with 32-bit callback
func (*Libnbd) AioBlockStatus64 ¶ added in v1.18.0
func (h *Libnbd) AioBlockStatus64(count uint64, offset uint64, extent64 Extent64Callback, optargs *AioBlockStatus64Optargs) (uint64, error)
AioBlockStatus64: send block status command, with 64-bit callback
func (*Libnbd) AioBlockStatusFilter ¶ added in v1.18.0
func (h *Libnbd) AioBlockStatusFilter(count uint64, offset uint64, contexts []string, extent64 Extent64Callback, optargs *AioBlockStatusFilterOptargs) (uint64, error)
AioBlockStatusFilter: send filtered block status command to the NBD server
func (*Libnbd) AioCache ¶
AioCache: send cache (prefetch) command to the NBD server
func (*Libnbd) AioCommandCompleted ¶
AioCommandCompleted: check if the command completed
func (*Libnbd) AioConnect ¶
AioConnect: connect to the NBD server
func (*Libnbd) AioConnectCommand ¶
AioConnectCommand: connect to the NBD server
func (*Libnbd) AioConnectSocket ¶
AioConnectSocket: connect directly to a connected socket
func (*Libnbd) AioConnectSystemdSocketActivation ¶
AioConnectSystemdSocketActivation: connect using systemd socket activation
func (*Libnbd) AioConnectTcp ¶
AioConnectTcp: connect to the NBD server over a TCP port
func (*Libnbd) AioConnectUnix ¶
AioConnectUnix: connect to the NBD server over a Unix domain socket
func (*Libnbd) AioConnectUri ¶
AioConnectUri: connect to an NBD URI
func (*Libnbd) AioConnectVsock ¶
AioConnectVsock: connect to the NBD server over AF_VSOCK socket
func (*Libnbd) AioDisconnect ¶
func (h *Libnbd) AioDisconnect(optargs *AioDisconnectOptargs) error
AioDisconnect: disconnect from the NBD server
func (*Libnbd) AioFlush ¶
func (h *Libnbd) AioFlush(optargs *AioFlushOptargs) (uint64, error)
AioFlush: send flush command to the NBD server
func (*Libnbd) AioGetDirection ¶
AioGetDirection: return the read or write direction
func (*Libnbd) AioGetFd ¶
AioGetFd: return file descriptor associated with this connection
func (*Libnbd) AioInFlight ¶
AioInFlight: check how many aio commands are still in flight
func (*Libnbd) AioIsClosed ¶
AioIsClosed: check if the connection is closed
func (*Libnbd) AioIsConnecting ¶
AioIsConnecting: check if the connection is connecting or handshaking
func (*Libnbd) AioIsCreated ¶
AioIsCreated: check if the connection has just been created
func (*Libnbd) AioIsDead ¶
AioIsDead: check if the connection is dead
func (*Libnbd) AioIsNegotiating ¶
AioIsNegotiating: check if connection is ready to send handshake option
func (*Libnbd) AioIsProcessing ¶
AioIsProcessing: check if the connection is processing a command
func (*Libnbd) AioIsReady ¶
AioIsReady: check if the connection is in the ready state
func (*Libnbd) AioNotifyRead ¶
AioNotifyRead: notify that the connection is readable
func (*Libnbd) AioNotifyWrite ¶
AioNotifyWrite: notify that the connection is writable
func (*Libnbd) AioOptAbort ¶
AioOptAbort: end negotiation and close the connection
func (*Libnbd) AioOptExtendedHeaders ¶ added in v1.18.0
func (h *Libnbd) AioOptExtendedHeaders(optargs *AioOptExtendedHeadersOptargs) error
AioOptExtendedHeaders: request the server to enable extended headers
func (*Libnbd) AioOptGo ¶
func (h *Libnbd) AioOptGo(optargs *AioOptGoOptargs) error
AioOptGo: end negotiation and move on to using an export
func (*Libnbd) AioOptInfo ¶
func (h *Libnbd) AioOptInfo(optargs *AioOptInfoOptargs) error
AioOptInfo: request the server for information about an export
func (*Libnbd) AioOptList ¶
func (h *Libnbd) AioOptList(list ListCallback, optargs *AioOptListOptargs) error
AioOptList: request the server to list all exports during negotiation
func (*Libnbd) AioOptListMetaContext ¶
func (h *Libnbd) AioOptListMetaContext(context ContextCallback, optargs *AioOptListMetaContextOptargs) (uint, error)
AioOptListMetaContext: request list of available meta contexts, using implicit query
func (*Libnbd) AioOptListMetaContextQueries ¶ added in v1.18.0
func (h *Libnbd) AioOptListMetaContextQueries(queries []string, context ContextCallback, optargs *AioOptListMetaContextQueriesOptargs) (uint, error)
AioOptListMetaContextQueries: request list of available meta contexts, using explicit query
func (*Libnbd) AioOptSetMetaContext ¶ added in v1.18.0
func (h *Libnbd) AioOptSetMetaContext(context ContextCallback, optargs *AioOptSetMetaContextOptargs) (uint, error)
AioOptSetMetaContext: select specific meta contexts, with implicit query list
func (*Libnbd) AioOptSetMetaContextQueries ¶ added in v1.18.0
func (h *Libnbd) AioOptSetMetaContextQueries(queries []string, context ContextCallback, optargs *AioOptSetMetaContextQueriesOptargs) (uint, error)
AioOptSetMetaContextQueries: select specific meta contexts, with explicit query list
func (*Libnbd) AioOptStarttls ¶ added in v1.18.0
func (h *Libnbd) AioOptStarttls(optargs *AioOptStarttlsOptargs) error
AioOptStarttls: request the server to initiate TLS
func (*Libnbd) AioOptStructuredReply ¶ added in v1.18.0
func (h *Libnbd) AioOptStructuredReply(optargs *AioOptStructuredReplyOptargs) error
AioOptStructuredReply: request the server to enable structured replies
func (*Libnbd) AioPeekCommandCompleted ¶
AioPeekCommandCompleted: check if any command has completed
func (*Libnbd) AioPread ¶
AioPread: read from the NBD server
func (*Libnbd) AioPreadStructured ¶
func (h *Libnbd) AioPreadStructured(buf AioBuffer, offset uint64, chunk ChunkCallback, optargs *AioPreadStructuredOptargs) (uint64, error)
AioPreadStructured: read from the NBD server
func (*Libnbd) AioPwrite ¶
AioPwrite: write to the NBD server
func (*Libnbd) AioTrim ¶
AioTrim: send trim command to the NBD server
func (*Libnbd) AioZero ¶
AioZero: send write zeroes command to the NBD server
func (*Libnbd) BlockStatus ¶
func (h *Libnbd) BlockStatus(count uint64, offset uint64, extent ExtentCallback, optargs *BlockStatusOptargs) error
BlockStatus: send block status command, with 32-bit callback
func (*Libnbd) BlockStatus64 ¶ added in v1.18.0
func (h *Libnbd) BlockStatus64(count uint64, offset uint64, extent64 Extent64Callback, optargs *BlockStatus64Optargs) error
BlockStatus64: send block status command, with 64-bit callback
func (*Libnbd) BlockStatusFilter ¶ added in v1.18.0
func (h *Libnbd) BlockStatusFilter(count uint64, offset uint64, contexts []string, extent64 Extent64Callback, optargs *BlockStatusFilterOptargs) error
BlockStatusFilter: send filtered block status command, with 64-bit callback
func (*Libnbd) Cache ¶
func (h *Libnbd) Cache(count uint64, offset uint64, optargs *CacheOptargs) error
Cache: send cache (prefetch) command to the NBD server
func (*Libnbd) CanBlockStatusPayload ¶ added in v1.18.0
CanBlockStatusPayload: does the server support the block status payload flag?
func (*Libnbd) CanCache ¶
CanCache: does the server support the cache command?
func (*Libnbd) CanDf ¶
CanDf: does the server support the don't fragment flag to pread?
func (*Libnbd) CanFastZero ¶
CanFastZero: does the server support the fast zero flag?
func (*Libnbd) CanFlush ¶
CanFlush: does the server support the flush command?
func (*Libnbd) CanFua ¶
CanFua: does the server support the FUA flag?
func (*Libnbd) CanMetaContext ¶
CanMetaContext: does the server support a specific meta context?
func (*Libnbd) CanMultiConn ¶
CanMultiConn: does the server support multi-conn?
func (*Libnbd) CanTrim ¶
CanTrim: does the server support the trim command?
func (*Libnbd) CanZero ¶
CanZero: does the server support the zero command?
func (*Libnbd) ClearDebugCallback ¶
ClearDebugCallback: clear the debug callback
func (*Libnbd) ClearMetaContexts ¶
ClearMetaContexts: reset the list of requested meta contexts
func (*Libnbd) ConnectCommand ¶
ConnectCommand: connect to NBD server command
func (*Libnbd) ConnectSocket ¶
ConnectSocket: connect directly to a connected socket
func (*Libnbd) ConnectSystemdSocketActivation ¶
ConnectSystemdSocketActivation: connect using systemd socket activation
func (*Libnbd) ConnectTcp ¶
ConnectTcp: connect to NBD server over a TCP port
func (*Libnbd) ConnectUnix ¶
ConnectUnix: connect to NBD server over a Unix domain socket
func (*Libnbd) ConnectUri ¶
ConnectUri: connect to NBD URI
func (*Libnbd) ConnectVsock ¶
ConnectVsock: connect to NBD server over AF_VSOCK protocol
func (*Libnbd) ConnectionState ¶
ConnectionState: return string describing the state of the connection
func (*Libnbd) Flush ¶
func (h *Libnbd) Flush(optargs *FlushOptargs) error
Flush: send flush command to the NBD server
func (*Libnbd) GetBlockSize ¶
GetBlockSize: return a specific server block size constraint
func (*Libnbd) GetCanonicalExportName ¶
GetCanonicalExportName: return the canonical export name, if the server has one
func (*Libnbd) GetDebug ¶
GetDebug: return the state of the debug flag
func (*Libnbd) GetExportDescription ¶
GetExportDescription: return the export description, if the server has one
func (*Libnbd) GetExportName ¶
GetExportName: get the export name
func (*Libnbd) GetExtendedHeadersNegotiated ¶ added in v1.18.0
GetExtendedHeadersNegotiated: see if extended headers are in use
func (*Libnbd) GetFullInfo ¶
GetFullInfo: see if NBD_OPT_GO requests extra details
func (*Libnbd) GetHandleName ¶
GetHandleName: get the handle name
func (*Libnbd) GetHandshakeFlags ¶
func (h *Libnbd) GetHandshakeFlags() (HandshakeFlag, error)
GetHandshakeFlags: see which handshake flags are supported
func (*Libnbd) GetMetaContext ¶
GetMetaContext: return the i'th meta context request
func (*Libnbd) GetNrMetaContexts ¶
GetNrMetaContexts: return the current number of requested meta contexts
func (*Libnbd) GetOptMode ¶
GetOptMode: return whether option mode was enabled
func (*Libnbd) GetPackageName ¶
GetPackageName: return the name of the library
func (*Libnbd) GetPreadInitialize ¶ added in v1.12.0
GetPreadInitialize: see whether libnbd pre-initializes read buffers
func (*Libnbd) GetPrivateData ¶
GetPrivateData: get the per-handle private data
func (*Libnbd) GetProtocol ¶
GetProtocol: return the NBD protocol variant
func (*Libnbd) GetRequestBlockSize ¶ added in v1.12.0
GetRequestBlockSize: see if NBD_OPT_GO requests block size
func (*Libnbd) GetRequestExtendedHeaders ¶ added in v1.18.0
GetRequestExtendedHeaders: see if extended headers are attempted
func (*Libnbd) GetRequestMetaContext ¶ added in v1.18.0
GetRequestMetaContext: see if connect automatically requests meta contexts
func (*Libnbd) GetRequestStructuredReplies ¶
GetRequestStructuredReplies: see if structured replies are attempted
func (*Libnbd) GetSocketActivationName ¶ added in v1.18.0
GetSocketActivationName: get the socket activation name
func (*Libnbd) GetStrictMode ¶
GetStrictMode: see which strictness flags are in effect
func (*Libnbd) GetStructuredRepliesNegotiated ¶
GetStructuredRepliesNegotiated: see if structured replies are in use
func (*Libnbd) GetTlsNegotiated ¶
GetTlsNegotiated: find out if TLS was negotiated on a connection
func (*Libnbd) GetTlsUsername ¶
GetTlsUsername: get the current TLS username
func (*Libnbd) GetTlsVerifyPeer ¶
GetTlsVerifyPeer: get whether we verify the identity of the server
func (*Libnbd) GetUri ¶
GetUri: construct an NBD URI for a connection
func (*Libnbd) GetVersion ¶
GetVersion: return the version of the library
func (*Libnbd) IsReadOnly ¶
IsReadOnly: is the NBD export read-only?
func (*Libnbd) IsRotational ¶
IsRotational: is the NBD disk rotational (like a disk)?
func (*Libnbd) KillSubprocess ¶
KillSubprocess: kill server running as a subprocess
func (*Libnbd) OptAbort ¶
OptAbort: end negotiation and close the connection
func (*Libnbd) OptExtendedHeaders ¶ added in v1.18.0
OptExtendedHeaders: request the server to enable extended headers
func (*Libnbd) OptGo ¶
OptGo: end negotiation and move on to using an export
func (*Libnbd) OptInfo ¶
OptInfo: request the server for information about an export
func (*Libnbd) OptList ¶
func (h *Libnbd) OptList(list ListCallback) (uint, error)
OptList: request the server to list all exports during negotiation
func (*Libnbd) OptListMetaContext ¶
func (h *Libnbd) OptListMetaContext(context ContextCallback) (uint, error)
OptListMetaContext: list available meta contexts, using implicit query list
func (*Libnbd) OptListMetaContextQueries ¶ added in v1.18.0
func (h *Libnbd) OptListMetaContextQueries(queries []string, context ContextCallback) (uint, error)
OptListMetaContextQueries: list available meta contexts, using explicit query list
func (*Libnbd) OptSetMetaContext ¶ added in v1.18.0
func (h *Libnbd) OptSetMetaContext(context ContextCallback) (uint, error)
OptSetMetaContext: select specific meta contexts, using implicit query list
func (*Libnbd) OptSetMetaContextQueries ¶ added in v1.18.0
func (h *Libnbd) OptSetMetaContextQueries(queries []string, context ContextCallback) (uint, error)
OptSetMetaContextQueries: select specific meta contexts, using explicit query list
func (*Libnbd) OptStarttls ¶ added in v1.18.0
OptStarttls: request the server to initiate TLS
func (*Libnbd) OptStructuredReply ¶ added in v1.18.0
OptStructuredReply: request the server to enable structured replies
func (*Libnbd) Poll2 ¶ added in v1.18.0
Poll2: poll the handle once, with fd
func (*Libnbd) Pread ¶
func (h *Libnbd) Pread(buf []byte, offset uint64, optargs *PreadOptargs) error
Pread: read from the NBD server
func (*Libnbd) PreadStructured ¶
func (h *Libnbd) PreadStructured(buf []byte, offset uint64, chunk ChunkCallback, optargs *PreadStructuredOptargs) error
PreadStructured: read from the NBD server
func (*Libnbd) Pwrite ¶
func (h *Libnbd) Pwrite(buf []byte, offset uint64, optargs *PwriteOptargs) error
Pwrite: write to the NBD server
func (*Libnbd) SetDebug ¶
SetDebug: set or clear the debug flag
func (*Libnbd) SetDebugCallback ¶
func (h *Libnbd) SetDebugCallback(debug DebugCallback) error
SetDebugCallback: set the debug callback
func (*Libnbd) SetExportName ¶
SetExportName: set the export name
func (*Libnbd) SetFullInfo ¶
SetFullInfo: control whether NBD_OPT_GO requests extra details
func (*Libnbd) SetHandleName ¶
SetHandleName: set the handle name
func (*Libnbd) SetHandshakeFlags ¶
func (h *Libnbd) SetHandshakeFlags(flags HandshakeFlag) error
SetHandshakeFlags: control use of handshake flags
func (*Libnbd) SetOptMode ¶
SetOptMode: control option mode, for pausing during option negotiation
func (*Libnbd) SetPreadInitialize ¶ added in v1.12.0
SetPreadInitialize: control whether libnbd pre-initializes read buffers
func (*Libnbd) SetPrivateData ¶
SetPrivateData: set the per-handle private data
func (*Libnbd) SetRequestBlockSize ¶ added in v1.12.0
SetRequestBlockSize: control whether NBD_OPT_GO requests block size
func (*Libnbd) SetRequestExtendedHeaders ¶ added in v1.18.0
SetRequestExtendedHeaders: control use of extended headers
func (*Libnbd) SetRequestMetaContext ¶ added in v1.18.0
SetRequestMetaContext: control whether connect automatically requests meta contexts
func (*Libnbd) SetRequestStructuredReplies ¶
SetRequestStructuredReplies: control use of structured replies
func (*Libnbd) SetSocketActivationName ¶ added in v1.18.0
SetSocketActivationName: set the socket activation name
func (*Libnbd) SetStrictMode ¶
SetStrictMode: control how strictly to follow NBD protocol
func (*Libnbd) SetTls ¶
SetTls: enable or require TLS (authentication and encryption)
func (*Libnbd) SetTlsCertificates ¶
SetTlsCertificates: set the path to the TLS certificates directory
func (*Libnbd) SetTlsPskFile ¶
SetTlsPskFile: set the TLS Pre-Shared Keys (PSK) filename
func (*Libnbd) SetTlsUsername ¶
SetTlsUsername: set the TLS username
func (*Libnbd) SetTlsVerifyPeer ¶
SetTlsVerifyPeer: set whether we verify the identity of the server
func (*Libnbd) SetUriAllowLocalFile ¶
SetUriAllowLocalFile: set the allowed transports in NBD URIs
func (*Libnbd) SetUriAllowTls ¶
SetUriAllowTls: set the allowed TLS settings in NBD URIs
func (*Libnbd) SetUriAllowTransports ¶
func (h *Libnbd) SetUriAllowTransports(mask AllowTransport) error
SetUriAllowTransports: set the allowed transports in NBD URIs
func (*Libnbd) Shutdown ¶
func (h *Libnbd) Shutdown(optargs *ShutdownOptargs) error
Shutdown: disconnect from the NBD server
func (*Libnbd) StatsBytesReceived ¶ added in v1.18.0
StatsBytesReceived: statistics of bytes received over connection so far
func (*Libnbd) StatsBytesSent ¶ added in v1.18.0
StatsBytesSent: statistics of bytes sent over connection so far
func (*Libnbd) StatsChunksReceived ¶ added in v1.18.0
StatsChunksReceived: statistics of chunks received over connection so far
func (*Libnbd) StatsChunksSent ¶ added in v1.18.0
StatsChunksSent: statistics of chunks sent over connection so far
func (*Libnbd) String ¶
Convert handle to string (just for debugging).
func (*Libnbd) SupportsTls ¶
SupportsTls: true if libnbd was compiled with support for TLS
func (*Libnbd) SupportsUri ¶
SupportsUri: true if libnbd was compiled with support for NBD URIs
func (*Libnbd) SupportsVsock ¶ added in v1.18.0
SupportsVsock: true if libnbd was compiled with support for AF_VSOCK
type LibnbdError ¶
type LibnbdError struct { Op string // operation which failed Errmsg string // string (nbd_get_error) Errno syscall.Errno // errno (nbd_get_errno) }
All functions (except Close) return ([result,] LibnbdError).
func (*LibnbdError) String ¶
func (e *LibnbdError) String() string
type LibnbdExtent ¶ added in v1.18.0
type LibnbdExtent struct { Length uint64 // length of the extent Flags uint64 // flags describing properties of the extent }
Used for block status callback.
type PreadOptargs ¶
type PreadOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for Pread.
type PreadStructuredOptargs ¶
type PreadStructuredOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for PreadStructured.
type PwriteOptargs ¶
type PwriteOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags CmdFlag }
Struct carrying optional arguments for Pwrite.
type ShutdownOptargs ¶
type ShutdownOptargs struct { /* Flags field is ignored unless FlagsSet == true. */ FlagsSet bool Flags Shutdown }
Struct carrying optional arguments for Shutdown.