congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DataUtils.getPageChunkId
Code IndexAdd Tabnine to your IDE (free)

How to use
getPageChunkId
method
in
org.h2.mvstore.DataUtils

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

origin: com.h2database/h2

/**
 * Only keep one reference to the same chunk. Only leaf references are
 * removed (references to inner nodes are not removed, as they could
 * indirectly point to other chunks).
 */
void removeDuplicateChunkReferences() {
  HashSet<Integer> chunks = new HashSet<>();
  // we don't need references to leaves in the same chunk
  chunks.add(DataUtils.getPageChunkId(pos));
  for (int i = 0; i < children.length; i++) {
    long p = children[i];
    int chunkId = DataUtils.getPageChunkId(p);
    boolean wasNew = chunks.add(chunkId);
    if (DataUtils.getPageType(p) == DataUtils.PAGE_TYPE_NODE) {
      continue;
    }
    if (wasNew) {
      continue;
    }
    removeChild(i--);
  }
}
origin: com.h2database/h2

@Override
public String toString() {
  StringBuilder buff = new StringBuilder();
  buff.append("id: ").append(System.identityHashCode(this)).append('\n');
  buff.append("version: ").append(Long.toHexString(version)).append('\n');
  buff.append("pos: ").append(Long.toHexString(pos)).append('\n');
  if (pos != 0) {
    int chunkId = DataUtils.getPageChunkId(pos);
    buff.append("chunk: ").append(Long.toHexString(chunkId)).append('\n');
  }
  for (int i = 0; i <= keys.length; i++) {
    if (i > 0) {
      buff.append(" ");
    }
    if (children != null) {
      buff.append('[').append(Long.toHexString(children[i].pos)).append("] ");
    }
    if (i < keys.length) {
      buff.append(keys[i]);
      if (values != null) {
        buff.append(':');
        buff.append(values[i]);
      }
    }
  }
  return buff.toString();
}
origin: com.h2database/h2

/**
 * Get the chunk for the given position.
 *
 * @param pos the position
 * @return the chunk
 */
private Chunk getChunk(long pos) {
  Chunk c = getChunkIfFound(pos);
  if (c == null) {
    int chunkId = DataUtils.getPageChunkId(pos);
    throw DataUtils.newIllegalStateException(
        DataUtils.ERROR_FILE_CORRUPT,
        "Chunk {0} not found", chunkId);
  }
  return c;
}
origin: com.h2database/h2

private void collectReferencedChunks(Set<Integer> targetChunkSet,
    int mapId, long pos, int level) {
  int c = DataUtils.getPageChunkId(pos);
  targetChunkSet.add(c);
  if (DataUtils.getPageType(pos) == DataUtils.PAGE_TYPE_LEAF) {
    targetChunkSet.add(DataUtils.getPageChunkId(p));
origin: com.h2database/h2

private Chunk getChunkIfFound(long pos) {
  int chunkId = DataUtils.getPageChunkId(pos);
  Chunk c = chunks.get(chunkId);
  if (c == null) {
    checkOpen();
    if (!Thread.holdsLock(this)) {
      // it could also be unsynchronized metadata
      // access (if synchronization on this was forgotten)
      throw DataUtils.newIllegalStateException(
          DataUtils.ERROR_CHUNK_NOT_FOUND,
          "Chunk {0} no longer exists",
          chunkId);
    }
    String s = meta.get(Chunk.getMetaKey(chunkId));
    if (s == null) {
      return null;
    }
    c = Chunk.fromString(s);
    if (c.block == Long.MAX_VALUE) {
      throw DataUtils.newIllegalStateException(
          DataUtils.ERROR_FILE_CORRUPT,
          "Chunk {0} is invalid", chunkId);
    }
    chunks.put(c.id, c);
  }
  return c;
}
origin: com.h2database/h2

        counts[i],
        keys[i],
        DataUtils.getPageChunkId(cp),
        DataUtils.getPageOffset(cp));
      counts[entries],
      keys.length >= entries ? null : keys[entries],
      DataUtils.getPageChunkId(cp),
      DataUtils.getPageOffset(cp));
} else {
        len + "x%n",
        counts[i],
        DataUtils.getPageChunkId(cp),
        DataUtils.getPageOffset(cp));
origin: com.h2database/h2

