Package com.linkedin.databus.core.data_model

Examples of com.linkedin.databus.core.data_model.LogicalPartition


    String srcName = "srcName";
    int srcId = 1;
    PhysicalSource pS = pStatConf1.getPhysicalSource();
    PhysicalPartition pP = pStatConf1.getPhysicalPartition();
    _events = new TestDbusEvent [20];
    LogicalPartition lP = new LogicalPartition((short)0);
    for(int i=0; i<_events.length; i++) {
        _events[i] = new TestDbusEvent(i, scn,
                                       new LogicalSource(srcId, srcName+srcId),
                                       pS, pP, lP);
        switch(i) {
View Full Code Here


      DbusEventKey key = new DbusEventKey(e._key);
      //short lPartitionId = (short) (key.getLongKey() % Short.MAX_VALUE);
      String value = "" + i;
      short srcId = e._lSource.getId().shortValue();
      LogicalPartition lPart = e._lPartition;
      //System.out.print("appending events for i=" + i + "; lSource=" + srcId);
      short pPartitionId = _eventBufferMult.getPhysicalPartition(srcId, lPart).getId().shortValue();
      //System.out.println(";partitionid=" + pPartitionId);

      assertTrue(buf.appendEvent(key, pPartitionId, lPart.getId(), System.currentTimeMillis(), srcId,
                                 schema, value.getBytes(Charset.defaultCharset()), false, null));

      if(i%2 != 0)
        buf.endEvents(e._scn, null);
    }
View Full Code Here

        if(!DbusEventUtils.isControlSrcId(srcId)) { // not a control message
          numNonControlEventsRead++;
          Integer physicalPartitionId = (Integer)jsonMap.get("physicalPartitionId");
          Integer logicalPartitionId = (Integer)jsonMap.get("logicalPartitionId");
          PhysicalPartition pPartition = _eventBufferMult.getPhysicalPartition(srcId,
                                         new LogicalPartition(logicalPartitionId.shortValue()));
          LOG.info("EVENT: " + jsonMap.toString());
          assertTrue( srcIds.contains(srcId), "src id " + srcId + " doesn't match to " + inputSrcIds);
          assertEquals(physicalPartitionId, pPartition.getId(), "physical partition id didn't match");
        } else {
          LOG.info("Control event: " + jsonMap.toString());
View Full Code Here

    DbusEventBufferAppendable buf1 = _eventBufferMult.getDbusEventBufferAppendable(lSource);
    assertNotNull(buf1, "cannot get buffer by lSource " + lSource);
    assertTrue(buf1 == buf, "buf and buf1 should be the same buffer");

    // logical source, different logical partition 1 - SAME BUFFER
    LogicalPartition lPartition = new LogicalPartition((short)1);
    buf1 = _eventBufferMult.getDbusEventBufferAppendable(lSource, lPartition);
    // should be the same buffer
    assertNotNull(buf1, "cannot get buffer by lSource " + lSource + ";lPartition =" + lPartition);
    assertTrue(buf1 == buf, "buf and buf1 should be the same buffer");

    // logical source, different logical partition 2 - DIFFERENT BUFFER
    lPartition = new LogicalPartition((short)2);
    buf1 = _eventBufferMult.getDbusEventBufferAppendable(lSource, lPartition);
    assertNotNull(buf1, "cannot get buffer by lSource " + lSource + ";lPartition =" + lPartition);
    assertTrue(buf1 != buf, "buf and buf1 should not be the same buffer");

    // logical source, different logical partition 12 - DIFFERENT BUFFER (same as for lsr=2,lp=2)
View Full Code Here

  /** get physical partition corresponding to this src and DEFAULT logical partition */
  public PhysicalPartition getPhysicalPartition(int srcId ) {
    return getPhysicalPartition(
                         srcId,
                         new LogicalPartition(LogicalSourceConfig.DEFAULT_LOGICAL_SOURCE_PARTITION));
  }
View Full Code Here

      // and some can point to the same buf
      boolean debugEnabled = LOG.isDebugEnabled();
      for(int id: ids) {
        // figure out LogicalSource
        LogicalSource lSource = _logicalId2LogicalSource.get(id);
        LogicalPartition lPartition = null; // TBD - should be passed by caller
        if(lPartition == null)
          lPartition = LogicalPartition.createAllPartitionsWildcard(); // use wild card

        if (debugEnabled) LOG.debug("Streaming for logical source=" + lSource + "; partition=" +
                                    lPartition);

        List<LogicalPartitionKey> lpKeys = null;
        // for wild card - take all the source which id match (disregarding logical partition)
        if(lPartition.isAllPartitionsWildcard()) {
          lpKeys = new ArrayList<LogicalPartitionKey>(_logicalPKey2PhysicalPKey.size());
          for(LogicalPartitionKey lpKey : _logicalPKey2PhysicalPKey.keySet()) {
            if(lpKey.getLogicalSource().getId().equals(id)) {
              lpKeys.add(lpKey);
            }
View Full Code Here

    _id = id;
    _name = name;
    _uri = uri;
    _partitionFunction = partitionFunction;
    _source = new LogicalSource(Integer.valueOf(_id), _name)// SHOULD be name or uri?
    _partition = new LogicalPartition(partition);
    _skipInfinityScn = skipInfinityScn;
    _regularQueryHints = regularQueryHints;
    _chunkedTxnQueryHints = chunkedTxnQueryHints;
    _chunkedScnQueryHints = chunkedScnQueryHints;
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus.core.data_model.LogicalPartition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.