Commit 6af5878d authored by Marshall Pierce's avatar Marshall Pierce
Browse files

Merge pull request #5 from Seagate/features/asokvad-63

Features/asokvad 63
parents 93a7e67b 161c2b70
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ ExternalProject_add(
    INSTALL_COMMAND ""
)

set(KINETIC_PROTO_VERSION "2.0.0")
set(KINETIC_PROTO_MD5 "10d4090be4315644874bf80b3e9ff748")
set(KINETIC_PROTO_VERSION "2.0.1")
set(KINETIC_PROTO_MD5 "1505fab102afc04994932c7c1406a697")

ExternalProject_add(
    kinetic-proto
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ This repo contains code for producing C and C++ kinetic clients.

Protocol Version
=================
The client is using version `2.0.0` of the [Kinetic-Protocol](https://github.com/Seagate/kinetic-protocol/releases/tag/2.0.0).
The client is using version `2.0.1` of the [Kinetic-Protocol](https://github.com/Seagate/kinetic-protocol/releases/tag/2.0.1).


Dependencies
+15 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@
namespace kinetic {

typedef struct {
    uint64_t remaining_bytes;
    uint64_t total_bytes;
    uint64_t nominal_capacity_in_bytes;
    float portion_full;
} Capacity;

typedef struct {
@@ -60,12 +60,25 @@ typedef struct {
    std::string source_hash;
} Configuration;

typedef struct {
    uint32_t max_key_size;
    uint32_t max_value_size;
    uint32_t max_version_size;
    uint32_t max_tag_size;
    uint32_t max_connections;
    uint32_t max_outstanding_read_requests;
    uint32_t max_outstanding_write_requests;
    uint32_t max_message_size;
} Limits;


typedef struct {
    Configuration configuration;
    Capacity capacity;
    std::list<OperationStatistic> operation_statistics;
    std::list<Utilization> utilizations;
    std::list<Temperature> temperatures;
    Limits limits;
    std::string messages;
} DriveLog;

+14 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ using com::seagate::kinetic::client::proto::Message_GetLog_Type_CAPACITIES;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_CONFIGURATION;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_STATISTICS;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_MESSAGES;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_LIMITS;
using com::seagate::kinetic::client::proto::Message_Security_ACL;
using com::seagate::kinetic::client::proto::Message_Security_ACL_Permission;
using com::seagate::kinetic::client::proto::Message_Security_ACL_Scope;
@@ -147,8 +148,18 @@ void GetLogHandler::Handle(const Message& response, unique_ptr<const string> val
    drive_log->configuration.tls_port = configuration.tlsport();

    auto capacity = getlog.capacity();
    drive_log->capacity.remaining_bytes = capacity.remaining();
    drive_log->capacity.total_bytes = capacity.total();
    drive_log->capacity.nominal_capacity_in_bytes = capacity.nominalcapacityinbytes();
    drive_log->capacity.portion_full = capacity.portionfull();

    auto limits = getlog.limits();
    drive_log->limits.max_key_size = limits.maxkeysize();
    drive_log->limits.max_value_size = limits.maxvaluesize();
    drive_log->limits.max_version_size = limits.maxversionsize();
    drive_log->limits.max_tag_size = limits.maxtagsize();
    drive_log->limits.max_connections = limits.maxconnections();
    drive_log->limits.max_outstanding_read_requests = limits.maxoutstandingreadrequests();
    drive_log->limits.max_outstanding_write_requests = limits.maxoutstandingwriterequests();
    drive_log->limits.max_message_size = limits.maxmessagesize();

    for (int i = 0; i < getlog.statistics_size(); i++) {
        OperationStatistic statistic;
@@ -410,6 +421,7 @@ HandlerKey NonblockingKineticConnection::GetLog(
    mutable_getlog->add_type(Message_GetLog_Type_CONFIGURATION);
    mutable_getlog->add_type(Message_GetLog_Type_STATISTICS);
    mutable_getlog->add_type(Message_GetLog_Type_MESSAGES);
    mutable_getlog->add_type(Message_GetLog_Type_LIMITS);

    unique_ptr<GetLogHandler> handler(new GetLogHandler(callback));
    return service_->Submit(move(request), empty_str_, move(handler));
+7 −5
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ using com::seagate::kinetic::client::proto::Message_GetLog_Type_CAPACITIES;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_CONFIGURATION;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_STATISTICS;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_MESSAGES;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_LIMITS;
using com::seagate::kinetic::client::proto::Message_Security;
using com::seagate::kinetic::client::proto::Message_Security_ACL;
using com::seagate::kinetic::client::proto::Message_Security_ACL_Scope;
@@ -274,21 +275,22 @@ TEST_F(NonblockingKineticConnectionTest, GetLogBuildsCorrectMessage) {
    connection_.GetLog(NULL);

    EXPECT_EQ(Message_MessageType_GETLOG, message.command().header().messagetype());
    EXPECT_EQ(6, message.command().body().getlog().type_size());
    EXPECT_EQ(7, message.command().body().getlog().type_size());
    EXPECT_EQ(Message_GetLog_Type_UTILIZATIONS, message.command().body().getlog().type(0));
    EXPECT_EQ(Message_GetLog_Type_TEMPERATURES, message.command().body().getlog().type(1));
    EXPECT_EQ(Message_GetLog_Type_CAPACITIES, message.command().body().getlog().type(2));
    EXPECT_EQ(Message_GetLog_Type_CONFIGURATION, message.command().body().getlog().type(3));
    EXPECT_EQ(Message_GetLog_Type_STATISTICS, message.command().body().getlog().type(4));
    EXPECT_EQ(Message_GetLog_Type_MESSAGES, message.command().body().getlog().type(5));
    EXPECT_EQ(Message_GetLog_Type_LIMITS, message.command().body().getlog().type(6));
}

TEST_F(NonblockingKineticConnectionTest, GetLogParsesMessageCorrectly) {
    Message response;
    response.mutable_command()->mutable_body()->mutable_getlog()
            ->mutable_capacity()->set_remaining(123);
            ->mutable_capacity()->set_nominalcapacityinbytes(123);
    response.mutable_command()->mutable_body()->mutable_getlog()
            ->mutable_capacity()->set_total(456);
            ->mutable_capacity()->set_portionfull(0.5);

    response.mutable_command()->mutable_body()->mutable_getlog()
            ->mutable_configuration()->set_vendor("vendor");
@@ -337,8 +339,8 @@ TEST_F(NonblockingKineticConnectionTest, GetLogParsesMessageCorrectly) {
    unique_ptr<const string> empty_str(new string(""));
    handler.Handle(response, move(empty_str));

    EXPECT_EQ((uint64_t) 123, drive_log.capacity.remaining_bytes);
    EXPECT_EQ((uint64_t) 456, drive_log.capacity.total_bytes);
    EXPECT_EQ((uint64_t) 123, drive_log.capacity.nominal_capacity_in_bytes);
    EXPECT_EQ((float) 0.5, drive_log.capacity.portion_full);

    EXPECT_EQ("vendor", drive_log.configuration.vendor);
    EXPECT_EQ("model", drive_log.configuration.model);