1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-24 06:54:22 +00:00
srs/trunk/src/kernel/srs_kernel_balance.hpp

39 lines
725 B
C++
Raw Normal View History

//
// Copyright (c) 2013-2021 The SRS Authors
//
// SPDX-License-Identifier: MIT
//
2017-01-18 08:23:59 +00:00
#ifndef SRS_KERNEL_BALANCE_HPP
#define SRS_KERNEL_BALANCE_HPP
#include <srs_core.hpp>
#include <vector>
#include <string>
/**
* the round-robin load balance algorithm,
2019-10-03 04:45:38 +00:00
* used for edge pull and other multiple server feature.
*/
class SrsLbRoundRobin
{
private:
// current selected index.
int index;
// total scheduled count.
uint32_t count;
// current selected server.
std::string elem;
public:
SrsLbRoundRobin();
virtual ~SrsLbRoundRobin();
public:
virtual uint32_t current();
virtual std::string selected();
virtual std::string select(const std::vector<std::string>& servers);
};
#endif