Пример #1
0
void *
rbdfs_init(struct fuse_conn_info *conn)
{
    int ret;

    // init cannot fail, so if we fail here, gotrados remains at 0,
    // causing other operations to fail immediately with ENXIO

    ret = connect_to_cluster(&cluster);
    if (ret < 0)
        exit(90);

    pool_name = rbd_options.pool_name;
    mount_image_name = rbd_options.image_name;
    ret = rados_ioctx_create(cluster, pool_name, &ioctx);
    if (ret < 0)
        exit(91);
#if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8)
    conn->want |= FUSE_CAP_BIG_WRITES;
#endif
    gotrados = 1;

    // init's return value shows up in fuse_context.private_data,
    // also to void (*destroy)(void *); useful?
    return NULL;
}
JniNdbEventStreamingImp::JniNdbEventStreamingImp(JNIEnv *env,jboolean jIsLeader, jstring jConnectionString,
        jstring jDatabaseName){
  LOG_INFO("start table tailers");
  mPollMaxTimeToWait=100;
  const char *connectionString=env->GetStringUTFChars(jConnectionString, 0);
  mClusterConnection = connect_to_cluster(connectionString);

  const char *databaseName=env->GetStringUTFChars(jDatabaseName, 0);

  JavaVM* jvm;
  env->GetJavaVM(&jvm);

  isLeader=(bool) jIsLeader;
  
  if(isLeader){
    Ndb* rmnode_tailer_connection = create_ndb_connection(databaseName);
    rmNodeTailer = new RMNodeTableTailer(rmnode_tailer_connection, mPollMaxTimeToWait,jvm);
    rmNodeTailer->start();
    
    Ndb* pendingEvent_tailer_connection = create_ndb_connection(databaseName);
    pendingEventTailer = new PendingEventTableTailer(pendingEvent_tailer_connection, mPollMaxTimeToWait,jvm);
    pendingEventTailer->start();
    
    Ndb* resource_tailer_connection = create_ndb_connection(databaseName);
    resourceTailer = new ResourceTableTailer(resource_tailer_connection, mPollMaxTimeToWait,jvm);
    resourceTailer->start();
    
    Ndb* updatedContainerInfo_tailer_connection = create_ndb_connection(databaseName);
    updatedContainerInfoTailer = new UpdatedContainerInfoTableTailer(updatedContainerInfo_tailer_connection, mPollMaxTimeToWait,jvm);
    updatedContainerInfoTailer->start();
    
    Ndb* containerStatus_tailer_connection = create_ndb_connection(databaseName);
    containerStatusTailer = new ContainerStatusTableTailer(containerStatus_tailer_connection, mPollMaxTimeToWait,jvm);
    containerStatusTailer->start();
  }else{
    Ndb* containerIdToClean_tailer_connection = create_ndb_connection(databaseName);
    containerIdToCleanTailer = new ContainerIdToCleanTableTailer(containerIdToClean_tailer_connection, mPollMaxTimeToWait,jvm);
    containerIdToCleanTailer->start();

    Ndb* containerToSignal_tailer_connection = create_ndb_connection(databaseName);
    containerToSignalTailer = new ContainerToSignalTableTailer(containerToSignal_tailer_connection, mPollMaxTimeToWait,jvm);
    containerToSignalTailer->start();

    Ndb* containerToDecrease_tailer_connection = create_ndb_connection(databaseName);
    containerToDecreaseTailer = new ContainerToDecreaseTableTailer(containerToDecrease_tailer_connection, mPollMaxTimeToWait,jvm);
    containerToDecreaseTailer->start();

    Ndb* nextHeartBeat_tailer_connection = create_ndb_connection(databaseName);
    nextHeartBeatTailer = new NextHeartBeatTableTailer(nextHeartBeat_tailer_connection, mPollMaxTimeToWait,jvm);
    nextHeartBeatTailer->start();

    Ndb* rmNodeApplications_tailer_connection = create_ndb_connection(databaseName);
    rmNodeApplicationsTailer = new RmNodeApplicationsTableTailer(rmNodeApplications_tailer_connection, mPollMaxTimeToWait,jvm);
    rmNodeApplicationsTailer->start();
  }
}
Пример #3
0
Notifier::Notifier(const char* connection_string, const char* database_name, const char* meta_database_name,
        const TableUnitConf mutations_tu, const TableUnitConf metadata_tu, const TableUnitConf schemaless_tu,
        const int poll_maxTimeToWait, const string elastic_ip, const bool hopsworks, const string elastic_index, 
        const string elasttic_project_type, const string elastic_dataset_type, const string elastic_inode_type,
        const int elastic_batch_size, const int elastic_issue_time, const int lru_cap, const bool recovery, 
        const bool stats, MetadataType metadata_type)
: mDatabaseName(database_name), mMetaDatabaseName(meta_database_name), mMutationsTU(mutations_tu), mMetadataTU(metadata_tu), 
        mSchemalessTU(schemaless_tu), mPollMaxTimeToWait(poll_maxTimeToWait), mElasticAddr(elastic_ip), mHopsworksEnabled(hopsworks),
        mElasticIndex(elastic_index), mElastticProjectType(elasttic_project_type), mElasticDatasetType(elastic_dataset_type), 
        mElasticInodeType(elastic_inode_type), mElasticBatchsize(elastic_batch_size), mElasticIssueTime(elastic_issue_time), mLRUCap(lru_cap), 
        mRecovery(recovery), mStats(stats), mMetadataType(metadata_type) {
    mClusterConnection = connect_to_cluster(connection_string);
    setup();
}