KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > cleaner > LNInfo


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

8
9 package com.sleepycat.je.cleaner;
10
11 import com.sleepycat.je.dbi.DatabaseId;
12 import com.sleepycat.je.dbi.MemoryBudget;
13 import com.sleepycat.je.tree.LN;
14
15 /**
16  * The information necessary to lookup an LN. Used for pending LNs that are
17  * locked and must be migrated later, or cannot be migrated immediately during
18  * a split. Also used in a look ahead cache in FileProcessor.
19  *
20  * Is public for Sizeof only.
21  */

22 public final class LNInfo {
23
24     private LN ln;
25     private DatabaseId dbId;
26     private byte[] key;
27     private byte[] dupKey;
28
29     public LNInfo(LN ln, DatabaseId dbId, byte[] key, byte[] dupKey) {
30         this.ln = ln;
31         this.dbId = dbId;
32         this.key = key;
33         this.dupKey = dupKey;
34     }
35
36     LN getLN() {
37         return ln;
38     }
39
40     DatabaseId getDbId() {
41         return dbId;
42     }
43
44     byte[] getKey() {
45         return key;
46     }
47
48     byte[] getDupKey() {
49         return dupKey;
50     }
51
52     int getMemorySize() {
53         int size = MemoryBudget.LN_INFO_OVERHEAD;
54         if (ln != null) {
55             size += ln.getMemorySizeIncludedByParent();
56         }
57         if (key != null) {
58             size += MemoryBudget.byteArraySize(key.length);
59         }
60         if (dupKey != null) {
61             size += MemoryBudget.byteArraySize(dupKey.length);
62         }
63         return size;
64     }
65 }
66
Popular Tags