示例#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");
}
示例#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;
}
示例#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");
}