Package org.elasticsearch.repositories
Class ShardGeneration
java.lang.Object
org.elasticsearch.repositories.ShardGeneration
- All Implemented Interfaces:
Writeable,ToXContent,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.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, 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.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(XContentParser parser) inthashCode()static ShardGenerationstatic ShardGenerationnewGeneration(Random random) Convert to aStringfor use in naming theindex-$SHARD_GENblob containing aBlobStoreIndexShardSnapshots.toString()toXContent(XContentBuilder builder, 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.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
- 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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-