Page p = new Page(map, 0);
p.pos = pos;
int chunkId = DataUtils.getPageChunkId(pos);
int offset = DataUtils.getPageOffset(pos);
p.read(buff, chunkId, offset, maxLength);
origin: com.h2database/h2

int chunkId = DataUtils.getPageChunkId(pos);
int offset = DataUtils.getPageOffset(pos);
int start = buff.position();
origin: com.h2database/h2

private int rewrite(Page p, Set<Integer> set) {
  if (p.isLeaf()) {
    long pos = p.getPos();
    int chunkId = DataUtils.getPageChunkId(pos);
    if (!set.contains(chunkId)) {
      return 0;
      int chunkId = DataUtils.getPageChunkId(childPos);
      if (!set.contains(chunkId)) {
        continue;
    int chunkId = DataUtils.getPageChunkId(pos);
    if (set.contains(chunkId)) {
origin: com.h2database/h2

int chunk = DataUtils.getPageChunkId(pos);
if (chunk == parentChunk) {
  return null;
origin: org.wowtools/h2

/**
 * Collect the set of chunks referenced directly by this page.
 *
 * @param target the target set
 */
void collectReferencedChunks(Set<Integer> target) {
  target.add(DataUtils.getPageChunkId(pos));
  for (long p : children) {
    target.add(DataUtils.getPageChunkId(p));
  }
}
origin: com.eventsourcing/h2

/**
 * Collect the set of chunks referenced directly by this page.
 *
 * @param target the target set
 */
void collectReferencedChunks(Set<Integer> target) {
  target.add(DataUtils.getPageChunkId(pos));
  for (long p : children) {
    target.add(DataUtils.getPageChunkId(p));
  }
}
origin: com.h2database/h2-mvstore

/**
 * Only keep one reference to the same chunk. Only leaf references are
 * removed (references to inner nodes are not removed, as they could
 * indirectly point to other chunks).
 */
void removeDuplicateChunkReferences() {
  HashSet<Integer> chunks = new HashSet<>();
  // we don't need references to leaves in the same chunk
  chunks.add(DataUtils.getPageChunkId(pos));
  for (int i = 0; i < children.length; i++) {
    long p = children[i];
    int chunkId = DataUtils.getPageChunkId(p);
    boolean wasNew = chunks.add(chunkId);
    if (DataUtils.getPageType(p) == DataUtils.PAGE_TYPE_NODE) {
      continue;
    }
    if (wasNew) {
      continue;
    }
    removeChild(i--);
  }
}
origin: com.eventsourcing/h2

@Override
public String toString() {
  StringBuilder buff = new StringBuilder();
  buff.append("id: ").append(System.identityHashCode(this)).append('\n');
  buff.append("version: ").append(Long.toHexString(version)).append("\n");
  buff.append("pos: ").append(Long.toHexString(pos)).append("\n");
  if (pos != 0) {
    int chunkId = DataUtils.getPageChunkId(pos);
    buff.append("chunk: ").append(Long.toHexString(chunkId)).append("\n");
  }
  for (int i = 0; i <= keys.length; i++) {
    if (i > 0) {
      buff.append(" ");
    }
    if (children != null) {
      buff.append("[" + Long.toHexString(children[i].pos) + "] ");
    }
    if (i < keys.length) {
      buff.append(keys[i]);
      if (values != null) {
        buff.append(':');
        buff.append(values[i]);
      }
    }
  }
  return buff.toString();
}
origin: org.wowtools/h2

/**
 * Only keep one reference to the same chunk. Only leaf references are
 * removed (references to inner nodes are not removed, as they could
 * indirectly point to other chunks).
 */
void removeDuplicateChunkReferences() {
  HashSet<Integer> chunks = New.hashSet();
  // we don't need references to leaves in the same chunk
  chunks.add(DataUtils.getPageChunkId(pos));
  for (int i = 0; i < children.length; i++) {
    long p = children[i];
    int chunkId = DataUtils.getPageChunkId(p);
    boolean wasNew = chunks.add(chunkId);
    if (DataUtils.getPageType(p) == DataUtils.PAGE_TYPE_NODE) {
      continue;
    }
    if (wasNew) {
      continue;
    }
    removeChild(i--);
  }
}
origin: com.eventsourcing/h2

/**
 * Only keep one reference to the same chunk. Only leaf references are
 * removed (references to inner nodes are not removed, as they could
 * indirectly point to other chunks).
 */
void removeDuplicateChunkReferences() {
  HashSet<Integer> chunks = New.hashSet();
  // we don't need references to leaves in the same chunk
  chunks.add(DataUtils.getPageChunkId(pos));
  for (int i = 0; i < children.length; i++) {
    long p = children[i];
    int chunkId = DataUtils.getPageChunkId(p);
    boolean wasNew = chunks.add(chunkId);
    if (DataUtils.getPageType(p) == DataUtils.PAGE_TYPE_NODE) {
      continue;
    }
    if (wasNew) {
      continue;
    }
    removeChild(i--);
  }
}
origin: org.wowtools/h2

/**
 * Get the chunk for the given position.
 *
 * @param pos the position
 * @return the chunk
 */
private Chunk getChunk(long pos) {
  Chunk c = getChunkIfFound(pos);
  if (c == null) {
    int chunkId = DataUtils.getPageChunkId(pos);
    throw DataUtils.newIllegalStateException(
        DataUtils.ERROR_FILE_CORRUPT,
        "Chunk {0} not found", chunkId);
  }
  return c;
}
origin: com.h2database/h2-mvstore

/**
 * Get the chunk for the given position.
 *
 * @param pos the position
 * @return the chunk
 */
private Chunk getChunk(long pos) {
  Chunk c = getChunkIfFound(pos);
  if (c == null) {
    int chunkId = DataUtils.getPageChunkId(pos);
    throw DataUtils.newIllegalStateException(
        DataUtils.ERROR_FILE_CORRUPT,
        "Chunk {0} not found", chunkId);
  }
  return c;
}
origin: com.eventsourcing/h2

/**
 * Get the chunk for the given position.
 *
 * @param pos the position
 * @return the chunk
 */
private Chunk getChunk(long pos) {
  Chunk c = getChunkIfFound(pos);
  if (c == null) {
    int chunkId = DataUtils.getPageChunkId(pos);
    throw DataUtils.newIllegalStateException(
        DataUtils.ERROR_FILE_CORRUPT,
        "Chunk {0} not found", chunkId);
  }
  return c;
}
origin: com.eventsourcing/h2

private Chunk getChunkIfFound(long pos) {
  int chunkId = DataUtils.getPageChunkId(pos);
  Chunk c = chunks.get(chunkId);
  if (c == null) {
    checkOpen();
    if (!Thread.holdsLock(this)) {
      // it could also be unsynchronized metadata
      // access (if synchronization on this was forgotten)
      throw DataUtils.newIllegalStateException(
          DataUtils.ERROR_CHUNK_NOT_FOUND,
          "Chunk {0} no longer exists",
          chunkId);
    }
    String s = meta.get(Chunk.getMetaKey(chunkId));
    if (s == null) {
      return null;
    }
    c = Chunk.fromString(s);
    if (c.block == Long.MAX_VALUE) {
      throw DataUtils.newIllegalStateException(
          DataUtils.ERROR_FILE_CORRUPT,
          "Chunk {0} is invalid", chunkId);
    }
    chunks.put(c.id, c);
  }
  return c;
}
org.h2.mvstoreDataUtilsgetPageChunkId

Javadoc

Get the chunk id from the position.

Popular methods of DataUtils

  • readVarInt
    Read a variable size int.
  • appendMap
    Append a map to the string builder, sorted by key.
  • checkArgument
    Throw an IllegalArgumentException if the argument is invalid.
  • copyExcept
    Copy the elements of an array, and remove one element.
  • copyWithGap
    Copy the elements of an array, with a gap.
  • encodeLength
    Convert the length to a length code 0..31. 31 means more than 1 MB.
  • formatMessage
    Format an error message.
  • getCheckValue
    Calculate a check value for the given integer. A check value is mean to verify the data is consisten
  • getErrorCode
    Get the error code from an exception message.
  • getFletcher32
    Calculate the Fletcher32 checksum.
  • getPageMaxLength
    Get the maximum length for the given code. For the code 31, PAGE_LARGE is returned.
  • getPageOffset
    Get the offset from the position.
  • getPageMaxLength,
  • getPageOffset,
  • getPagePos,
  • getPageType,
  • getVarIntLen,
  • initCause,
  • newIllegalArgumentException,
  • newIllegalStateException,
  • newUnsupportedOperationException

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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