KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > store > raw > data > DirectAllocActions


1 /*
2
3    Derby - Class org.apache.derby.impl.store.raw.data.DirectAllocActions
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.store.raw.data;
23
24 import org.apache.derby.impl.store.raw.data.AllocationActions;
25 import org.apache.derby.impl.store.raw.data.BasePage;
26
27 import org.apache.derby.iapi.services.sanity.SanityManager;
28 import org.apache.derby.iapi.services.io.FormatIdUtil;
29
30 import org.apache.derby.iapi.store.raw.Loggable;
31 import org.apache.derby.iapi.store.raw.xact.RawTransaction;
32 import org.apache.derby.iapi.store.raw.log.LogInstant;
33
34 import org.apache.derby.iapi.error.StandardException;
35
36 public class DirectAllocActions implements AllocationActions {
37
38     public DirectAllocActions() {
39     }
40
41     /**
42         Set the allocation status of pageNumber to doStatus. To undo this
43         operation, set the allocation status of pageNumber to undoStatus
44         
45         @param t The transaction
46         @param allocPage the allocation page
47         @param pageNumber the page to allocation or deallocation
48         @param doStatus set the allocation status of the page this value
49         @param undoStatus on undo, set the allocation status of the page
50                                 this value
51
52         @exception StandardException Standard Cloudscape error policy
53     */

54     public void actionAllocatePage(RawTransaction t, BasePage allocPage,
55                                    long pageNumber, int doStatus, int undoStatus)
56          throws StandardException
57     {
58         ((AllocPage)allocPage).setPageStatus((LogInstant)null, pageNumber, doStatus);
59     }
60
61     /**
62         Chain one allocation page to the next.
63
64         @param t The transaction
65         @param allocPage the allocation page whose next page chain needs
66                                 to be changed
67         @param pageNumber the next allocation page's number
68         @param pageOffset the next allocation page's page offset
69
70         @exception StandardException Standard Cloudscape error policy
71     */

72     public void actionChainAllocPage(RawTransaction t, BasePage allocPage,
73                                 long pageNumber, long pageOffset)
74          throws StandardException
75     {
76         ((AllocPage)allocPage).chainNextAllocPage((LogInstant)null, pageNumber,
77                                                   pageOffset);
78     }
79
80     /**
81      * Compress free pages.
82      * <p>
83      * Compress the free pages at the end of the range maintained by
84      * this allocation page. All pages being compressed should be FREE.
85      * Only pages in the last allocation page can be compressed.
86      * <p>
87      *
88      * @param t The transaction
89      * @param allocPage the allocation page to do compress on.
90      * @param new_highest_page The new highest page on this allocation
91      * page. The number is the offset of the page
92      * in the array of pages maintained by this
93      * allocation page, for instance a value of 0
94      * indicates all page except the first one are
95      * to be truncated. If all pages are
96      * truncated then the offset is set to -1.
97      * @param num_pages_truncated The number of allocated pages in this
98      * allocation page prior to the truncate.
99      * Note that all pages from NewHighestPage+1
100      * through newHighestPage+num_pages_truncated
101      * should be FREE.
102      *
103      * @exception StandardException Standard exception policy.
104      **/

105     public void actionCompressSpaceOperation(
106     RawTransaction t,
107     BasePage allocPage,
108     int new_highest_page,
109     int num_pages_truncated)
110         throws StandardException
111     {
112         ((AllocPage)allocPage).compressSpace(
113              (LogInstant)null, new_highest_page, num_pages_truncated);
114     }
115 }
116
Popular Tags