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.ParamsNested 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
ConstructorsConstructorDescriptionShardGeneration(long legacyGeneration)Construct a specificShardGenerationfor a repository using the legacy numeric format.ShardGeneration(String rawGeneration)Construct a specificShardGeneration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ShardGenerationfromXContent(org.elasticsearch.common.xcontent.XContentParser parser)inthashCode()static ShardGenerationstatic ShardGenerationnewGeneration(Random random)Convert to aStringfor use in naming theindex-$SHARD_GENblob containing aBlobStoreIndexShardSnapshots.toString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 specificShardGenerationfor 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
Randomfor repeatability in tests.
-
fromXContent
public static ShardGeneration fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toBlobNamePart
Convert to aStringfor use in naming theindex-$SHARD_GENblob 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:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
IOException
-