All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sirix.page.interfaces.KeyValuePage Maven / Gradle / Ivy

Go to download

SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.

There is a newer version: 0.11.0
Show newest version
package org.sirix.page.interfaces;

import java.util.Collection;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.sirix.api.PageReadOnlyTrx;
import org.sirix.index.IndexType;
import org.sirix.node.interfaces.DataRecord;
import org.sirix.page.PageKind;
import org.sirix.page.PageReference;

/**
 * Key/Value page.
 *
 * @author Johannes Lichtenberger
 *
 */
public interface KeyValuePage extends Page {
  /**
   * Entry set of all nodes in the page. Changes to the set are reflected in the internal data
   * structure
   *
   * @return an entry set
   */
  Set> entrySet();

  /**
   * All available records.
   *
   * @return all records
   */
  Collection values();

  /**
   * Get the unique page record identifier.
   *
   * @return page record key/identifier
   */
  long getPageKey();

  /**
   * Get value with the specified key.
   *
   * @param key the key
   * @return value with given key, or {@code null} if not present
   */
  V getValue(K key);

  /**
   * Store or overwrite a single entry. The implementation must make sure if the key must be
   * permitted, the value or none.
   *
   * @param key key to store
   * @param value value to store
   */
  void setRecord(K key, @NonNull V value);

  Set> referenceEntrySet();

  /**
   * Store or overwrite a single reference associated with a key for overlong entries. That is
   * entries which are larger than a predefined threshold are written to OverflowPages and thus are
   * just referenced and not deserialized during the deserialization of a page.
   *
   * @param key key to store
   * @param reference reference to store
   */
  void setPageReference(K key, @NonNull PageReference reference);

  PageReference getPageReference(K key);

  /**
   * Create a new instance.
   *
   * @param recordPageKey the record page key
   * @param indexType the index type
   * @param pageReadTrx transaction to read pages
   * @return a new {@link KeyValuePage} instance
   */
  > C newInstance(@NonNegative long recordPageKey,
      @NonNull IndexType indexType, @NonNull PageReadOnlyTrx pageReadTrx);

  /**
   * Get the {@link PageReadOnlyTrx}.
   *
   * @return page reading transaction
   */
  PageReadOnlyTrx getPageReadOnlyTrx();

  /**
   * Get the index type.
   *
   * @return index type
   */
  IndexType getIndexType();

  /**
   * Get the number of entries/slots/page references filled.
   *
   * @return number of entries/slots/page references filled
   */
  int size();

//  /**
//   * Get the optional {@link PageReference}s pointing to the previous versions / page fragments of the page
//   *
//   * @return optional {@link PageReference} pointing to the previous versions / page fragments of the page
//   */
//  List getPreviousReferenceKeys();

  int getRevision();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy