KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > recovery > stepwise > LogEntryInfo


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: LogEntryInfo.java,v 1.4 2006/10/30 21:14:49 bostic Exp $
7  */

8
9 package com.sleepycat.je.recovery.stepwise;
10
11 import java.util.Map JavaDoc;
12 import java.util.Set JavaDoc;
13
14 import com.sleepycat.je.utilint.DbLsn;
15
16 /*
17  * A LogEntryInfo supports stepwise recovery testing, where the log is
18  * systemantically truncated and recovery is executed. At each point in a log,
19  * there is a set of records that we expect to see. The LogEntryInfo
20  * encapsulates enough information about the current log entry so we can
21  * update the expected set accordingly.
22  */

23
24 public class LogEntryInfo {
25     private long lsn;
26     int key;
27     int data;
28
29     LogEntryInfo(long lsn,
30               int key,
31               int data) {
32         this.lsn = lsn;
33         this.key = key;
34         this.data = data;
35     }
36
37     /*
38      * Implement this accordingly. For example, a LogEntryInfo which
39      * represents a non-txnal LN record would add that key/data to the
40      * expected set. A txnal delete LN record would delete the record
41      * from the expecte set at commit.
42      *
43      * The default action is that the expected set is not changed.
44      */

45     public void updateExpectedSet(Set JavaDoc expectedSet, Map JavaDoc newUncommittedRecords, Map JavaDoc deletedUncommittedRecords) {}
46
47     public String JavaDoc toString() {
48         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
49         sb.append("type=").append(this.getClass().getName());
50         sb.append("lsn=").append(DbLsn.getNoFormatString(lsn));
51         sb.append(" key=").append(key);
52         sb.append(" data=").append(data);
53         return sb.toString();
54     }
55
56     public long getLsn() {
57         return lsn;
58     }
59 }
60
Popular Tags