Commit 866747b1 authored by Paul Lensing's avatar Paul Lensing
Browse files

partial getlog functionality now takes a vector of getlog types as a

parameter instead of being constrained to requesting a single type
parent fe21396d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ class BlockingKineticConnection {

    virtual KineticStatus GetLog(unique_ptr<DriveLog>& drive_log);

    virtual KineticStatus GetLog(Command_GetLog_Type type, unique_ptr<DriveLog>& drive_log);
    virtual KineticStatus GetLog(const vector<Command_GetLog_Type>& types, unique_ptr<DriveLog>& drive_log);

    virtual KineticStatus UpdateFirmware(const shared_ptr<const string> new_firmware);

+1 −1
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ class NonblockingKineticConnection {
    virtual HandlerKey SetClusterVersion(int64_t new_cluster_version,
        const shared_ptr<SimpleCallbackInterface> callback);
    virtual HandlerKey GetLog(const shared_ptr<GetLogCallbackInterface> callback);
    virtual HandlerKey GetLog(Command_GetLog_Type type,
    virtual HandlerKey GetLog(const vector<Command_GetLog_Type>& types,
            const shared_ptr<GetLogCallbackInterface> callback);
    virtual HandlerKey UpdateFirmware(const shared_ptr<const string> new_firmware,
        const shared_ptr<SimpleCallbackInterface> callback);
+2 −2
Original line number Diff line number Diff line
@@ -291,9 +291,9 @@ KineticStatus BlockingKineticConnection::GetLog(unique_ptr<DriveLog>& drive_log)
    return RunOperation(callback, nonblocking_connection_->GetLog(callback));
}

KineticStatus BlockingKineticConnection::GetLog(Command_GetLog_Type type, unique_ptr<DriveLog>& drive_log) {
KineticStatus BlockingKineticConnection::GetLog(const vector<Command_GetLog_Type>& types, unique_ptr<DriveLog>& drive_log) {
    auto callback = make_shared<GetLogCallback>(drive_log);
    return RunOperation(callback, nonblocking_connection_->GetLog(type, callback));
    return RunOperation(callback, nonblocking_connection_->GetLog(types, callback));
}

KineticStatus BlockingKineticConnection::UpdateFirmware(const shared_ptr<const string>
+14 −18
Original line number Diff line number Diff line
@@ -490,33 +490,29 @@ HandlerKey NonblockingKineticConnection::SetClusterVersion(int64_t new_cluster_v

HandlerKey NonblockingKineticConnection::GetLog(
        const shared_ptr<GetLogCallbackInterface> callback) {
    vector<Command_GetLog_Type> types;
    types.push_back(Command_GetLog_Type_UTILIZATIONS);
    types.push_back(Command_GetLog_Type_TEMPERATURES);
    types.push_back(Command_GetLog_Type_CAPACITIES);
    types.push_back(Command_GetLog_Type_CONFIGURATION);
    types.push_back(Command_GetLog_Type_STATISTICS);
    types.push_back(Command_GetLog_Type_MESSAGES);
    types.push_back(Command_GetLog_Type_LIMITS);

    unique_ptr<Message> msg(new Message());
    msg->set_authtype(Message_AuthType_HMACAUTH);
    unique_ptr<Command> request = NewCommand(Command_MessageType_GETLOG);

    auto mutable_getlog = request->mutable_body()->mutable_getlog();
    mutable_getlog->add_types(Command_GetLog_Type_UTILIZATIONS);
    mutable_getlog->add_types(Command_GetLog_Type_TEMPERATURES);
    mutable_getlog->add_types(Command_GetLog_Type_CAPACITIES);
    mutable_getlog->add_types(Command_GetLog_Type_CONFIGURATION);
    mutable_getlog->add_types(Command_GetLog_Type_STATISTICS);
    mutable_getlog->add_types(Command_GetLog_Type_MESSAGES);
    mutable_getlog->add_types(Command_GetLog_Type_LIMITS);

    unique_ptr<GetLogHandler> handler(new GetLogHandler(callback));
    return service_->Submit(move(msg), move(request), empty_str_, move(handler));
    return GetLog(types, callback);
}

HandlerKey NonblockingKineticConnection::GetLog(Command_GetLog_Type type,
HandlerKey NonblockingKineticConnection::GetLog(const vector<Command_GetLog_Type>& types,
        const shared_ptr<GetLogCallbackInterface> callback) {

    unique_ptr<Message> msg(new Message());
    msg->set_authtype(Message_AuthType_HMACAUTH);
    unique_ptr<Command> request = NewCommand(Command_MessageType_GETLOG);

    for(auto type : types){
        auto mutable_getlog = request->mutable_body()->mutable_getlog();
        mutable_getlog->add_types(type);
    }

    unique_ptr<GetLogHandler> handler(new GetLogHandler(callback));
    return service_->Submit(move(msg), move(request), empty_str_, move(handler));