Line data Source code
1 : // Copyright (C) 2017 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.index.project; 16 : 17 : import static com.google.gerrit.index.SchemaUtil.schema; 18 : 19 : import com.google.gerrit.index.Schema; 20 : import com.google.gerrit.index.SchemaDefinitions; 21 : 22 : /** 23 : * Definition of project index versions (schemata). See {@link SchemaDefinitions}. 24 : * 25 : * <p>Upgrades are subject to constraints, see {@code 26 : * com.google.gerrit.index.IndexUpgradeValidator}. 27 : */ 28 : public class ProjectSchemaDefinitions extends SchemaDefinitions<ProjectData> { 29 : 30 : @Deprecated 31 153 : static final Schema<ProjectData> V1 = 32 153 : schema( 33 : /* version= */ 1, 34 : ProjectField.NAME, 35 : ProjectField.DESCRIPTION, 36 : ProjectField.PARENT_NAME, 37 : ProjectField.NAME_PART, 38 : ProjectField.ANCESTOR_NAME); 39 : 40 : @Deprecated 41 153 : static final Schema<ProjectData> V2 = schema(V1, ProjectField.STATE, ProjectField.REF_STATE); 42 : 43 : // Bump Lucene version requires reindexing 44 153 : @Deprecated static final Schema<ProjectData> V3 = schema(V2); 45 : 46 : // Lucene index was changed to add an additional field for sorting. 47 153 : @Deprecated static final Schema<ProjectData> V4 = schema(V3); 48 : 49 : // Upgrade Lucene to 7.x requires reindexing. 50 153 : static final Schema<ProjectData> V5 = schema(V4); 51 : 52 : /** 53 : * Name of the project index to be used when contacting index backends or loading configurations. 54 : */ 55 : public static final String NAME = "projects"; 56 : 57 : /** Singleton instance of the schema definitions. This is one per JVM. */ 58 153 : public static final ProjectSchemaDefinitions INSTANCE = new ProjectSchemaDefinitions(); 59 : 60 : private ProjectSchemaDefinitions() { 61 153 : super(NAME, ProjectData.class); 62 153 : } 63 : }