Public Member Functions | |
LBManager (const EjfatURI &cpuri, bool validateServer=true, bool useHostAddress=false, grpc::SslCredentialsOptions opts=grpc::SslCredentialsOptions()) | |
result< u_int32_t > | reserveLB (const std::string &lb_name, const TimeUntil &until, const std::vector< std::string > &senders) noexcept |
result< u_int32_t > | reserveLB (const std::string &lb_name, const boost::posix_time::time_duration &duration, const std::vector< std::string > &senders) noexcept |
result< u_int32_t > | reserveLB (const std::string &lb_name, const double &durationSeconds, const std::vector< std::string > &senders) noexcept |
result< int > | getLB (const std::string &lbid) noexcept |
result< int > | getLB () noexcept |
result< std::unique_ptr< LoadBalancerStatusReply > > | getLBStatus (const std::string &lbid) noexcept |
result< std::unique_ptr< LoadBalancerStatusReply > > | getLBStatus () noexcept |
result< std::unique_ptr< OverviewReply > > | overview () noexcept |
result< int > | addSenders (const std::vector< std::string > &senders) noexcept |
result< int > | removeSenders (const std::vector< std::string > &senders) noexcept |
result< int > | addSenderSelf (bool v6=false) noexcept |
result< int > | removeSenderSelf (bool v6=false) noexcept |
result< int > | freeLB (const std::string &lbid) noexcept |
result< int > | freeLB () noexcept |
result< int > | registerWorker (const std::string &node_name, std::pair< ip::address, u_int16_t > node_ip_port, float weight, u_int16_t source_count, float min_factor, float max_factor) noexcept |
result< int > | registerWorkerSelf (const std::string &node_name, u_int16_t node_port, float weight, u_int16_t source_count, float min_factor, float max_factor, bool v6=false) noexcept |
result< int > | deregisterWorker () noexcept |
result< int > | sendState (float fill_percent, float control_signal, bool is_ready) noexcept |
result< int > | sendState (float fill_percent, float control_signal, bool is_ready, const Timestamp &ts) noexcept |
result< boost::tuple< std::string, std::string, std::string > > | version () noexcept |
const EjfatURI & | get_URI () const noexcept |
std::string | get_AddrString () |
Static Public Member Functions | |
static std::vector< WorkerStatus > | get_WorkerStatusVector (std::unique_ptr< LoadBalancerStatusReply > &rep) noexcept |
static std::vector< WorkerStatus > | get_WorkerStatusVector (const LoadBalancerStatusReply &rep) noexcept |
static std::vector< std::string > | get_SenderAddressVector (std::unique_ptr< LoadBalancerStatusReply > &rep) noexcept |
static std::vector< std::string > | get_SenderAddressVector (const LoadBalancerStatusReply &rep) noexcept |
static const std::unique_ptr< LBStatus > | asLBStatus (std::unique_ptr< LoadBalancerStatusReply > &rep) noexcept |
static const LBStatus | asLBStatus (const LoadBalancerStatusReply &rep) noexcept |
static const OverviewMessage | asOverviewMessage (std::unique_ptr< OverviewReply > &rep) noexcept |
static const OverviewMessage | asOverviewMessage (const OverviewReply &rep) noexcept |
static result< grpc::SslCredentialsOptions > | makeSslOptions (const std::string &pem_root_certs, const std::string &pem_private_key, const std::string &pem_cert_chain) noexcept |
static result< grpc::SslCredentialsOptions > | makeSslOptionsFromFiles (std::string_view pem_root_certs, std::string_view pem_private_key, std::string_view pem_cert_chain) noexcept |
static result< grpc::SslCredentialsOptions > | makeSslOptionsFromFiles (std::string_view pem_root_certs) noexcept |
|
inline |
Initialize manager. Default is with TLS/SSL and default client options. To enable custom SSL configuration with custom root certs, private key (for authN) and cert use makeSslOptions[FromFiles]() methods and pass the output to this constructor.
cpuri | an EjfatURI object parsed from configuration data |
validateServer | if false, skip server certificate validation (useful for self-signed testing) |
useHostAddress | even if hostname is provided, use host address as resolved by URI object (with preference for IPv4 by default or for IPv6 if explicitly requested) |
opts | grpc::SslCredentialsOptions containing some combination of server root certs, client key and client cert use of SSL/TLS is governed by the URI scheme ('ejfat' vs 'ejfats') |
|
noexcept |
Add 'safe' sender addresses to CP to allow these sender to send data to the LB
sender_list | - list of sender addresses |
|
noexcept |
Determine the caller's outgoing interface towards LB dataplane and register it as a sender
- | use IPv6 dataplane (default false) |
|
inlinestaticnoexcept |
Helper function copies LoadBalancerStatusReply protobuf into a simpler struct
|
inlinestaticnoexcept |
Helper function copies LoadBalancerStatusReply protobuf into a simpler struct
|
inlinestaticnoexcept |
Helper function copies OverviewReply protobuf into a simpler struct
|
inlinestaticnoexcept |
Helper function copies OverviewReply protobuf into a simpler struct
|
noexcept |
Deregister worker using session ID and session token from the register call
|
noexcept |
Free previously reserved load balancer. Uses admin token and uses LB ID obtained from reserve call on the same LBManager object.
|
noexcept |
Free previously reserved load balancer. Uses admin token.
- | externally provided lbid, in this case the URI only needs to contain cp address and admin token |
|
inline |
Return the address string used by gRPC to connect to control plane. Can be in the format of hostname:port or ipv4:///W.X.Y.Z:port or ipv6:///[XXXX::XX:XXXX]:port
|
inlinestaticnoexcept |
Helper function copies sender addresses into a vector. Relies on move semantics.
rep | - the referenced return of getLBStatus() call |
|
inlinestaticnoexcept |
Helper function copies sender addresses into a vector. Relies on move semantics.
rep | - the referenced return of getLBStatus() call |
|
inlinenoexcept |
Get the internal URI object.
|
inlinestaticnoexcept |
Helper function copies worker records into a vector It takes a unique_ptr from getLBStatus() call and helps parse it. Relies on move semantics.
rep | - the return of the getLBStatus() call |
|
inlinestaticnoexcept |
Helper function copies worker records into a vector It takes a unique_ptr from getLBStatus() call and helps parse it. Relies on move semantics.
rep | - the return of the getLBStatus() call |
|
noexcept |
Get load balancer info using lb id in the URI object
|
noexcept |
Get load balancer info - it updates the info inside the EjfatURI object just like reserveLB. Uses admin token of the internal URI object. Note that unlike reserve it does NOT set the instance token - it is not available.
lbid | - externally provided lb id, in this case the URI only needs to contain the cp address and admin token and it will be updated to contain dataplane and sync addresses. |
protobuf definition uses u_int32
|
noexcept |
Get load balancer status including list of workers, sender IP addresses etc using lb id in the URI object
|
noexcept |
Get load balancer status including list of workers, sender IP addresses.
lbid | - externally provided lbid, in this case the URI only needs to contain cp address and admin token |
|
inlinestaticnoexcept |
Generate gRPC-compliant custom SSL Options object with the following parameters, where any parameter can be empty. Uses std::move to avoid copies.
pem_root_certs | The buffer containing the PEM encoding of the server root certificates. |
pem_private_key | The buffer containing the PEM encoding of the client's private key. |
pem_cert_chain | The buffer containing the PEM encoding of the client's certificate chain. |
|
staticnoexcept |
Generate gRPC-compliant custom SSL Options object with just the server root cert
pem_root_certs | - The file name containing the PEM encoding of the server root certificate. |
|
staticnoexcept |
Generate gRPC-compliant custom SSL Options object with the following parameters, where any parameter can be empty
pem_root_certs | - The file name containing the PEM encoding of the server root certificate. |
pem_private_key | - The file name containing the PEM encoding of the client's private key. |
pem_cert_chain | - The file name containing the PEM encoding of the client's certificate chain. |
|
noexcept |
Get an 'overview' of reserved load balancer instances
|
noexcept |
Register a workernode/backend with an allocated loadbalancer. Note that this call uses instance token. It sets session token and session id on the internal URI object. Note that a new worker must send state immediately (within 10s) or be automatically deregistered.
node_name | - name of the node (can be FQDN) |
node_ip_port | - a pair of ip::address and u_int16_t starting UDP port on which it listens |
weight | - weight given to this node in terms of processing power |
source_count | - how many sources we can listen to (gets converted to port range [0,14]) |
min_factor | - multiplied with the number of slots that would be assigned evenly to determine min number of slots for example, 4 nodes with a minFactor of 0.5 = (512 slots / 4) * 0.5 = min 64 slots |
max_factor | - multiplied with the number of slots that would be assigned evenly to determine max number of slots for example, 4 nodes with a maxFactor of 2 = (512 slots / 4) * 2 = max 256 slots set to 0 to specify no maximum |
|
noexcept |
Register the calling worker workernode/backend with an allocated loadbalancer. The node tries to determine its outgoing IP address towards LB dataplane. Note that this call uses instance token. It sets session token and session id on the internal URI object. Note that a new worker must send state immediately (within 10s) or be automatically deregistered.
node_name | - name of the node (can be FQDN) |
node_port | - a u_int16_t starting UDP port on which it listens |
weight | - weight given to this node in terms of processing power |
source_count | - how many sources we can listen to (gets converted to port range [0,14]) |
min_factor | - multiplied with the number of slots that would be assigned evenly to determine min number of slots for example, 4 nodes with a minFactor of 0.5 = (512 slots / 4) * 0.5 = min 64 slots |
max_factor | - multiplied with the number of slots that would be assigned evenly to determine max number of slots for example, 4 nodes with a maxFactor of 2 = (512 slots / 4) * 2 = max 256 slots set to 0 to specify no maximum |
v6 | - use IPv6 dataplane (defaults to false) |
|
noexcept |
Remove 'safe' sender addresses from CP to disallow these senders to send data to the LB
|
noexcept |
Determine the caller's outgoing interface towards LB dataplane and unregister as a sender
- | use IPv6 dataplane (default false) |
|
noexcept |
Reserve a new load balancer with this name until specified time. It sets the intstance token on the internal URI object.
lb_name | LB name internal to you |
duration | for how long it is needed as boost::posix_time::time_duration. You can use boost::posix_time::duration_from_string from string like "23:59:59.000"s |
senders | list of sender IP addresses |
|
noexcept |
Reserve a new load balancer with this name of duration in seconds
lb_name | LB name internal to you |
durationSeconds | for how long it is needed in seconds |
senders | list of sender IP addresses |
NOTE: this static casting may lose time accuracy, but should be accepted
|
noexcept |
Reserve a new load balancer with this name until specified time
lb_name | LB name internal to you |
until | time until it's needed as google protobuf timestamp pointer. |
senders | list of sender IP addresses |
protobuf definition uses u_int32
|
noexcept |
Send worker state update using session ID and session token from register call. Automatically uses localtime to set the timestamp. Workers are expected to send state every 100ms or so.
fill_percent | - [0:1] percentage filled of the queue |
control_signal | - change to data rate |
is_ready | - if true, worker ready to accept more data, else not ready |
|
noexcept |
Send worker state update using session ID and session token from register call. Allows to explicitly set the timestamp.
fill_percent | - [0:1] percentage filled of the queue |
control_signal | - change to data rate |
is_ready | - if true, worker ready to accept more data, else not ready |
ts | - google::protobuf::Timestamp timestamp for this message (if you want to explicitly not use localtime) |
|
noexcept |
Get the version of the load balancer (the commit string)