IOFormat 1.12.0
Loading...
Searching...
No Matches
ProtocolPlugin.h
1#pragma once
2
3#include <iolink/storage/RandomAccess.h>
4#include <iolink/storage/StreamAccess.h>
5
6#include <ioformat/OptionMap.h>
7#include <ioformat/plugin/Plugin.h>
8#include <ioformat/plugin/PluginVersion.h>
9
10namespace ioformat
11{
12
20class ProtocolPlugin : public Plugin
21{
22public:
26 static constexpr uint64_t PLUGIN_API_VERSION = 2;
27
34 inline uint64_t api() const final override { return PLUGIN_API_VERSION; }
35
39 virtual const StringSet& supportedSchemes() const = 0;
40
50 virtual bool exists(const std::string& uri) = 0;
51
65 virtual std::shared_ptr<iolink::RandomAccess> openReader(const std::string& uri, const OptionMap& options) = 0;
66
80 virtual std::shared_ptr<iolink::StreamAccess> openWriter(const std::string& uri, const OptionMap& options) = 0;
81
107 virtual StringSet list(const std::string& host, const std::string& prefix, const OptionMap& options) = 0;
108
120 virtual void addCredentials(const std::string& host, const std::string& user, const std::string& password) = 0;
121};
122
123} // end namespace ioformat
124
130#define IOFORMAT_PROTOCOL_PLUGIN_TOKEN ioformat_protocol_plugin
131
139#define IOFORMAT_PROTOCOL_PLUGIN_SYMBOL "ioformat_protocol_plugin"
140
149#define IOFORMAT_DECLARE_PROTOCOL_PLUGIN(PLUGIN_CLASS) \
150 IOFORMAT_DECLARE_PLUGIN(PLUGIN_CLASS, IOFORMAT_PROTOCOL_PLUGIN_TOKEN)
A map of heterogeneous options.
Definition OptionMap.h:34
Base class for all plugins.
Definition Plugin.h:21
ProtocolPlugin is an interface for plugins that provide access to data using a specific protocol.
Definition ProtocolPlugin.h:21
static constexpr uint64_t PLUGIN_API_VERSION
The actual API version of the plugin.
Definition ProtocolPlugin.h:26
virtual std::shared_ptr< iolink::RandomAccess > openReader(const std::string &uri, const OptionMap &options)=0
Open a handler to read data from a remote resource addressed by a URI.
virtual StringSet list(const std::string &host, const std::string &prefix, const OptionMap &options)=0
List the resources on a specific host filtered with a prefix.
virtual std::shared_ptr< iolink::StreamAccess > openWriter(const std::string &uri, const OptionMap &options)=0
Open a handler to write data to a remote resource addressed by a URI.
virtual void addCredentials(const std::string &host, const std::string &user, const std::string &password)=0
Add credentials to the plugin for a specific host.
uint64_t api() const final override
Get the API version of the plugin.
Definition ProtocolPlugin.h:34
virtual const StringSet & supportedSchemes() const =0
Get the URI schemes supported by the plugin.
virtual bool exists(const std::string &uri)=0
Check if the resource addressed by the URI exists.
Global namespace which contains all methods to encode/decode data from/into different resources (file...
Definition Error.h:6