Search in sources :

Example 1 with Accept

use of cz.o2.proxima.storage.internal.AbstractDataAccessorFactory.Accept in project proxima-platform by O2-Czech-Republic.

the class RemoteConsumer method accept.

@Override
public void accept(T what) {
    try {
        Item item = Item.newBuilder().setSerialized(ByteString.readFrom(serialize(what))).build();
        observer().onNext(item);
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
Also used : Item(cz.o2.proxima.beam.tools.proto.service.Collect.Item) IOException(java.io.IOException)

Example 2 with Accept

use of cz.o2.proxima.storage.internal.AbstractDataAccessorFactory.Accept in project proxima-platform by O2-Czech-Republic.

the class ConsoleRandomReader method list.

public void list(String key, String prefix, @Nullable String offset, int limit, Consumer<KeyValue<?>> consumer) {
    AttributeDescriptor<?> desc = entityDesc.findAttribute(prefix + ".*").orElseThrow(() -> new IllegalArgumentException("Unknown attribute " + prefix + ".*"));
    RandomAccessReader reader = readerFor(desc);
    RandomOffset off = offset == null ? null : reader.fetchOffset(RandomAccessReader.Listing.ATTRIBUTE, offset);
    reader.scanWildcard(key, desc, off, limit, consumer::accept);
}
Also used : RandomAccessReader(cz.o2.proxima.direct.randomaccess.RandomAccessReader) RandomOffset(cz.o2.proxima.direct.randomaccess.RandomOffset)

Aggregations

Item (cz.o2.proxima.beam.tools.proto.service.Collect.Item)1 RandomAccessReader (cz.o2.proxima.direct.randomaccess.RandomAccessReader)1 RandomOffset (cz.o2.proxima.direct.randomaccess.RandomOffset)1 IOException (java.io.IOException)1