Skip to content

Commit a6885dd

Browse files
committed
Fix[BMQ]: minor plugin fix (#790)
Signed-off-by: Emelia Lei <[email protected]>
1 parent 80ba345 commit a6885dd

16 files changed

+98
-83
lines changed

src/groups/mqb/mqbauthn/mqbauthn_authenticationcontroller.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
// BDE
3131
#include <bsl_string.h>
32+
#include <bsl_string_view.h>
3233
#include <bsl_unordered_set.h>
3334

3435
namespace BloombergLP {
@@ -122,7 +123,7 @@ void AuthenticationController::stop()
122123
int AuthenticationController::authenticate(
123124
bsl::ostream& errorDescription,
124125
bsl::shared_ptr<mqbplug::AuthenticationResult>* result,
125-
bslstl::StringRef mechanism,
126+
bsl::string_view mechanism,
126127
const mqbplug::AuthenticationData& input)
127128
{
128129
enum RcEnum {

src/groups/mqb/mqbauthn/mqbauthn_authenticationcontroller.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// BDE
2525
#include <ball_log.h>
2626
#include <bsl_memory.h>
27+
#include <bsl_string_view.h>
2728
#include <bsl_unordered_map.h>
2829
#include <bslma_allocator.h>
2930

@@ -42,7 +43,7 @@ class AuthenticationController {
4243
private:
4344
// PRIVATE TYPES
4445
typedef bslma::ManagedPtr<mqbplug::Authenticator> AuthenticatorMp;
45-
typedef bsl::unordered_map<bslstl::StringRef, AuthenticatorMp>
46+
typedef bsl::unordered_map<bsl::string_view, AuthenticatorMp>
4647
AuthenticatorMap;
4748

4849
// DATA
@@ -99,7 +100,7 @@ class AuthenticationController {
99100
/// Note that the `mechanism` is case insensitive.
100101
int authenticate(bsl::ostream& errorDescription,
101102
bsl::shared_ptr<mqbplug::AuthenticationResult>* result,
102-
bslstl::StringRef mechanism,
103+
bsl::string_view mechanism,
103104
const mqbplug::AuthenticationData& input);
104105
};
105106

src/groups/mqb/mqbplug/mqbplug_authenticator.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818

1919
#include <mqbscm_version.h>
2020

21+
// MQB
22+
#include <mqbcfg_messages.h>
23+
24+
// BDE
25+
#include <bsl_string_view.h>
26+
#include <bsl_vector.h>
27+
2128
namespace BloombergLP {
2229
namespace mqbplug {
2330

@@ -58,7 +65,7 @@ AuthenticatorPluginFactory::~AuthenticatorPluginFactory()
5865
// -----------------------
5966

6067
const mqbcfg::AuthenticatorPluginConfig*
61-
AuthenticatorUtil::findAuthenticatorConfig(bslstl::StringRef name)
68+
AuthenticatorUtil::findAuthenticatorConfig(bsl::string_view name)
6269
{
6370
const bsl::vector<mqbcfg::AuthenticatorPluginConfig>& authenticatorsCfg =
6471
mqbcfg::BrokerConfig::get().authentication().plugins();

src/groups/mqb/mqbplug/mqbplug_authenticator.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
#include <bdlbb_blob.h>
4242
#include <bsl_iostream.h>
4343
#include <bsl_string.h>
44+
#include <bsl_string_view.h>
4445
#include <bslma_managedptr.h>
4546
#include <bslma_usesbslmaallocator.h>
4647
#include <bslmf_nestedtraitdeclaration.h>
47-
#include <bslstl_stringref.h>
4848

4949
namespace BloombergLP {
5050
namespace mqbplug {
@@ -63,15 +63,15 @@ class AuthenticationData BSLS_KEYWORD_FINAL {
6363
public:
6464
// CREATORS
6565
AuthenticationData(const bsl::vector<char>& authnPayload,
66-
bslstl::StringRef clientIpAddress);
66+
bsl::string_view clientIpAddress);
6767

6868
// ACESSORS
6969

7070
/// Return the authentication material provided by the client.
7171
const bsl::vector<char>& authnPayload() const;
7272

7373
/// Return the IP Address of the client.
74-
bslstl::StringRef clientIpAddress() const;
74+
bsl::string_view clientIpAddress() const;
7575
};
7676

7777
// ==========================
@@ -87,7 +87,7 @@ class AuthenticationResult {
8787
// ACCESSORS
8888

8989
/// Return the principal.
90-
virtual bslstl::StringRef principal() const = 0;
90+
virtual bsl::string_view principal() const = 0;
9191

9292
/// Return the remaining lifetime of an authenticated session.
9393
virtual const bsl::optional<bsls::Types::Int64>& lifetimeMs() const = 0;
@@ -108,12 +108,12 @@ class Authenticator {
108108
// ACESSORS
109109

110110
/// Return the name of the plugin.
111-
virtual bslstl::StringRef name() const = 0;
111+
virtual bsl::string_view name() const = 0;
112112

113113
/// Return the authentication mechanism supported by this Authenticator.
114114
/// Guaranteed to return a valid mechanism once the Authenticator is
115115
/// constructed.
116-
virtual bslstl::StringRef mechanism() const = 0;
116+
virtual bsl::string_view mechanism() const = 0;
117117

118118
/// Authenticate using the data provided in the specified `input`.
119119
/// - Return `0` on success, and populate the specified `result` with
@@ -166,7 +166,7 @@ struct AuthenticatorUtil {
166166

167167
/// Find authenticator config with the specified `name`
168168
static const mqbcfg::AuthenticatorPluginConfig*
169-
findAuthenticatorConfig(bslstl::StringRef name);
169+
findAuthenticatorConfig(bsl::string_view name);
170170
};
171171

172172
// ============================================================================
@@ -179,7 +179,7 @@ struct AuthenticatorUtil {
179179

180180
inline AuthenticationData::AuthenticationData(
181181
const bsl::vector<char>& authnPayload,
182-
bslstl::StringRef clientIpAddress)
182+
bsl::string_view clientIpAddress)
183183
: d_authnPayload(authnPayload)
184184
, d_clientIpAddress(clientIpAddress)
185185
{
@@ -190,7 +190,7 @@ inline const bsl::vector<char>& AuthenticationData::authnPayload() const
190190
return d_authnPayload;
191191
}
192192

193-
inline bslstl::StringRef AuthenticationData::clientIpAddress() const
193+
inline bsl::string_view AuthenticationData::clientIpAddress() const
194194
{
195195
return d_clientIpAddress;
196196
}

src/groups/mqb/mqbplug/mqbplug_plugininfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <mqbscm_version.h>
2020
// BDE
21+
#include <bsl_string_view.h>
2122
#include <bslim_printer.h>
2223
#include <bslma_default.h>
2324

@@ -30,7 +31,7 @@ namespace mqbplug {
3031

3132
// CREATORS
3233
PluginInfo::PluginInfo(mqbplug::PluginType::Enum type,
33-
bslstl::StringRef name,
34+
bsl::string_view name,
3435
bslma::Allocator* allocator)
3536
: d_type(type)
3637
, d_name(name, allocator)

src/groups/mqb/mqbplug/mqbplug_plugininfo.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
// BDE
3434
#include <bsl_memory.h>
3535
#include <bsl_string.h>
36+
#include <bsl_string_view.h>
3637
#include <bslma_allocator.h>
3738
#include <bslma_usesbslmaallocator.h>
3839
#include <bslmf_nestedtraitdeclaration.h>
39-
#include <bslstl_stringref.h>
4040

4141
namespace BloombergLP {
4242

@@ -80,7 +80,7 @@ class PluginInfo {
8080
/// and `name`. Optionally specify an `allocator` used to supply
8181
/// memory.
8282
PluginInfo(mqbplug::PluginType::Enum type,
83-
bslstl::StringRef name,
83+
bsl::string_view name,
8484
bslma::Allocator* allocator = 0);
8585

8686
/// Create an instance of `PluginInfo` having the same value as
@@ -93,9 +93,9 @@ class PluginInfo {
9393

9494
// MANIPULATORS
9595
PluginInfo& setType(mqbplug::PluginType::Enum value);
96-
PluginInfo& setName(bslstl::StringRef value);
97-
PluginInfo& setDescription(bslstl::StringRef value);
98-
PluginInfo& setVersion(bslstl::StringRef value);
96+
PluginInfo& setName(bsl::string_view value);
97+
PluginInfo& setDescription(bsl::string_view value);
98+
PluginInfo& setVersion(bsl::string_view value);
9999

100100
/// Set the corresponding field to the specified `value` and return a
101101
/// reference offering modifiable access to this object.
@@ -158,19 +158,19 @@ inline PluginInfo& PluginInfo::setType(mqbplug::PluginType::Enum value)
158158
return *this;
159159
}
160160

161-
inline PluginInfo& PluginInfo::setName(bslstl::StringRef value)
161+
inline PluginInfo& PluginInfo::setName(bsl::string_view value)
162162
{
163163
d_name = value;
164164
return *this;
165165
}
166166

167-
inline PluginInfo& PluginInfo::setDescription(bslstl::StringRef value)
167+
inline PluginInfo& PluginInfo::setDescription(bsl::string_view value)
168168
{
169169
d_description = value;
170170
return *this;
171171
}
172172

173-
inline PluginInfo& PluginInfo::setVersion(bslstl::StringRef value)
173+
inline PluginInfo& PluginInfo::setVersion(bsl::string_view value)
174174
{
175175
d_version = value;
176176
return *this;

src/groups/mqb/mqbplug/mqbplug_pluginmanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ PluginManager::PluginManager(bslma::Allocator* allocator)
8686
}
8787

8888
void PluginManager::enableRequiredPlugins(
89-
const bslstl::StringRef& pluginPath,
89+
bsl::string_view pluginPath,
9090
const bslma::ManagedPtr<PluginLibrary>& pluginLibrary,
9191
RequiredPluginsRecord* requiredPlugins,
9292
bsl::vector<bsl::string>* pluginsProvided,

src/groups/mqb/mqbplug/mqbplug_pluginmanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class PluginManager BSLS_CPP11_FINAL {
129129
///
130130
/// See `PluginLibrary::loadPluginLibrary()` comments for more detail.
131131
void enableRequiredPlugins(
132-
const bslstl::StringRef& pluginPath,
132+
bsl::string_view pluginPath,
133133
const bslma::ManagedPtr<mqbplug::PluginLibrary>& pluginLibrary,
134134
RequiredPluginsRecord* requiredPlugins,
135135
bsl::vector<bsl::string>* pluginsProvided,

src/groups/mqb/mqbplug/mqbplug_statconsumer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ StatConsumerPluginFactory::~StatConsumerPluginFactory()
5151
// ----------------------
5252

5353
const mqbcfg::StatPluginConfig*
54-
StatConsumerUtil::findConsumerConfig(bslstl::StringRef name)
54+
StatConsumerUtil::findConsumerConfig(bsl::string_view name)
5555
{
5656
const bsl::vector<mqbcfg::StatPluginConfig>& configs =
5757
mqbcfg::BrokerConfig::get().stats().plugins();

src/groups/mqb/mqbplug/mqbplug_statconsumer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class StatConsumer {
6666
StatContextsMap;
6767
// Map of StatContext names to StatContext
6868

69-
typedef bsl::function<int(const bslstl::StringRef& source,
70-
const bsl::string& cmd,
71-
bsl::ostream& os)>
69+
typedef bsl::function<int(const bsl::string_view& source,
70+
const bsl::string& cmd,
71+
bsl::ostream& os)>
7272
CommandProcessorFn;
7373

7474
// CREATORS
@@ -79,7 +79,7 @@ class StatConsumer {
7979
// ACESSORS
8080

8181
/// Return the name of the plugin.
82-
virtual bslstl::StringRef name() const = 0;
82+
virtual bsl::string_view name() const = 0;
8383

8484
/// Return true if the stats reporting is enabled, false otherwise.
8585
virtual bool isEnabled() const = 0;
@@ -140,7 +140,7 @@ struct StatConsumerUtil {
140140

141141
/// Find consumer config with the specified `name`
142142
static const mqbcfg::StatPluginConfig*
143-
findConsumerConfig(bslstl::StringRef name);
143+
findConsumerConfig(bsl::string_view name);
144144
};
145145

146146
} // close package namespace

0 commit comments

Comments
 (0)