package com.orientechnologies.orient.core.storage.impl.local.paginated.wal;

import com.orientechnologies.common.directmemory.ODirectMemoryPointer;

/**
 * Created by tglman on 24/12/15.
 */
public interface OWALChanges {

  byte getByteValue(ODirectMemoryPointer pointer, int offset);

  byte[] getBinaryValue(ODirectMemoryPointer pointer, int offset, int len);

  short getShortValue(ODirectMemoryPointer pointer, int offset);

  int getIntValue(ODirectMemoryPointer pointer, int offset);

  long getLongValue(ODirectMemoryPointer pointer, int offset);

  void setLongValue(ODirectMemoryPointer pointer, int offset, long value);

  void setIntValue(ODirectMemoryPointer pointer, int offset, int value);

  void setByteValue(ODirectMemoryPointer pointer, int offset, byte value);

  void setBinaryValue(ODirectMemoryPointer pointer, int offset, byte[] value);

  void moveData(ODirectMemoryPointer pointer, int from, int to, int  len);

  PointerWrapper wrap(final ODirectMemoryPointer pointer);

  void applyChanges(ODirectMemoryPointer pointer);

  int serializedSize();

  int toStream(int offset, byte[] stream);

  int fromStream(int offset, byte[] stream);

}

@@ -146,16 +146,193 @@
 r;%0A%0A/**%0A
+ * keep partial changes of a page for a transaction.%0A * %3Cp%3E%0A * use get* to access to the original content decorated with the changes.%0A * use set* to add a change.%0A * %3Cp%3E%0A * %3Cp%3E%0A
  * Creat
@@ -1100,17 +1100,16 @@
 to, int 
- 
 len);%0A%0A 
@@ -1113,186 +1113,1182 @@
 %0A%0A  
-PointerWrapper wrap(final ODirectMemoryPointer pointer);%0A%0A  void applyChanges(ODirectMemoryPointer pointer);%0A%0A  int serializedSize();%0A%0A  int toStream(int offset, byte%5B%5D stream);%0A
+/**%0A   * Create a pointer wrapper that keep a page plus the relative changes.%0A   *%0A   * @param pointer the pointer to wrap.%0A   * @return pointer wrapper.%0A   */%0A  PointerWrapper wrap(final ODirectMemoryPointer pointer);%0A%0A%0A  /**%0A   * Apply the changes to a page.%0A   *%0A   * @param pointer of the page where apply the changes.%0A   */%0A  void applyChanges(ODirectMemoryPointer pointer);%0A%0A  /**%0A   * Return the size needed in a buffer in case of serialization.%0A   *%0A   * @return the required size.%0A   */%0A  int serializedSize();%0A%0A  /**%0A   * Serialize the changes to a stream.%0A   * needed for write the changes to the WAL%0A   *%0A   * @param offset starting writing offset for the provided buffer.%0A   * @param stream buffer where write the content, should be of minimal size of offset+ @%7Blink @serializedSize()%7D%0A   * @return the number of written bytes + the offset, can be used as offset of the next operation.%0A   */%0A  int toStream(int offset, byte%5B%5D stream);%0A%0A%0A  /**%0A   * Read changes from a stream.%0A   * Needed from restore from WAL.%0A   *%0A   * @param offset the offest in the buffer where start to read.%0A   * @param stream the buffer to read.%0A   * @return the offset+read bytes.%0A   */
 %0A  i

add comments on OWALChanges interface