Example #1
0
  public DHT_Active(ActiveRDMA c) {
    m_c = c;
    m_dht = new DHT_RDMA(c, N);

    c.load(DHT_RDMA.class);
    c.load(DHT_Active_Find.class);
    c.load(DHT_Active_Get.class);
    c.load(DHT_Active_Put.class);
    c.load(DHT_Active_Has.class);
  }
Example #2
0
  public boolean has(String key) {
    byte[] b = key.getBytes();

    int[] args = new int[b.length];
    for (int i = 0; i < b.length; i++) args[i] = (int) b[i];

    return m_c.run(DHT_Active_Has.class, args) != 0;
  }
Example #3
0
  public int get(String key) {
    byte[] b = key.getBytes();

    int[] args = new int[b.length];
    for (int i = 0; i < b.length; i++) args[i] = (int) b[i];

    return m_c.run(DHT_Active_Get.class, args);
  }
Example #4
0
  public int[] match(int key, byte[] pattern) {
    // byte[] b = pattern.getBytes();

    int[] args = new int[pattern.length + 1];
    args[0] = key;
    for (int i = 0; i < pattern.length; i++) args[i] = (int) pattern[i];

    return m_c.runArray(DHT_Active_Find.class, args);
  }
Example #5
0
  public void put(String key, int val) {
    byte[] b = key.getBytes();

    int[] args = new int[b.length + 1];
    for (int i = 0; i < b.length; i++) args[i + 1] = (int) b[i];

    args[0] = val;

    m_c.run(DHT_Active_Put.class, args);
  }
Example #6
0
 public int getNext(int ptr) {
   return m_c.r(ptr);
 }
Example #7
0
 public int getHead(int bin) {
   return m_c.r(4 * (N + bin));
 }
Example #8
0
 public String getKey(int ptr) {
   int len = m_c.r(ptr + 8);
   byte[] bytes = m_c.readbytes(ptr + 12, len);
   return new String(bytes);
 }