Package org.ardverk.dht.storage

Examples of org.ardverk.dht.storage.Index


  public void add() throws Exception {
   
    final int count = 10;
   
    File dir = new File("data/test");
    Index index = DefaultIndex.create(dir);
   
    Set<KUID> dst = new TreeSet<KUID>();
    Key key = KeyFactory.parseKey("ardverk:///hello/world");
    for (int i = 0; i < count; i++) {
      KUID valueId = KUID.createRandom(key.getId());
      Context context = new Context();
      context.addHeader("X-Index", Integer.toString(i));
     
      index.add(key, context, valueId);
      dst.add(valueId);
    }
   
    final int m = dst.size()/2-1;
    final int maxCount = 6;
   
    KUID marker = CollectionUtils.nth(dst, m);
    Values values = index.values(key, marker, maxCount);
   
    TestCase.assertEquals(marker, values.firstKey());
    TestCase.assertTrue(values.size() <= maxCount);
  }
View Full Code Here

TOP

Related Classes of org.ardverk.dht.storage.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.