blob: ed43af977baa56436c612821fb35b20b1291ed85 [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _PULSAR_LOOKUP_DATA_RESULT_HEADER_
#define _PULSAR_LOOKUP_DATA_RESULT_HEADER_
#include <string>
#include <lib/Future.h>
#include <pulsar/Result.h>
namespace pulsar {
class LookupDataResult;
typedef boost::shared_ptr<LookupDataResult> LookupDataResultPtr;
typedef Promise<Result, LookupDataResultPtr> LookupDataResultPromise;
typedef boost::shared_ptr<LookupDataResultPromise> LookupDataResultPromisePtr;
class LookupDataResult {
public:
void setBrokerUrl(const std::string& brokerUrl) {
brokerUrl_ = brokerUrl;
}
void setBrokerUrlSsl(const std::string& brokerUrlSsl) {
brokerUrlSsl_ = brokerUrlSsl;
}
std::string getBrokerUrl() {
return brokerUrl_;
}
std::string getBrokerUrlSsl() {
return brokerUrlSsl_;
}
bool isAuthoritative() const {
return authoritative;
}
void setAuthoritative(bool authoritative) {
this->authoritative = authoritative;
}
int getPartitions() const {
return partitions;
}
void setPartitions(int partitions) {
this->partitions = partitions;
}
bool isRedirect() const {
return redirect;
}
void setRedirect(bool redirect) {
this->redirect = redirect;
}
private:
friend inline std::ostream& operator<<(std::ostream& os, const LookupDataResult& b);
std::string brokerUrl_;
std::string brokerUrlSsl_;
int partitions;
bool authoritative;
bool redirect;
};
std::ostream& operator<<(std::ostream& os, const LookupDataResult& b) {
os << "{ LookupDataResult [brokerUrl_ = " << b.brokerUrl_ << "] [brokerUrlSsl_ = "
<< b.brokerUrlSsl_ << "] [partitions = "
<< b.partitions << "] [authoritative = "
<< b.authoritative << "] [redirect = " << b.redirect
<< "]";
return os;
}
}
#endif // _PULSAR_LOOKUP_DATA_RESULT_HEADER_