Skip to content

Instantly share code, notes, and snippets.

@spullara
Last active December 18, 2015 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spullara/5770711 to your computer and use it in GitHub Desktop.
Save spullara/5770711 to your computer and use it in GitHub Desktop.
package avrobase.fdb;
import com.foundationdb.*;
import org.junit.Test;
import static com.foundationdb.KeySelector.firstGreaterOrEqual;
import static com.foundationdb.KeySelector.lastLessThan;
import static junit.framework.Assert.assertEquals;
/**
* Created by sam on 6/12/13.
*/
public class RawScanTest {
@Test
public void testScan() {
Database db = FDB.selectAPIVersion(22).open().get();
Transaction tx = db.createTransaction();
tx.clear("a".getBytes(), "b".getBytes());
tx.set("aA".getBytes(), "A".getBytes());
tx.set("aB".getBytes(), "B".getBytes());
tx.set("aC".getBytes(), "C".getBytes());
tx.commit();
tx = db.createTransaction();
RangeQuery range = tx.getRange(firstGreaterOrEqual("aA".getBytes()), lastLessThan("b".getBytes()));
int i = 0;
for (KeyValue keyValue : range) {
System.out.println(new String(keyValue.getValue()));
i++;
}
assertEquals(3, i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment