Package org.elasticsearch.repositories
Class ShardGeneration
java.lang.Object
org.elasticsearch.repositories.ShardGeneration
- All Implemented Interfaces:
Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public final class ShardGeneration
extends Object
implements Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
The generation ID of a shard, used to name the shard-level
index-$SHARD_GEN
file that represents a BlobStoreIndexShardSnapshots
instance. Before 7.6 (SnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION
) these generations were
numeric, but recent versions use a UUID instead.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionShardGeneration(long legacyGeneration)
Construct a specificShardGeneration
for a repository using the legacy numeric format.ShardGeneration(String rawGeneration)
Construct a specificShardGeneration
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static ShardGeneration
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
int
hashCode()
static ShardGeneration
static ShardGeneration
newGeneration(Random random)
Convert to aString
for use in naming theindex-$SHARD_GEN
blob containing aBlobStoreIndexShardSnapshots
.toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
ShardGeneration
Construct a specificShardGeneration
. Doing this is generally a mistake, you should either create a new fresh one withnewGeneration()
or else read one from the wire withShardGeneration(StreamInput)
orfromXContent(XContentParser)
. -
ShardGeneration
public ShardGeneration(long legacyGeneration)Construct a specificShardGeneration
for a repository using the legacy numeric format. -
ShardGeneration
- Throws:
IOException
-
-
Method Details
-
newGeneration
- Returns:
- a new (fresh) shard generation.
-
newGeneration
- Returns:
- a new (fresh) shard generation generated using the given
Random
for repeatability in tests.
-
fromXContent
public static ShardGeneration fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toBlobNamePart
Convert to aString
for use in naming theindex-$SHARD_GEN
blob containing aBlobStoreIndexShardSnapshots
. -
toString
-
equals
-
hashCode
public int hashCode() -
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-