public Notification(Bytes row, Column col, long ts) { rowCol = new RowColumn(row, col); this.timestamp = ts; }
public Notification(Bytes row, Column col, long ts) { rowCol = new RowColumn(row, col); this.timestamp = ts; }
public RowColumn getRowColumn() { return new RowColumn(row, col); }
public RowColumn getRowColumn() { return new RowColumn(row, col); }
@Test public void testGetRowColumns() { ensureReadLocksSet(txr -> { // ensure this operation sets two read locks Map<RowColumn, String> vals = txr.withReadLock().gets(ImmutableList.of(new RowColumn("test1", c1), new RowColumn("test1", c2), new RowColumn("test2", c1), new RowColumn("test2", c2))); txr.set(vals.get(new RowColumn("test1", c1)), invCol, "test1"); txr.set(vals.get(new RowColumn("test1", c2)), invCol, "test1"); txr.set(vals.get(new RowColumn("test2", c1)), invCol, "test2"); txr.set(vals.get(new RowColumn("test2", c2)), invCol, "test2"); }); }
/** * Creates a Span that covers an exact row and {@link Column}. The {@link Column} passed to this * method can be constructed without a qualifier or visibility to create a Span at the family or * qualifier level. */ public static Span exact(Bytes row, Column col) { Objects.requireNonNull(row); Objects.requireNonNull(col); RowColumn start = new RowColumn(row, col); return new Span(start, true, start.following(), false); }
/** * Creates a Span that covers an exact row and {@link Column}. The {@link Column} passed to this * method can be constructed without a qualifier or visibility to create a Span at the family or * qualifier level. */ public static Span exact(Bytes row, Column col) { Objects.requireNonNull(row); Objects.requireNonNull(col); RowColumn start = new RowColumn(row, col); return new Span(start, true, start.following(), false); }
@Override public SpanBatchDeleteInformation deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject json = element.getAsJsonObject(); int batchSize = json.get("batchSize").getAsInt(); String[] colArray = json.get("column").getAsString().split("\u0000"); Column column = new Column(colArray[0], colArray[1]); String[] rows = json.get("span").getAsString().split("\u0000"); boolean startInc = json.get("startInc").getAsBoolean(); boolean endInc = json.get("endInc").getAsBoolean(); Span span = new Span(new RowColumn(rows[0]), startInc, new RowColumn(rows[1]), endInc); String nodeId = json.get("nodeId").getAsString(); Optional<String> id = Optional.empty(); if (!nodeId.isEmpty()) { id = Optional.of(nodeId); } return SpanBatchDeleteInformation.builder().setNodeId(id).setBatchSize(batchSize).setSpan(span).setColumn(column).build(); }
@Override public SpanBatchDeleteInformation deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject json = element.getAsJsonObject(); int batchSize = json.get("batchSize").getAsInt(); String[] colArray = json.get("column").getAsString().split("\u0000"); Column column = new Column(colArray[0], colArray[1]); String[] rows = json.get("span").getAsString().split("\u0000"); boolean startInc = json.get("startInc").getAsBoolean(); boolean endInc = json.get("endInc").getAsBoolean(); Span span = new Span(new RowColumn(rows[0]), startInc, new RowColumn(rows[1]), endInc); String nodeId = json.get("nodeId").getAsString(); Optional<String> id = Optional.empty(); if (!nodeId.isEmpty()) { id = Optional.of(nodeId); } return SpanBatchDeleteInformation.builder().setNodeId(id).setBatchSize(batchSize).setSpan(span).setColumn(column).build(); }
@Override public Map<RowColumn, Bytes> get(Collection<RowColumn> rowColumns) { checkIfOpen(); if (rowColumns.isEmpty()) { return Collections.emptyMap(); } ParallelSnapshotScanner pss = new ParallelSnapshotScanner(rowColumns, env, startTs, stats, readLocksSeen); Map<Bytes, Map<Column, Bytes>> scan = pss.scan(); Map<RowColumn, Bytes> ret = new HashMap<>(); for (Entry<Bytes, Map<Column, Bytes>> entry : scan.entrySet()) { updateColumnsRead(entry.getKey(), entry.getValue().keySet()); for (Entry<Column, Bytes> colVal : entry.getValue().entrySet()) { ret.put(new RowColumn(entry.getKey(), colVal.getKey()), colVal.getValue()); } } return ret; }
@Override public Map<RowColumn, Bytes> get(Collection<RowColumn> rowColumns) { checkIfOpen(); if (rowColumns.size() == 0) { return Collections.emptyMap(); } ParallelSnapshotScanner pss = new ParallelSnapshotScanner(rowColumns, env, startTs, stats, readLocksSeen); Map<Bytes, Map<Column, Bytes>> scan = pss.scan(); Map<RowColumn, Bytes> ret = new HashMap<>(); for (Entry<Bytes, Map<Column, Bytes>> entry : scan.entrySet()) { updateColumnsRead(entry.getKey(), entry.getValue().keySet()); for (Entry<Column, Bytes> colVal : entry.getValue().entrySet()) { ret.put(new RowColumn(entry.getKey(), colVal.getKey()), colVal.getValue()); } } return ret; }
@Override public JoinBatchInformation deserialize(final JsonElement element, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { final JsonObject json = element.getAsJsonObject(); final int batchSize = json.get("batchSize").getAsInt(); final Task task = Task.valueOf(json.get("task").getAsString()); final String[] colArray = json.get("column").getAsString().split("\u0000"); final Column column = new Column(colArray[0], colArray[1]); final String[] rows = json.get("span").getAsString().split("\u0000"); final boolean startInc = json.get("startInc").getAsBoolean(); final boolean endInc = json.get("endInc").getAsBoolean(); final Span span = new Span(new RowColumn(rows[0]), startInc, new RowColumn(rows[1]), endInc); final VariableOrder updateVarOrder = new VariableOrder(json.get("updateVarOrder").getAsString()); final VisibilityBindingSet bs = converter.convert(json.get("bindingSet").getAsString(), updateVarOrder); final Side side = Side.valueOf(json.get("side").getAsString()); final JoinType join = JoinType.valueOf(json.get("joinType").getAsString()); return JoinBatchInformation.builder().setBatchSize(batchSize).setTask(task).setSpan(span).setColumn(column).setBs(bs) .setSide(side).setJoinType(join).build(); }
private static RowColumn buildRowColumn(KeyBuilder key) { if (key.infinite || key.row.equals(Bytes.EMPTY)) { return RowColumn.EMPTY; } else if (key.cf.equals(Bytes.EMPTY)) { return new RowColumn(key.row); } else if (key.cq.equals(Bytes.EMPTY)) { return new RowColumn(key.row, new Column(key.cf)); } else if (key.cv.equals(Bytes.EMPTY)) { return new RowColumn(key.row, new Column(key.cf, key.cq)); } return new RowColumn(key.row, new Column(key.cf, key.cq, key.cv)); }
@Override public JoinBatchInformation deserialize(final JsonElement element, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { final JsonObject json = element.getAsJsonObject(); final int batchSize = json.get("batchSize").getAsInt(); final Task task = Task.valueOf(json.get("task").getAsString()); final String[] colArray = json.get("column").getAsString().split("\u0000"); final Column column = new Column(colArray[0], colArray[1]); final String[] rows = json.get("span").getAsString().split("\u0000"); final boolean startInc = json.get("startInc").getAsBoolean(); final boolean endInc = json.get("endInc").getAsBoolean(); final Span span = new Span(new RowColumn(rows[0]), startInc, new RowColumn(rows[1]), endInc); final VariableOrder updateVarOrder = new VariableOrder(json.get("updateVarOrder").getAsString()); final VisibilityBindingSet bs = converter.convert(json.get("bindingSet").getAsString(), updateVarOrder); final Side side = Side.valueOf(json.get("side").getAsString()); final JoinType join = JoinType.valueOf(json.get("joinType").getAsString()); return JoinBatchInformation.builder().setBatchSize(batchSize).setTask(task).setSpan(span).setColumn(column).setBs(bs) .setSide(side).setJoinType(join).build(); }
private static RowColumn buildRowColumn(KeyBuilder key) { if (key.infinite || key.row.equals(Bytes.EMPTY)) { return RowColumn.EMPTY; } else if (key.cf.equals(Bytes.EMPTY)) { return new RowColumn(key.row); } else if (key.cq.equals(Bytes.EMPTY)) { return new RowColumn(key.row, new Column(key.cf)); } else if (key.cv.equals(Bytes.EMPTY)) { return new RowColumn(key.row, new Column(key.cf, key.cq)); } return new RowColumn(key.row, new Column(key.cf, key.cq, key.cv)); }
/** * Returns a map of RowColumn changes given an operation */ public Map<RowColumn, Bytes> getOperationMap(LogEntry.Operation op) { Map<RowColumn, Bytes> opMap = new HashMap<>(); for (LogEntry entry : logEntries) { if (entry.getOp().equals(op)) { opMap.put(new RowColumn(entry.getRow(), entry.getColumn()), entry.getValue()); } } return opMap; } }
@Test public void testRowColumn() { final TestTransaction tx1 = new TestTransaction(env); tx1.set("node1", new Column("edge", "node2"), ""); tx1.set("node1", new Column("edge", "node3"), ""); tx1.set("node3", new Column("edge", "node4"), ""); tx1.set("node5", new Column("edge", "node7"), ""); tx1.set("node5", new Column("edge", "node2"), ""); tx1.set("node5", new Column("edge", "node8"), ""); tx1.done(); final TestTransaction tx2 = new TestTransaction(env); ArrayList<RowColumn> newEdges = new ArrayList<>(); newEdges.add(new RowColumn("node1", new Column("edge", "node3"))); newEdges.add(new RowColumn("node5", new Column("edge", "node2"))); newEdges.add(new RowColumn("node5", new Column("edge", "node9"))); newEdges.add(new RowColumn("node1", new Column("edge", "node8"))); newEdges.add(new RowColumn("node8", new Column("edge", "node3"))); newEdges.add(new RowColumn("node5", new Column("edge", "node7"))); final Map<RowColumn, String> existing = tx2.gets(newEdges); tx2.done(); HashSet<RowColumn> expected = new HashSet<>(); expected.add(new RowColumn("node1", new Column("edge", "node3"))); expected.add(new RowColumn("node5", new Column("edge", "node2"))); expected.add(new RowColumn("node5", new Column("edge", "node7"))); Assert.assertEquals(expected, existing.keySet()); }
public Iterator<ExportEntry> getExportIterator(Bytes continueRow) { Span span; if (continueRow != null) { Span tmpSpan = Span.prefix(bucketRow); Span nextSpan = new Span(new RowColumn(continueRow, EXPORT_COL), true, tmpSpan.getEnd(), tmpSpan.isEndInclusive()); span = nextSpan; } else { span = Span.prefix(bucketRow); } CellScanner scanner = ttx.scanner().over(span).fetch(EXPORT_COL).build(); return new ExportIterator(scanner); }
/** * Returns a RowColumn following the current one * * @return RowColumn following this one */ public RowColumn following() { if (row.equals(Bytes.EMPTY)) { return RowColumn.EMPTY; } else if (col.equals(Column.EMPTY)) { return new RowColumn(followingBytes(row)); } else if (!col.isQualifierSet()) { return new RowColumn(row, new Column(followingBytes(col.getFamily()))); } else if (!col.isVisibilitySet()) { return new RowColumn(row, new Column(col.getFamily(), followingBytes(col.getQualifier()))); } else { return new RowColumn(row, new Column(col.getFamily(), col.getQualifier(), followingBytes(col.getVisibility()))); } }
/** * Returns a RowColumn following the current one * * @return RowColumn following this one */ public RowColumn following() { if (row.equals(Bytes.EMPTY)) { return RowColumn.EMPTY; } else if (col.equals(Column.EMPTY)) { return new RowColumn(followingBytes(row)); } else if (!col.isQualifierSet()) { return new RowColumn(row, new Column(followingBytes(col.getFamily()))); } else if (!col.isVisibilitySet()) { return new RowColumn(row, new Column(col.getFamily(), followingBytes(col.getQualifier()))); } else { return new RowColumn(row, new Column(col.getFamily(), col.getQualifier(), followingBytes(col.getVisibility()))); } }