Connection.h 1.0 KB
Newer Older
W
wxyu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#pragma once

#include <string>
#include <sstream>


namespace zilliz {
namespace milvus {
namespace engine {

class Connection {
public:
    Connection(std::string name, double speed)
        : name_(std::move(name)), speed_(speed) {}

    const std::string &
Y
Yu Kun 已提交
22
    name() const {
W
wxyu 已提交
23 24 25
        return name_;
    }

Y
Yu Kun 已提交
26 27
    uint64_t
    speed() const {
W
wxyu 已提交
28 29 30
        return speed_;
    }

31 32 33 34 35
    uint64_t
    transport_cost() {
        return 1024 / speed_;
    }

W
wxyu 已提交
36 37 38 39 40 41 42 43 44 45
public:
    std::string
    Dump() const {
        std::stringstream ss;
        ss << "<name: " << name_ << ", speed: " << speed_ << ">";
        return ss.str();
    }

private:
    std::string name_;
Y
Yu Kun 已提交
46
    uint64_t speed_;
W
wxyu 已提交
47 48 49 50 51 52
};


}
}
}