cpp/src/plasma/client.cc
// This method is used to query whether the plasma store contains an object.
This method is used to query whether the plasma store contains an object.
This method is used to query whether the plasma store contains an object .
Status PlasmaClient::Impl::Contains(const ObjectID& object_id, bool* has_object) {
  std::lock_guard<std::recursive_mutex> guard(client_mutex_);
  if (objects_in_use_.count(object_id) > 0) {
    *has_object = 1;
  } else {
    RETURN_NOT_OK(SendContainsRequest(store_conn_, object_id));
    std::vector<uint8_t> buffer;
    RETURN_NOT_OK(PlasmaReceive(store_conn_, MessageType::PlasmaContainsReply, &buffer));
    ObjectID object_id2;
    DCHECK_GT(buffer.size(), 0);
    RETURN_NOT_OK(
        ReadContainsReply(buffer.data(), buffer.size(), &object_id2, has_object));
  }
  return Status::OK();
}
Status PlasmaClient :: Impl :: Contains ( const ObjectID & object_id , bool * has_object ) { std :: lock_guard < std :: recursive_mutex > guard ( client_mutex_ ) ; if ( objects_in_use_ . count ( object_id ) > 0 ) { * has_object = 1 ; } else { RETURN_NOT_OK ( SendContainsRequest ( store_conn_ , object_id ) ) ; std :: vector < uint8_t > buffer ; RETURN_NOT_OK ( PlasmaReceive ( store_conn_ , MessageType :: PlasmaContainsReply , & buffer ) ) ; ObjectID object_id2 ; DCHECK_GT ( buffer . size ( ) , 0 ) ; RETURN_NOT_OK ( ReadContainsReply ( buffer . data ( ) , buffer . size ( ) , & object_id2 , has_object ) ) ; } return Status :: OK ( ) ; }
This method is used to query whether the plasma store contains an object.
This method is used to query whether the plasma store contains an object .
// Check if we already have a reference to the object. // If we don't already have a reference to the object, check with the store // to see if we have the object.