Commit 8bf64242 authored by Paul Lensing's avatar Paul Lensing
Browse files

Feature: Added partial getlog capability to kinetic-cpp interface.

parent 747726af
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ using std::vector;
class KeyRangeIterator;
class BlockingCallbackState;


class BlockingKineticConnection {
    public:
    /// Takes ownership of the given NonblockingKineticConnection
@@ -157,6 +158,8 @@ class BlockingKineticConnection {

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

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

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

    virtual KineticStatus SetACLs(const shared_ptr<const list<ACL>> acls);
+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ using com::seagate::kinetic::client::proto::Command;
using com::seagate::kinetic::client::proto::Command_MessageType;
using com::seagate::kinetic::client::proto::Command_P2POperation;
using com::seagate::kinetic::client::proto::Command_Synchronization;
using com::seagate::kinetic::client::proto::Command_GetLog_Type;

using std::shared_ptr;
using std::unique_ptr;
@@ -289,6 +290,8 @@ 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,
            const shared_ptr<GetLogCallbackInterface> callback);
    virtual HandlerKey UpdateFirmware(const shared_ptr<const string> new_firmware,
        const shared_ptr<SimpleCallbackInterface> callback);
    virtual HandlerKey SetACLs(const shared_ptr<const list<ACL>> acls,
+5 −0
Original line number Diff line number Diff line
@@ -291,6 +291,11 @@ 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) {
    auto callback = make_shared<GetLogCallback>(drive_log);
    return RunOperation(callback, nonblocking_connection_->GetLog(type, callback));
}

KineticStatus BlockingKineticConnection::UpdateFirmware(const shared_ptr<const string>
        new_firmware) {
    auto callback = make_shared<SimpleCallback>();
+14 −0
Original line number Diff line number Diff line
@@ -508,6 +508,20 @@ HandlerKey NonblockingKineticConnection::GetLog(
    return service_->Submit(move(msg), move(request), empty_str_, move(handler));
}

HandlerKey NonblockingKineticConnection::GetLog(Command_GetLog_Type type,
        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);

    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));
}

HandlerKey NonblockingKineticConnection::UpdateFirmware(
        const shared_ptr<const string> new_firmware,
        const shared_ptr<SimpleCallbackInterface> callback) {