Package lupos.datastructures.buffermanager

Examples of lupos.datastructures.buffermanager.PageManager


   */
  public PagedCollection(final Class<? extends E> classname) throws IOException {
    DiskCollection.makeFolders();
    this.filename = DiskCollection.newBaseFilename();
    this.size=0;
    this.pageManager = new PageManager(this.filename);
    this.endOfCollection = 12;
    this.classname = classname;
    this.initFirstPage();
  }
View Full Code Here


    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.keysFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      OutHelper.writeLuposLong(addressOfValues, out);
      OutHelper.writeLuposLong(numberOfKeyElements, out);
      OutHelper.writeLuposLong(addressOfNextKey, out);
      Registration.serializeWithoutId(key, out);
      out.close();
View Full Code Here

    final int index = (int) (addressElement % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.valuesFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      OutHelper.writeLuposLong(numberOfElements, out);
      OutHelper.writeLuposLong(addressOfNextElement, out);
      Registration.serializeWithoutId(element, out);
      out.close();
      BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
View Full Code Here

    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.keysFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      OutHelper.writeLuposLong(addressOfValues, out);
      out.close();
      BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
    } catch (final IOException e) {
      System.err.println(e);
View Full Code Here

    final int index = (int) (addressElement % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.valuesFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      OutHelper.writeLuposLong(numberOfElements, out);
      out.close();
      BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
    } catch (final IOException e) {
      System.err.println(e);
View Full Code Here

   */
  public final Quadruple<K, Long, Long, Long> getKey(final long address) {
    final int pagenumber = (int) (address / PageManager.getDefaultPageSize());
    final int index = (int) (address % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      final long numberOfKeyElements = InputHelper.readLuposLong(in);
      final long addressOfNextKey = InputHelper.readLuposLong(in);
      final K key = Registration.deserializeWithoutId(this.classOfKeys, in);
      in.close();
View Full Code Here

*/
private final Triple<V, Long, Long> getElement(final long address) {
    final int pagenumber = (int) (address / PageManager.getDefaultPageSize());
    final int index = (int) (address % PageManager.getDefaultPageSize());
    try {
      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      final long numberOfElements = InputHelper.readLuposLong(in);
      final long addressOfNextElement = InputHelper.readLuposLong(in);
      final V element = Registration.deserializeWithoutId(this.classOfValues, in);
      in.close();
      return new Triple<V, Long, Long>(element, numberOfElements, addressOfNextElement);
View Full Code Here

    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.keysFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      long numberOfKeyElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfKeyElements>0){
        numberOfKeyElements--;
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
        OutHelper.writeLuposLong(addressOfValues, out);
        OutHelper.writeLuposLong(numberOfKeyElements, out);
        out.close();
        BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
        return true;
View Full Code Here

    final int index = (int) (addressElement % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.valuesFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
      long numberOfElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfElements>0){
        numberOfElements--;
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.valuesFilename, false, false), index);
        OutHelper.writeLuposLong(numberOfElements, out);
        out.close();
        BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
        return true;
      }
View Full Code Here

    final int index = (int) (addressKey % PageManager.getDefaultPageSize());
    try {
      final PageAddress pageAddress = new PageAddress(0, this.keysFilename);
      final byte[] page = BufferManager.getBufferManager().getPage(this.TABLEPAGESIZE, pageAddress);

      final InputStream in = new ContinousPagesInputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
      final long addressOfValues = InputHelper.readLuposLong(in);
      final long numberOfKeyElements = InputHelper.readLuposLong(in);
      in.close();
      if(numberOfKeyElements>0){
        final OutputStream out = new ContinousPagesOutputStream(pagenumber, new PageManager(this.keysFilename, false, false), index);
        OutHelper.writeLuposLong(addressOfValues, out);
        OutHelper.writeLuposLong(0, out);
        out.close();
        BufferManager.getBufferManager().modifyPage(this.TABLEPAGESIZE, pageAddress, page);
        return numberOfKeyElements;
View Full Code Here

TOP

Related Classes of lupos.datastructures.buffermanager.PageManager

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.