Java Code Examples for org.apache.accumulo.core.data.ColumnUpdate#getTimestamp()

The following examples show how to use org.apache.accumulo.core.data.ColumnUpdate#getTimestamp() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: buggyMockTable.java    From coming with MIT License 6 votes vote down vote up
synchronized void addMutation(Mutation m) {
  long now = System.currentTimeMillis();
  mutationCount++;
  for (ColumnUpdate u : m.getUpdates()) {
    Key key = new Key(m.getRow(), 0, m.getRow().length, u.getColumnFamily(), 0, u.getColumnFamily().length, u.getColumnQualifier(), 0,
        u.getColumnQualifier().length, u.getColumnVisibility(), 0, u.getColumnVisibility().length, u.getTimestamp());
    if (u.isDeleted())
      key.setDeleted(true);
    if (!u.hasTimestamp())
      if (timeType.equals(TimeType.LOGICAL))
        key.setTimestamp(mutationCount);
      else
        key.setTimestamp(now);
    
    table.put(new MockMemKey(key, mutationCount), new Value(u.getValue()));
  }
}
 
Example 2
Source File: humanMockTable.java    From coming with MIT License 6 votes vote down vote up
synchronized void addMutation(Mutation m) {
  long now = System.currentTimeMillis();
  mutationCount++;
  for (ColumnUpdate u : m.getUpdates()) {
    Key key = new Key(m.getRow(), 0, m.getRow().length, u.getColumnFamily(), 0, u.getColumnFamily().length, u.getColumnQualifier(), 0,
        u.getColumnQualifier().length, u.getColumnVisibility(), 0, u.getColumnVisibility().length, u.getTimestamp());
    if (u.isDeleted())
      key.setDeleted(true);
    if (!u.hasTimestamp())
      if (timeType.equals(TimeType.LOGICAL))
        key.setTimestamp(mutationCount);
      else
        key.setTimestamp(now);
    
    table.put(new MockMemKey(key, mutationCount), new Value(u.getValue()));
  }
}
 
Example 3
Source File: DownsampleIteratorTest.java    From timely with Apache License 2.0 5 votes vote down vote up
private void createTestData1() {
    List<Tag> tags = Collections.singletonList(new Tag("host", "host1"));

    for (long i = 0; i < 1000; i += 100) {
        Metric m = new Metric("sys.loadAvg", i, .2, tags);
        Mutation mutation = MetricAdapter.toMutation(m);
        for (ColumnUpdate cu : mutation.getUpdates()) {
            Key key = new Key(mutation.getRow(), cu.getColumnFamily(), cu.getColumnQualifier(),
                    cu.getColumnVisibility(), cu.getTimestamp());
            System.out.println(key.toString());
            testData1.put(key, new Value(cu.getValue()));
        }
    }
}
 
Example 4
Source File: DownsampleIteratorTest.java    From timely with Apache License 2.0 5 votes vote down vote up
void put(Map<Key, Value> testData, Metric m) {
    Mutation mutation = MetricAdapter.toMutation(m);
    for (ColumnUpdate cu : mutation.getUpdates()) {
        Key key = new Key(mutation.getRow(), cu.getColumnFamily(), cu.getColumnQualifier(),
                cu.getColumnVisibility(), cu.getTimestamp());
        testData.put(key, new Value(cu.getValue()));
    }
}