Ejemplo n.º 1
0
bool SNetStorageByKeyRPC::Exists(const string& key, TNetStorageFlags flags)
{
    CJsonNode request(m_NetStorageRPC->MkObjectRequest("EXISTS", key, flags));

    return m_NetStorageRPC->Exchange(m_NetStorageRPC->m_Service,
            request).GetBoolean("Exists");
}
Ejemplo n.º 2
0
ENetStorageRemoveResult SNetStorageByKeyRPC::Remove(const string& key,
        TNetStorageFlags flags)
{
    m_NetStorageRPC->m_UseNextSubHitID.ProperCommand();
    CJsonNode request(m_NetStorageRPC->MkObjectRequest("DELETE", key, flags));

    CJsonNode response(
            m_NetStorageRPC->Exchange(m_NetStorageRPC->m_Service, request));

    CJsonNode not_found(response.GetByKeyOrNull("NotFound"));

    return not_found && not_found.AsBoolean() ? eNSTRR_NotFound : eNSTRR_Removed;
}
Ejemplo n.º 3
0
string SNetStorageByKeyRPC::Relocate(const string& unique_key,
        TNetStorageFlags flags, TNetStorageFlags old_flags)
{
    m_NetStorageRPC->m_UseNextSubHitID.ProperCommand();
    CJsonNode request(m_NetStorageRPC->MkObjectRequest(
            "RELOCATE", unique_key, old_flags));

    CJsonNode new_location(CJsonNode::NewObjectNode());

    SNetStorageRPC::x_SetStorageFlags(new_location, flags);

    request.SetByKey("NewLocation", new_location);

    return m_NetStorageRPC->Exchange(m_NetStorageRPC->m_Service,
            request).GetString("ObjectLoc");
}