cdegroot-db-0.08-gentoo.patch 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. diff -urpN src.orig/db/com/cdegroot/db/hash/EntryPage.java src/db/com/cdegroot/db/hash/EntryPage.java
  2. --- a/src/db/com/cdegroot/db/hash/EntryPage.java 2005-02-06 00:40:17.191151504 +0100
  3. +++ b/src/db/com/cdegroot/db/hash/EntryPage.java 2005-02-06 00:54:14.045930240 +0100
  4. @@ -25,7 +25,7 @@ final class EntryPage extends PageHeader
  5. /**
  6. * Constructs a page view from the indicated block.
  7. */
  8. - EntryPage(BlockIo block) {
  9. + public EntryPage(BlockIo block) {
  10. super(block);
  11. }
  12. @@ -33,7 +33,7 @@ final class EntryPage extends PageHeader
  13. * Factory method to create or return a data page for the
  14. * indicated block.
  15. */
  16. - static EntryPage getEntryPageView(BlockIo block) {
  17. + public static EntryPage getEntryPageView(BlockIo block) {
  18. BlockView view = block.getView();
  19. if (view != null && view instanceof EntryPage)
  20. return (EntryPage) view;
  21. diff -urpN src.orig/db/com/cdegroot/db/recman/BlockIo.java src/db/com/cdegroot/db/recman/BlockIo.java
  22. --- a/src/db/com/cdegroot/db/recman/BlockIo.java 2005-02-06 00:40:17.192151352 +0100
  23. +++ b/src/db/com/cdegroot/db/recman/BlockIo.java 2005-02-06 00:58:02.990125432 +0100
  24. @@ -31,7 +31,7 @@ package com.cdegroot.db.recman;
  25. * @see java.io.DataInput
  26. * @see java.io.DataOutput
  27. */
  28. -final class BlockIo implements java.io.Serializable {
  29. +final public class BlockIo implements java.io.Serializable {
  30. private long blockId;
  31. private final byte[] snapshot; // committed snapshot.
  32. private boolean snapshotValid = false;
  33. @@ -44,7 +44,7 @@ final class BlockIo implements java.io.S
  34. * Constructs a new BlockIo instance working on the indicated
  35. * buffer.
  36. */
  37. - BlockIo(long blockId, byte[] data) {
  38. + public BlockIo(long blockId, byte[] data) {
  39. // removeme for production version
  40. if (blockId > 10000000000L)
  41. throw new Error("bogus block id " + blockId);
  42. @@ -108,7 +108,7 @@ final class BlockIo implements java.io.S
  43. /**
  44. * Returns the current view of the block.
  45. */
  46. - BlockView getView() {
  47. + public BlockView getView() {
  48. return view;
  49. }
  50. @@ -172,17 +172,25 @@ final class BlockIo implements java.io.S
  51. /**
  52. * Reads a short from the indicated position
  53. */
  54. - short readShort(int pos) {
  55. + public short readShort(int pos) {
  56. return (short)
  57. (((short) (data[pos+0] & 0xff) << 8) |
  58. ((short) (data[pos+1] & 0xff) << 0));
  59. }
  60. +
  61. + public byte readByte(int pos) {
  62. + return data[pos];
  63. + }
  64. +
  65. + public void writeByte(int pos, byte value)
  66. + { data[pos] = value;
  67. + }
  68. /**
  69. * Writes a short to the indicated position
  70. */
  71. - void writeShort(int pos, short value) {
  72. + public void writeShort(int pos, short value) {
  73. data[pos+0] = (byte)(0xff & (value >> 8));
  74. data[pos+1] = (byte)(0xff & (value >> 0));
  75. setDirty();
  76. @@ -191,7 +199,7 @@ final class BlockIo implements java.io.S
  77. /**
  78. * Reads an int from the indicated position
  79. */
  80. - int readInt(int pos) {
  81. + public int readInt(int pos) {
  82. return
  83. (((int)(data[pos+0] & 0xff) << 24) |
  84. ((int)(data[pos+1] & 0xff) << 16) |
  85. @@ -202,7 +210,7 @@ final class BlockIo implements java.io.S
  86. /**
  87. * Writes an int to the indicated position
  88. */
  89. - void writeInt(int pos, int value) {
  90. + public void writeInt(int pos, int value) {
  91. data[pos+0] = (byte)(0xff & (value >> 24));
  92. data[pos+1] = (byte)(0xff & (value >> 16));
  93. data[pos+2] = (byte)(0xff & (value >> 8));
  94. @@ -213,7 +221,7 @@ final class BlockIo implements java.io.S
  95. /**
  96. * Reads a long from the indicated position
  97. */
  98. - long readLong(int pos) {
  99. + public long readLong(int pos) {
  100. return
  101. (((long)(data[pos+0] & 0xff) << 56) |
  102. ((long)(data[pos+1] & 0xff) << 48) |
  103. @@ -228,7 +236,7 @@ final class BlockIo implements java.io.S
  104. /**
  105. * Writes a long to the indicated position
  106. */
  107. - void writeLong(int pos, long value) {
  108. + public void writeLong(int pos, long value) {
  109. data[pos+0] = (byte)(0xff & (value >> 56));
  110. data[pos+1] = (byte)(0xff & (value >> 48));
  111. data[pos+2] = (byte)(0xff & (value >> 40));
  112. diff -urpN src.orig/db/com/cdegroot/db/recman/BlockView.java src/db/com/cdegroot/db/recman/BlockView.java
  113. --- a/src/db/com/cdegroot/db/recman/BlockView.java 2005-02-06 00:40:17.193151200 +0100
  114. +++ b/src/db/com/cdegroot/db/recman/BlockView.java 2005-02-06 00:47:57.632153832 +0100
  115. @@ -28,5 +28,5 @@ package com.cdegroot.db.recman;
  116. *
  117. * @see BlockIo.setView()
  118. */
  119. -interface BlockView {
  120. +public interface BlockView {
  121. }
  122. diff -urpN src.orig/db/com/cdegroot/db/recman/Magic.java src/db/com/cdegroot/db/recman/Magic.java
  123. --- a/src/db/com/cdegroot/db/recman/Magic.java 2005-02-06 00:40:17.193151200 +0100
  124. +++ b/src/db/com/cdegroot/db/recman/Magic.java 2005-02-06 00:44:22.164909832 +0100
  125. @@ -25,7 +25,7 @@ package com.cdegroot.db.recman;
  126. /**
  127. * This interface contains magic cookies.
  128. */
  129. -interface Magic {
  130. +public interface Magic {
  131. /** Magic cookie at start of file */
  132. short FILE_HEADER = 0x1350;
  133. @@ -57,4 +57,6 @@ interface Magic {
  134. int SZ_INT = 4;
  135. /** Size of an externalized long */
  136. int SZ_LONG = 8;
  137. + /** Size of byte */
  138. + int SZ_BYTE = 1;
  139. }
  140. diff -urpN src.orig/db/com/cdegroot/db/recman/PageHeader.java src/db/com/cdegroot/db/recman/PageHeader.java
  141. --- a/src/db/com/cdegroot/db/recman/PageHeader.java 2005-02-06 00:40:17.193151200 +0100
  142. +++ b/src/db/com/cdegroot/db/recman/PageHeader.java 2005-02-06 00:50:10.236994832 +0100
  143. @@ -28,15 +28,15 @@ import java.io.*;
  144. * This class represents a page header. It is the common superclass for
  145. * all different page views.
  146. */
  147. -class PageHeader implements BlockView {
  148. +public class PageHeader implements BlockView {
  149. // offsets
  150. private static final short O_MAGIC = 0; // short magic
  151. private static final short O_NEXT = Magic.SZ_SHORT; // long next
  152. private static final short O_PREV = O_NEXT + Magic.SZ_LONG; // long prev
  153. - static final int SIZE = O_PREV + Magic.SZ_LONG;
  154. + public static final int SIZE = O_PREV + Magic.SZ_LONG;
  155. // my block
  156. - BlockIo block;
  157. + public BlockIo block;
  158. /**
  159. * Constructs a PageHeader object from a block
  160. @@ -45,7 +45,7 @@ class PageHeader implements BlockView {
  161. * @throws IOException if the block is too short to keep the file
  162. * header.
  163. */
  164. - PageHeader(BlockIo block) {
  165. + public PageHeader(BlockIo block) {
  166. initialize(block);
  167. if (!magicOk())
  168. throw new Error("CRITICAL: page header magic for block "
  169. @@ -66,7 +66,7 @@ class PageHeader implements BlockView {
  170. * Factory method to create or return a page header for the
  171. * indicated block.
  172. */
  173. - static PageHeader getView(BlockIo block) {
  174. + public static PageHeader getView(BlockIo block) {
  175. BlockView view = block.getView();
  176. if (view != null && view instanceof PageHeader)
  177. return (PageHeader) view;
  178. diff -urpN src.orig/db/com/cdegroot/db/recman/RecordFile.java src/db/com/cdegroot/db/recman/RecordFile.java
  179. --- a/src/db/com/cdegroot/db/recman/RecordFile.java 2005-02-06 00:40:17.193151200 +0100
  180. +++ b/src/db/com/cdegroot/db/recman/RecordFile.java 2005-02-06 00:45:38.616287456 +0100
  181. @@ -33,7 +33,7 @@ import java.util.*;
  182. * The set of dirty records on the in-use list constitutes a transaction.
  183. * Later on, we will send these records to some recovery thingy.
  184. */
  185. -final class RecordFile {
  186. +final public class RecordFile {
  187. private final TransactionManager txnMgr;
  188. // Todo: reorganize in hashes and fifos as necessary.
  189. @@ -48,7 +48,7 @@ final class RecordFile {
  190. private boolean transactionsDisabled = false;
  191. /** The length of a single block. */
  192. - final static int BLOCK_SIZE = 8192;//4096;
  193. + final public static int BLOCK_SIZE = 8192;//4096;
  194. /** The extension of a record file */
  195. final static String extension = ".db";