Tabnine Logo
org.h2.mvstore
Code IndexAdd Tabnine to your IDE (free)

How to use org.h2.mvstore

Best Java code snippets using org.h2.mvstore (Showing top 20 results out of 315)

origin: com.h2database/h2

private MVMap<String, String> getMetaMap(long version) {
  Chunk c = getChunkForVersion(version);
  DataUtils.checkArgument(c != null, "Unknown version {0}", version);
  c = readChunkHeader(c.block);
  MVMap<String, String> oldMeta = meta.openReadOnly();
  oldMeta.setRootPos(c.metaRootPos, version);
  return oldMeta;
}
origin: com.h2database/h2

/**
 * Get the store version. The store version is usually used to upgrade the
 * structure of the store after upgrading the application. Initially the
 * store version is 0, until it is changed.
 *
 * @return the store version
 */
public int getStoreVersion() {
  checkOpen();
  String x = meta.get("setting.storeVersion");
  return x == null ? 0 : DataUtils.parseHexInt(x);
}
origin: com.h2database/h2

/**
 * Get the name of the given map.
 *
 * @param id the map id
 * @return the name, or null if not found
 */
public synchronized String getMapName(int id) {
  checkOpen();
  String m = meta.get(MVMap.getMapKey(id));
  return m == null ? null : DataUtils.getMapName(m);
}
origin: com.h2database/h2

/**
 * Open a temporary map.
 *
 * @param mapName the map name
 * @return the map
 */
MVMap<Object, Integer> openTempMap(String mapName) {
  MVMap.Builder<Object, Integer> mapBuilder =
      new MVMap.Builder<Object, Integer>().
      keyType(dataType);
  return store.openMap(mapName, mapBuilder);
}
origin: com.h2database/h2

/**
 * Store all pending changes.
 */
public void flush() {
  FileStore s = store.getFileStore();
  if (s == null || s.isReadOnly()) {
    return;
  }
  if (!store.compact(50, 4 * 1024 * 1024)) {
    store.commit();
  }
}
origin: com.h2database/h2

/**
 * Open a map with the default settings. The map is automatically create if
 * it does not yet exist. If a map with this name is already open, this map
 * is returned.
 *
 * @param <K> the key type
 * @param <V> the value type
 * @param name the name of the map
 * @return the map
 */
public <K, V> MVMap<K, V> openMap(String name) {
  return openMap(name, new MVMap.Builder<K, V>());
}
origin: com.h2database/h2

@SuppressWarnings({ "unchecked", "rawtypes" })
public static Builder fromString(String s) {
  // Cast from HashMap<String, String> to HashMap<String, Object> is safe
  return new Builder((HashMap) DataUtils.parseMap(s));
}
origin: com.h2database/h2

private static long getRootPos(MVMap<String, String> map, int mapId) {
  String root = map.get(MVMap.getMapRootKey(mapId));
  return root == null ? 0 : DataUtils.parseHexLong(root);
}
origin: com.h2database/h2

/**
 * Remove all entries.
 */
@Override
public synchronized void clear() {
  beforeWrite();
  root.removeAllRecursive();
  newRoot(Page.createEmpty(this, writeVersion));
}
origin: com.h2database/h2

/**
 * Set the position of the root page.
 *
 * @param rootPos the position, 0 for empty
 * @param version the version of the root
 */
void setRootPos(long rootPos, long version) {
  root = rootPos == 0 ? Page.createEmpty(this, -1) : readPage(rootPos);
  root.setVersion(version);
}
origin: com.h2database/h2

/**
 * Start collecting statistics.
 */
public void statisticsStart() {
  FileStore fs = store.getFileStore();
  statisticsStart = fs == null ? 0 : fs.getReadCount();
}
origin: com.h2database/h2

/**
 * Force all stored changes to be written to the storage. The default
 * implementation calls FileChannel.force(true).
 */
public void sync() {
  checkOpen();
  FileStore f = fileStore;
  if (f != null) {
    f.sync();
  }
}
origin: com.h2database/h2

/**
 * Write a variable size integer.
 *
 * @param x the value
 * @return this
 */
public WriteBuffer putVarInt(int x) {
  DataUtils.writeVarInt(ensureCapacity(5), x);
  return this;
}
origin: com.h2database/h2

private void write(long pos, ByteBuffer buffer) {
  try {
    fileStore.writeFully(pos, buffer);
  } catch (IllegalStateException e) {
    panic(e);
    throw e;
  }
}
origin: com.h2database/h2

private Chunk readChunkHeader(long block) {
  long p = block * BLOCK_SIZE;
  ByteBuffer buff = fileStore.readFully(p, Chunk.MAX_HEADER_LENGTH);
  return Chunk.readChunkHeader(buff, p);
}
origin: com.h2database/h2

/**
 * Write a variable size long.
 *
 * @param x the value
 * @return this
 */
public WriteBuffer putVarLong(long x) {
  DataUtils.writeVarLong(ensureCapacity(10), x);
  return this;
}
origin: com.h2database/h2

/**
 * Write the characters of a string in a format similar to UTF-8.
 *
 * @param s the string
 * @param len the number of characters to write
 * @return this
 */
public WriteBuffer putStringData(String s, int len) {
  ByteBuffer b = ensureCapacity(3 * len);
  DataUtils.writeStringData(b, s, len);
  return this;
}
origin: com.h2database/h2

/**
 * Remove the page.
 */
public void removePage() {
  if(isPersistent()) {
    long p = pos;
    if (p == 0) {
      removedInMemory = true;
    }
    map.removePage(p, memory);
  }
}
origin: com.h2database/h2

/**
 * Get the position right after the last used byte.
 *
 * @return the position
 */
private long getFileLengthInUse() {
  long result = fileStore.getFileLengthInUse();
  assert result == measureFileLengthInUse() : result + " != " + measureFileLengthInUse();
  return result;
}
origin: com.h2database/h2

/**
 * Mark the file as empty.
 */
public void clear() {
  freeSpace.clear();
}
org.h2.mvstore

Most used classes

  • MVStore
    A persistent storage for maps.
  • MVStore$Builder
    A builder for an MVStore.
  • MVMap
    A stored map. Read operations can happen concurrently with all other operations, without risk of cor
  • FileStore
    The default storage mechanism of the MVStore. This implementation persists data to a file. The file
  • MVMap$Builder
    A builder for this class.
  • Cursor,
  • DataUtils,
  • MVStoreTool,
  • OffHeapStore,
  • CacheLongKeyLIRS,
  • MVRTreeMap,
  • SpatialKey,
  • DataType,
  • StringDataType,
  • Chunk,
  • ConcurrentArrayList,
  • CursorPos,
  • FreeSpaceBitSet,
  • MVMap$MapBuilder
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