@Override public void setWeakNotification(Bytes row, Column col) { checkIfOpen(); Preconditions.checkNotNull(row); Preconditions.checkNotNull(col); if (!env.getWeakObservers().containsKey(col)) { throw new IllegalArgumentException("Column not configured for weak notifications " + col); } env.getSharedResources().getVisCache().validate(col); Set<Column> columns = weakNotifications.get(row); if (columns == null) { columns = new HashSet<>(); weakNotifications.put(row, columns); } columns.add(col); }
static ColumnVisibility gv(Environment env, Column col) { return env.getSharedResources().getVisCache().getCV(col); }
@Override public Map<Bytes, Map<Column, Bytes>> get(Collection<Bytes> rows, Set<Column> columns) { checkIfOpen(); if (rows.size() == 0 || columns.size() == 0) { return Collections.emptyMap(); } env.getSharedResources().getVisCache().validate(columns); ParallelSnapshotScanner pss = new ParallelSnapshotScanner(rows, columns, env, startTs, stats); Map<Bytes, Map<Column, Bytes>> ret = pss.scan(); for (Entry<Bytes, Map<Column, Bytes>> entry : ret.entrySet()) { updateColumnsRead(entry.getKey(), entry.getValue().keySet()); } return ret; }
@Override public void set(Bytes row, Column col, Bytes value) throws AlreadySetException { checkIfOpen(); Preconditions.checkNotNull(row); Preconditions.checkNotNull(col); Preconditions.checkNotNull(value); if (col.getFamily().equals(ColumnConstants.NOTIFY_CF)) { throw new IllegalArgumentException(ColumnConstants.NOTIFY_CF + " is a reserved family"); } env.getSharedResources().getVisCache().validate(col); // TODO copy? Map<Column, Bytes> colUpdates = updates.get(row); if (colUpdates == null) { colUpdates = new HashMap<>(); updates.put(row, colUpdates); } if (colUpdates.get(col) != null) { throw new AlreadySetException("Value already set " + row + " " + col); } colUpdates.put(col, value); }
private Map<Column, Bytes> getImpl(Bytes row, Set<Column> columns) { // TODO push visibility filtering to server side? env.getSharedResources().getVisCache().validate(columns); ScannerConfiguration config = new ScannerConfiguration(); config.setSpan(Span.exact(row)); for (Column column : columns) { config.fetchColumn(column.getFamily(), column.getQualifier()); } RowIterator iter = getImpl(config); Map<Column, Bytes> ret = new HashMap<>(); while (iter.hasNext()) { Entry<Bytes, ColumnIterator> entry = iter.next(); ColumnIterator citer = entry.getValue(); while (citer.hasNext()) { Entry<Column, Bytes> centry = citer.next(); if (columns.contains(centry.getKey())) { ret.put(centry.getKey(), centry.getValue()); } } } // only update columns read after successful read updateColumnsRead(row, columns); return ret; }
public static void put(Environment env, Mutation m, Column col, long ts) { ColumnVisibility cv = env.getSharedResources().getVisCache().getCV(col); m.put(ColumnConstants.NOTIFY_CF.toArray(), encodeCol(col), cv, encodeTs(ts, false), TransactionImpl.EMPTY); }
public FluoCondition(Environment env, Column col) { super(ByteUtil.toByteSequence(col.getFamily()), ByteUtil.toByteSequence(col.getQualifier())); if (col.getVisibility().length() > 0) { setVisibility(env.getSharedResources().getVisCache().getCV(col)); } }
public Flutation newDelete(Environment env, long ts) { Flutation m = new Flutation(env, getRow()); ColumnVisibility cv = env.getSharedResources().getVisCache().getCV(getColumn()); m.put(ColumnConstants.NOTIFY_CF.toArray(), encodeCol(getColumn()), cv, encodeTs(ts, true), TransactionImpl.EMPTY); return m; }
public static void put(Environment env, Mutation m, Column col, long ts, byte[] val) { ColumnVisibility cv; if (env != null) { cv = env.getSharedResources().getVisCache().getCV(col.getVisibility()); } else if (col.getVisibility().length() == 0) { cv = VisibilityCache.EMPTY_VIS; } else { cv = new ColumnVisibility(ByteUtil.toText(col.getVisibility())); } m.put(ByteUtil.toText(col.getFamily()), ByteUtil.toText(col.getQualifier()), cv, ts, new Value( val)); } }