1 /*
2
3 Derby - Class org.apache.derby.iapi.store.access.conglomerate.ConglomerateFactory
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.iapi.store.access.conglomerate;
23
24 import java.util.Properties;
25
26 import org.apache.derby.catalog.UUID;
27
28 import org.apache.derby.iapi.error.StandardException;
29
30 import org.apache.derby.iapi.store.access.ColumnOrdering;
31
32 import org.apache.derby.iapi.store.raw.ContainerKey;
33 import org.apache.derby.iapi.store.raw.Transaction;
34
35 import org.apache.derby.iapi.types.DataValueDescriptor;
36
37 /**
38
39 The factory interface for all conglomerate access methods.
40
41 **/
42
43 public interface ConglomerateFactory extends MethodFactory
44 {
45
46 static final int HEAP_FACTORY_ID = 0x00;
47 static final int BTREE_FACTORY_ID = 0x01;
48
49
50 /**
51 * Return the conglomerate factory id.
52 * <p>
53 * Return a number in the range of 0-15 which identifies this factory.
54 * Code which names conglomerates depends on this range currently, but
55 * could be easily changed to handle larger ranges. One hex digit seemed
56 * reasonable for the number of conglomerate types currently implemented
57 * (heap, btree) and those that might be implmented in the future: gist,
58 * gist btree, gist rtree, hash, others? ).
59 * <p>
60 *
61 * @return an unique identifier used to the factory into the conglomid.
62 *
63 **/
64 int getConglomerateFactoryId();
65
66 /**
67 Create the conglomerate and return a conglomerate object
68 for it. It is expected that the caller of this method will place the
69 the resulting object in the conglomerate directory.
70
71 @param xact_mgr transaction to perform the create in.
72 @param segment segment to create the conglomerate in.
73 @param input_containerid containerid to assign the container, or
74 ContainerHandle.DEFAULT_ASSIGN_ID if you want
75 raw store to assign an id.
76 @param template Template of row in the conglomerate.
77 @param columnOrder columns sort order for Index creation
78 @param collationIds collation ids of columns in the conglomerate.
79 @param properties Properties associated with the conglomerate.
80
81 @exception StandardException if the conglomerate could not be
82 opened for some reason, or if an error occurred in one of
83 the lower level modules.
84 **/
85 Conglomerate createConglomerate(
86 TransactionManager xact_mgr,
87 int segment,
88 long input_containerid,
89 DataValueDescriptor[] template,
90 ColumnOrdering[] columnOrder,
91 int[] collationIds,
92 Properties properties,
93 int temporaryFlag)
94 throws StandardException;
95 /**
96 * Return Conglomerate object for conglomerate with container_key.
97 * <p>
98 * Return the Conglomerate Object. This is implementation specific.
99 * Examples of what will be done is using the key to find the file where
100 * the conglomerate is located, and then executing implementation specific
101 * code to instantiate an object from reading a "special" row from a
102 * known location in the file. In the btree case the btree conglomerate
103 * is stored as a column in the control row on the root page.
104 * <p>
105 * This operation is costly so it is likely an implementation using this
106 * will cache the conglomerate row in memory so that subsequent accesses
107 * need not perform this operation.
108 *
109 * @param xact_mgr transaction to perform the create in.
110 * @param container_key The unique id of the existing conglomerate.
111 *
112 * @return An instance of the conglomerate.
113 *
114 * @exception StandardException Standard exception policy.
115 **/
116 Conglomerate readConglomerate(
117 TransactionManager xact_mgr,
118 ContainerKey container_key)
119 throws StandardException;
120 }