Skip to content

Commit 1128950

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

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,11 +41,11 @@
4141
#include <bdlbb_blob.h>
4242
#include <bsl_iostream.h>
4343
#include <bsl_string.h>
44+
#include <bsl_string_view.h>
4445
#include <bsl_vector.h>
4546
#include <bslma_managedptr.h>
4647
#include <bslma_usesbslmaallocator.h>
4748
#include <bslmf_nestedtraitdeclaration.h>
48-
#include <bslstl_stringref.h>
4949

5050
namespace BloombergLP {
5151
namespace mqbplug {
@@ -64,15 +64,15 @@ class AuthenticationData BSLS_KEYWORD_FINAL {
6464
public:
6565
// CREATORS
6666
AuthenticationData(const bsl::vector<char>& authnPayload,
67-
bslstl::StringRef clientIpAddress);
67+
bsl::string_view clientIpAddress);
6868

6969
// ACESSORS
7070

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

7474
/// Return the IP Address of the client.
75-
bslstl::StringRef clientIpAddress() const;
75+
bsl::string_view clientIpAddress() const;
7676
};
7777

7878
// ==========================
@@ -88,7 +88,7 @@ class AuthenticationResult {
8888
// ACCESSORS
8989

9090
/// Return the principal.
91-
virtual bslstl::StringRef principal() const = 0;
91+
virtual bsl::string_view principal() const = 0;
9292

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

111111
/// Return the name of the plugin.
112-
virtual bslstl::StringRef name() const = 0;
112+
virtual bsl::string_view name() const = 0;
113113

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

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

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

173173
// ============================================================================
@@ -180,7 +180,7 @@ struct AuthenticatorUtil {
180180

181181
inline AuthenticationData::AuthenticationData(
182182
const bsl::vector<char>& authnPayload,
183-
bslstl::StringRef clientIpAddress)
183+
bsl::string_view clientIpAddress)
184184
: d_authnPayload(authnPayload)
185185
, d_clientIpAddress(clientIpAddress)
186186
{
@@ -191,7 +191,7 @@ inline const bsl::vector<char>& AuthenticationData::authnPayload() const
191191
return d_authnPayload;
192192
}
193193

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

src/groups/mqb/mqbplug/mqbplug_plugininfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <mqbscm_version.h>
2020
// BDE
2121
#include <bsl_ostream.h>
22+
#include <bsl_string_view.h>
2223
#include <bslim_printer.h>
2324
#include <bslma_default.h>
2425

@@ -31,7 +32,7 @@ namespace mqbplug {
3132

3233
// CREATORS
3334
PluginInfo::PluginInfo(mqbplug::PluginType::Enum type,
34-
bslstl::StringRef name,
35+
bsl::string_view name,
3536
bslma::Allocator* allocator)
3637
: d_type(type)
3738
, 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
@@ -34,10 +34,10 @@
3434
#include <bsl_memory.h>
3535
#include <bsl_ostream.h>
3636
#include <bsl_string.h>
37+
#include <bsl_string_view.h>
3738
#include <bslma_allocator.h>
3839
#include <bslma_usesbslmaallocator.h>
3940
#include <bslmf_nestedtraitdeclaration.h>
40-
#include <bslstl_stringref.h>
4141

4242
namespace BloombergLP {
4343

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

8787
/// Create an instance of `PluginInfo` having the same value as
@@ -94,9 +94,9 @@ class PluginInfo {
9494

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

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

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

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

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

src/groups/mqb/mqbplug/mqbplug_pluginmanager.cpp

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

8787
void PluginManager::enableRequiredPlugins(
88-
const bslstl::StringRef& pluginPath,
88+
bsl::string_view pluginPath,
8989
const bslma::ManagedPtr<PluginLibrary>& pluginLibrary,
9090
RequiredPluginsRecord* requiredPlugins,
9191
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
@@ -52,7 +52,7 @@ StatConsumerPluginFactory::~StatConsumerPluginFactory()
5252
// ----------------------
5353

5454
const mqbcfg::StatPluginConfig*
55-
StatConsumerUtil::findConsumerConfig(bslstl::StringRef name)
55+
StatConsumerUtil::findConsumerConfig(bsl::string_view name)
5656
{
5757
const bsl::vector<mqbcfg::StatPluginConfig>& configs =
5858
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)