VLink  2.3.0
A high-performance communication middleware
fast_buffer_plugin_interface.h 文件参考

Vendor-independent allocation and sharing contract for zerocopy::FastBuffer. 更多...

#include <cstddef>
#include <cstdint>
#include "../base/plugin.h"
#include "./fast_buffer.h"
fast_buffer_plugin_interface.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

类

class  vlink::FastBufferPluginInterface
 Supplies platform buffers without exposing a vendor runtime to VLink. 更多...
 

命名空间

 

详细描述

Vendor-independent allocation and sharing contract for zerocopy::FastBuffer.

FastBufferPluginInterface separates native allocation and host access from the platform that allocates the storage. Implementations may use ordinary or pinned CPU memory, device memory, shared memory, DMA-BUF or virtual allocations. Unsupported allocation domains and optional operations report failure.

Operation Methods Contract
Allocation and ownership create(), release() One owned reference per result
CPU mapping map(), unmap() Explicit access/cache scope
Native API integration native_handle(), import_native() Provider-defined local object
Completion synchronize() Wait for tracked work
Payload copy copy(), copy_to_host(), copy_from_host() Synchronous completion
Descriptor transport export_handle(), import_handle() No local pointer on the wire
Descriptor size get_handle_size() Per-allocation support
Dead-owner cleanup destroy_handle() Named OS resources only
Sharing lifecycle
Publishing process Subscribing process
------------------ -------------------
pool acquire --> generation + 1
|
device/CPU writes
|
manager export -- name + generation --> manager import
| claim reader slot, check generation
| SDK import_handle()
drop reference (never waits) |
| device use or map/unmap
next acquire: purge dead readers, |
busy while live readers remain release(): SDK close, clear slot
|
final release: retire, free when the reader table is empty

A zerocopy::FastBuffer::Buffer address belongs to its local process and address space. CPU callers must use map() or copy_to_host(); a non-null device address is not proof of CPU accessibility. Native objects and numeric file descriptors likewise require provider-specific import or OS handle transfer.

Plugin registration
class MyFastBufferPlugin final : public vlink::FastBufferPluginInterface {
// Implement the allocation, access and sharing contract below.
};
VLINK_PLUGIN_DECLARE(MyFastBufferPlugin, 1, 0)
#define VLINK_PLUGIN_DECLARE(ImplementType, VersionMajor, VersionMinor)
Emits the extern "C" construction and destruction entry points exported by a plugin module.
Definition: plugin.h:406
Set VLINK_FASTBUFFER_PLUGIN before the process creates its first buffer. The interface ABI and the descriptor protocol ID are separate compatibility contracts; the latter identifies interoperable native descriptors within the core envelope.