Tabnine Logo
MemTable
Code IndexAdd Tabnine to your IDE (free)

How to use
MemTable
in
org.eclipse.jgit.storage.dht.spi.memory

Best Java code snippets using org.eclipse.jgit.storage.dht.spi.memory.MemTable (Showing top 20 results out of 315)

origin: com.madgag/org.eclipse.jgit.storage.dht

  public void remove(ObjectIndexKey objId, ChunkKey chunk, WriteBuffer buffer)
      throws DhtException {
    table.delete(objId.asBytes(), colInfo.append(chunk.asBytes()));
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

  public void remove(ChunkKey key, WriteBuffer buffer) throws DhtException {
    table.deleteRow(key.asBytes());
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public void put(PackChunk.Members chunk, WriteBuffer buffer)
    throws DhtException {
  byte[] row = chunk.getChunkKey().asBytes();
  if (chunk.hasChunkData())
    table.put(row, colData.name(), chunk.getChunkData());
  if (chunk.hasChunkIndex())
    table.put(row, colIndex.name(), chunk.getChunkIndex());
  if (chunk.hasMeta())
    table.put(row, colMeta.name(), chunk.getMeta().toByteArray());
}
origin: com.madgag/org.eclipse.jgit.storage.dht

public void putUnique(RepositoryName name, RepositoryKey key)
    throws DhtException, TimeoutException {
  boolean ok = table.compareAndSet( //
      name.asBytes(), //
      colId.name(), //
      null, //
      key.asBytes());
  if (!ok)
    throw new DhtException(MessageFormat.format(
        DhtText.get().repositoryAlreadyExists, name.asString()));
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public RepositoryKey get(RepositoryName name) throws DhtException,
    TimeoutException {
  Cell cell = table.get(name.asBytes(), colId.name());
  if (cell == null)
    return null;
  return RepositoryKey.fromBytes(cell.getValue());
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public Collection<CachedPackInfo> getCachedPacks(RepositoryKey repo)
    throws DhtException, TimeoutException {
  List<CachedPackInfo> out = new ArrayList<CachedPackInfo>(4);
  for (MemTable.Cell cell : table.scanFamily(repo.asBytes(), colCachedPack)) {
    try {
      out.add(CachedPackInfo.parseFrom(cell.getValue()));
    } catch (InvalidProtocolBufferException e) {
      throw new DhtException(MessageFormat.format(
          DhtText.get().invalidCachedPackInfo, repo,
          CachedPackKey.fromBytes(cell.getName())), e);
    }
  }
  return out;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

if (!same(oldCell, oldVal)) {
  if (r.isEmpty())
    map.remove(rowKey);
origin: com.madgag/org.eclipse.jgit.storage.dht

  public void remove(RepositoryName name, RepositoryKey key)
      throws DhtException, TimeoutException {
    boolean ok = table.compareAndSet(
        name.asBytes(),
        colId.name(),
        key.asBytes(),
        null);
    if (!ok)
      throw new DhtException(MessageFormat.format(
          DhtText.get().repositoryAlreadyExists, name.asString()));
  }
}
origin: com.madgag/org.eclipse.jgit.storage.dht

public RepositoryKey get(RepositoryName name) throws DhtException,
    TimeoutException {
  Cell cell = table.get(name.asBytes(), colId.name());
  if (cell == null)
    return null;
  return RepositoryKey.fromBytes(cell.getValue());
}
origin: com.madgag/org.eclipse.jgit.storage.dht

public Collection<CachedPackInfo> getCachedPacks(RepositoryKey repo)
    throws DhtException, TimeoutException {
  List<CachedPackInfo> out = new ArrayList<CachedPackInfo>(4);
  for (MemTable.Cell cell : table.scanFamily(repo.asBytes(), colCachedPack)) {
    try {
      out.add(CachedPackInfo.parseFrom(cell.getValue()));
    } catch (InvalidProtocolBufferException e) {
      throw new DhtException(MessageFormat.format(
          DhtText.get().invalidCachedPackInfo, repo,
          CachedPackKey.fromBytes(cell.getName())), e);
    }
  }
  return out;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

if (!same(oldCell, oldVal)) {
  if (r.isEmpty())
    map.remove(rowKey);
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public void putUnique(RepositoryName name, RepositoryKey key)
    throws DhtException, TimeoutException {
  boolean ok = table.compareAndSet( //
      name.asBytes(), //
      colId.name(), //
      null, //
      key.asBytes());
  if (!ok)
    throw new DhtException(MessageFormat.format(
        DhtText.get().repositoryAlreadyExists, name.asString()));
}
origin: com.madgag/org.eclipse.jgit.storage.dht

public void put(PackChunk.Members chunk, WriteBuffer buffer)
    throws DhtException {
  byte[] row = chunk.getChunkKey().asBytes();
  if (chunk.hasChunkData())
    table.put(row, colData.name(), chunk.getChunkData());
  if (chunk.hasChunkIndex())
    table.put(row, colIndex.name(), chunk.getChunkIndex());
  if (chunk.hasMeta())
    table.put(row, colMeta.name(), chunk.getMeta().toByteArray());
}
origin: com.madgag/org.eclipse.jgit.storage.dht

public void remove(RepositoryKey repo, ChunkKey chunk, WriteBuffer buffer)
    throws DhtException {
  table.delete(repo.asBytes(), colChunkInfo.append(chunk.asBytes()));
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public void getMeta(Context options, Set<ChunkKey> keys,
    AsyncCallback<Map<ChunkKey, ChunkMeta>> callback) {
  Map<ChunkKey, ChunkMeta> out = new HashMap<ChunkKey, ChunkMeta>();
  for (ChunkKey chunk : keys) {
    byte[] row = chunk.asBytes();
    MemTable.Cell cell = table.get(row, colMeta.name());
    if (cell != null) {
      try {
        out.put(chunk, ChunkMeta.parseFrom(cell.getValue()));
      } catch (InvalidProtocolBufferException err) {
        callback.onFailure(new DhtException(MessageFormat.format(
            DhtText.get().invalidChunkMeta, chunk), err));
        return;
      }
    }
  }
  callback.onSuccess(out);
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public Map<RefKey, RefData> getAll(Context options, RepositoryKey repository)
    throws DhtException, TimeoutException {
  Map<RefKey, RefData> out = new HashMap<RefKey, RefData>();
  for (MemTable.Cell cell : table.scanFamily(repository.asBytes(), colRef)) {
    RefKey ref = RefKey.fromBytes(colRef.suffix(cell.getName()));
    try {
      out.put(ref, RefData.parseFrom(cell.getValue()));
    } catch (InvalidProtocolBufferException badCell) {
      throw new DhtException(MessageFormat.format(
          DhtText.get().invalidRefData, ref), badCell);
    }
  }
  return out;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

  public void remove(ChunkKey key, WriteBuffer buffer) throws DhtException {
    table.deleteRow(key.asBytes());
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

  public void remove(RepositoryName name, RepositoryKey key)
      throws DhtException, TimeoutException {
    boolean ok = table.compareAndSet(
        name.asBytes(),
        colId.name(),
        key.asBytes(),
        null);
    if (!ok)
      throw new DhtException(MessageFormat.format(
          DhtText.get().repositoryAlreadyExists, name.asString()));
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

public void put(RepositoryKey repo, CachedPackInfo info, WriteBuffer buffer)
    throws DhtException {
  CachedPackKey key = CachedPackKey.fromInfo(info);
  table.put(repo.asBytes(),
      colCachedPack.append(key.asBytes()),
      info.toByteArray());
}
origin: com.madgag/org.eclipse.jgit.storage.dht

  public void remove(RepositoryKey repo, CachedPackKey key, WriteBuffer buffer)
      throws DhtException {
    table.delete(repo.asBytes(), colCachedPack.append(key.asBytes()));
  }
}
org.eclipse.jgit.storage.dht.spi.memoryMemTable

Javadoc

Tiny in-memory NoSQL style table.

This table is thread-safe, but not very efficient. It uses a single lock to protect its internal data structure from concurrent access, and stores all data as byte arrays. To reduce memory usage, the arrays passed by the caller during put or compareAndSet are used as-is in the internal data structure, and may be returned later. Callers should not modify byte arrays once they are stored in the table, or when obtained from the table.

Most used methods

  • compareAndSet
    Compare and put or delete a cell. This method performs an atomic compare-and-swap operation on the n
  • delete
    Delete a cell.
  • deleteRow
    Delete an entire row.
  • get
    Get a single cell, or null.
  • put
    Put a value into a cell.
  • same
  • scanFamily
    Scan all cells in a row.

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • putExtra (Intent)
  • getSystemService (Context)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JFrame (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now