-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
RecordFormats.java
105 lines (87 loc) · 4 KB
/
RecordFormats.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* Copyright (c) 2002-2016 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.store.format;
import org.neo4j.helpers.Service;
import org.neo4j.kernel.impl.store.record.DynamicRecord;
import org.neo4j.kernel.impl.store.record.LabelTokenRecord;
import org.neo4j.kernel.impl.store.record.MetaDataRecord;
import org.neo4j.kernel.impl.store.record.NodeRecord;
import org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord;
import org.neo4j.kernel.impl.store.record.PropertyRecord;
import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord;
import org.neo4j.kernel.impl.store.record.RelationshipRecord;
import org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord;
/**
* The record formats that a store version uses. Contains all formats for all different stores as well as
* accessors for which {@link Capability capabilities} a format has as to be able to compare between formats.
*/
public interface RecordFormats
{
abstract class Factory extends Service
{
public Factory( String key, String... altKeys )
{
super( key, altKeys );
}
public abstract RecordFormats newInstance();
}
String storeVersion();
/**
* Generation of this format, simply an increasing int which should be incrementing along with
* releases, e.g. store version, e.g. official versions of the product. This is for preventing downgrades.
* When implementing a new format or evolving an older format the generation of the new format should
* be higher than the format it evolves from, or in case of a new format - newer than the currently newest format.
* The generation value doesn't need to correlate to any other value, the only thing needed is to
* determine "older" or "newer".
*
* @return format generation, with the intent of usage being that a store can migrate to a newer or
* same generation, but not to an older generation.
*/
int generation();
RecordFormat<NodeRecord> node();
RecordFormat<RelationshipGroupRecord> relationshipGroup();
RecordFormat<RelationshipRecord> relationship();
RecordFormat<PropertyRecord> property();
RecordFormat<LabelTokenRecord> labelToken();
RecordFormat<PropertyKeyTokenRecord> propertyKeyToken();
RecordFormat<RelationshipTypeTokenRecord> relationshipTypeToken();
RecordFormat<DynamicRecord> dynamic();
RecordFormat<MetaDataRecord> metaData();
/**
* Use when comparing one format to another, for example for migration purposes.
*
* @return array of {@link Capability capabilities} for comparison.
*/
Capability[] capabilities();
/**
* @param capability {@link Capability} to check for.
* @return whether or not this format has a certain {@link Capability}.
*/
boolean hasCapability( Capability capability );
FormatFamily getFormatFamily();
/**
* Whether or not this format has the same capabilities of the specific {@code type} as the {@code other} format.
*
* @param other {@link RecordFormats} to compare with.
* @param type {@link CapabilityType type} of capability to compare.
* @return true if both formats have the same set of capabilities of the given {@code type}.
*/
boolean hasSameCapabilities( RecordFormats other, CapabilityType type );
}