<commit_before>// Copyright 2009 <NAME>.
// This source comes from the XtreemFS project. It is licensed under the GPLv2 (see COPYING for terms and conditions).

#include "org/xtreemfs/client/volume.h"
#include "org/xtreemfs/client/file.h"
#include "org/xtreemfs/client/osd_proxy.h"
#include "org/xtreemfs/client/path.h"
using namespace org::xtreemfs::client;

#ifdef _WIN32
#pragma warning( push )
#pragma warning( disable: 4100 )
#endif
#include "org/xtreemfs/interfaces/mrc_interface.h"
#ifdef _WIN32
#pragma warning( pop )
#endif

#include <errno.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/statvfs.h>
#endif


#define ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_BEGIN( OperationName ) \
  try

#define ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_END( OperationName ) \
  catch ( ProxyExceptionResponse& proxy_exception_response ) \
  { \
    set_errno( #OperationName, proxy_exception_response ); \
  } \
  catch ( std::exception& exc ) \
  { \
    set_errno( #OperationName, exc ); \
  } \


Volume::Volume( const YIELD::URI& dir_uri, const std::string& name, uint32_t flags, YIELD::auto_Log log, YIELD::auto_Object<YIELD::SSLContext> ssl_context, bool trace_socket_io )
  : name( name ), flags( flags ), log( log )
{
  YIELD::auto_Object<YIELD::StageGroup> stage_group = new YIELD::SEDAStageGroup( name.c_str() );
  dir_proxy = DIRProxy::create( dir_uri, stage_group, trace_socket_io ? log : NULL, DIRProxy::OPERATION_RETRIES_MAX_DEFAULT, 10 * NS_IN_S, ssl_context );

  YIELD::auto_Object<YIELD::URI> mrc_uri = dir_proxy->getVolumeURIFromVolumeName( name );
  mrc_proxy = MRCProxy::create( *mrc_uri, stage_group, trace_socket_io ? log : NULL, MRCProxy::OPERATION_RETRIES_MAX_DEFAULT, 10 * NS_IN_S, ssl_context );

  osd_proxy_mux = OSDProxyMux::create( dir_proxy, stage_group, trace_socket_io ? log : NULL, OSDProxy::OPERATION_RETRIES_MAX_DEFAULT, 10 * NS_IN_S, ssl_context );
}

bool Volume::access( const YIELD::Path& path, int amode )
{
  ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_BEGIN( access )
  {
    return mrc_proxy->access( Path( this->name, path ), amode );
  }
  ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_END( access );
  return false;
}

bool Volume::chmod( const YIELD::Path& path, mode_t mode )
{<commit_msg>client: volume.cpp: return true on access()<commit_after>// Copyright 2009 <NAME>.
// This source comes from the XtreemFS project. It is licensed under the GPLv2 (see COPYING for terms and conditions).

#include "org/xtreemfs/client/volume.h"
#include "org/xtreemfs/client/file.h"
#include "org/xtreemfs/client/osd_proxy.h"
#include "org/xtreemfs/client/path.h"
using namespace org::xtreemfs::client;

#ifdef _WIN32
#pragma warning( push )
#pragma warning( disable: 4100 )
#endif
#include "org/xtreemfs/interfaces/mrc_interface.h"
#ifdef _WIN32
#pragma warning( pop )
#endif

#include <errno.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/statvfs.h>
#endif


#define ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_BEGIN( OperationName ) \
  try

#define ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_END( OperationName ) \
  catch ( ProxyExceptionResponse& proxy_exception_response ) \
  { \
    set_errno( #OperationName, proxy_exception_response ); \
  } \
  catch ( std::exception& exc ) \
  { \
    set_errno( #OperationName, exc ); \
  } \


Volume::Volume( const YIELD::URI& dir_uri, const std::string& name, uint32_t flags, YIELD::auto_Log log, YIELD::auto_Object<YIELD::SSLContext> ssl_context, bool trace_socket_io )
  : name( name ), flags( flags ), log( log )
{
  YIELD::auto_Object<YIELD::StageGroup> stage_group = new YIELD::SEDAStageGroup( name.c_str() );
  dir_proxy = DIRProxy::create( dir_uri, stage_group, trace_socket_io ? log : NULL, DIRProxy::OPERATION_RETRIES_MAX_DEFAULT, 10 * NS_IN_S, ssl_context );

  YIELD::auto_Object<YIELD::URI> mrc_uri = dir_proxy->getVolumeURIFromVolumeName( name );
  mrc_proxy = MRCProxy::create( *mrc_uri, stage_group, trace_socket_io ? log : NULL, MRCProxy::OPERATION_RETRIES_MAX_DEFAULT, 10 * NS_IN_S, ssl_context );

  osd_proxy_mux = OSDProxyMux::create( dir_proxy, stage_group, trace_socket_io ? log : NULL, OSDProxy::OPERATION_RETRIES_MAX_DEFAULT, 10 * NS_IN_S, ssl_context );
}

bool Volume::access( const YIELD::Path& path, int amode )
{
  ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_BEGIN( access )
  {
    return true;
    // return mrc_proxy->access( Path( this->name, path ), amode );
  }
  ORG_XTREEMFS_CLIENT_VOLUME_OPERATION_END( access );
  return false;
}

bool Volume::chmod( const YIELD::Path& path, mode_t mode )
{
{'fraction_non_alphanumeric': 0.1220489977728285, 'fraction_numerical': 0.010244988864142539, 'mean_word_length': 5.508695652173913, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2641900', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1684, 'n_words': 347}