diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java index 49bf9162e8871..be2e8b179d620 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/BaseSearchableSnapshotsIntegTestCase.java @@ -16,7 +16,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.blobstore.cache.BlobStoreCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.BlobStoreCacheService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -27,8 +27,8 @@ import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest.Storage; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import org.junit.After; import java.util.ArrayList; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java index 1f60ccda0e52e..c42297c914ae8 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsCanMatchOnCoordinatorIntegTests.java @@ -34,8 +34,8 @@ import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import java.io.IOException; import java.time.Instant; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java index 289174f0583ce..093cc786dc907 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java @@ -69,7 +69,7 @@ import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsStatsAction; import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsStatsRequest; import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsStatsResponse; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; import java.io.IOException; import java.nio.file.Files; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/AllocationFilteringIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/AllocationFilteringIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java index d583ae7197e3a..e7d51ef825ca7 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/AllocationFilteringIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/AllocationFilteringIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.common.Nullable; @@ -16,6 +16,8 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; import java.util.List; import java.util.Locale; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocationIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocationIntegTests.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocationIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocationIntegTests.java index 220317744ee66..41c92acd05e8d 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocationIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocationIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; @@ -14,7 +14,8 @@ import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; import java.util.List; import java.util.Set; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotDataTierIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotDataTierIntegTests.java similarity index 95% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotDataTierIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotDataTierIntegTests.java index 6f3686032c984..c91b4deeff93c 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotDataTierIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotDataTierIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; import org.elasticsearch.common.settings.Settings; @@ -13,6 +13,7 @@ import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider; import org.elasticsearch.xpack.core.DataTier; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; import java.util.Map; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotEnableAllocationDeciderIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotEnableAllocationDeciderIntegTests.java similarity index 93% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotEnableAllocationDeciderIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotEnableAllocationDeciderIntegTests.java index 96174711dd025..c0cf519d0c713 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotEnableAllocationDeciderIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotEnableAllocationDeciderIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.client.Requests; @@ -18,7 +18,9 @@ import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.snapshots.mockstore.MockRepository; import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; +import org.elasticsearch.xpack.searchablesnapshots.allocation.decider.SearchableSnapshotEnableAllocationDecider; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; import org.hamcrest.Matchers; import java.util.ArrayList; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsRelocationIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotsRelocationIntegTests.java similarity index 95% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsRelocationIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotsRelocationIntegTests.java index fbf20be3051d5..ecb8b01575d04 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsRelocationIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotsRelocationIntegTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; @@ -18,6 +18,9 @@ import org.elasticsearch.snapshots.mockstore.MockRepository; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; +import org.elasticsearch.xpack.searchablesnapshots.LocalStateSearchableSnapshots; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; import org.hamcrest.Matchers; import java.util.Collection; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/blobstore/cache/SearchableSnapshotsBlobStoreCacheIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/blobstore/cache/SearchableSnapshotsBlobStoreCacheIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java index bc3f3aae7f8cf..9ad07259c221f 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/blobstore/cache/SearchableSnapshotsBlobStoreCacheIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.blobstore.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.blob; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; @@ -44,8 +44,8 @@ import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsStatsAction; import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsStatsRequest; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import org.junit.AfterClass; import org.junit.BeforeClass; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/SearchableSnapshotsPersistentCacheIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/SearchableSnapshotsPersistentCacheIntegTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/SearchableSnapshotsPersistentCacheIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/SearchableSnapshotsPersistentCacheIntegTests.java index a323d879758e4..8ca4f94e1f742 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/SearchableSnapshotsPersistentCacheIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/SearchableSnapshotsPersistentCacheIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.full; import org.apache.lucene.document.Document; import org.elasticsearch.cluster.metadata.IndexMetadata; @@ -35,7 +35,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_PREFIX; import static org.elasticsearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.elasticsearch.xpack.searchablesnapshots.cache.PersistentCache.resolveCacheIndexFolder; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.PersistentCache.resolveCacheIndexFolder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.notNullValue; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsPrewarmingIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/SearchableSnapshotsPrewarmingIntegTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsPrewarmingIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/SearchableSnapshotsPrewarmingIntegTests.java index 1195d22b0c4f3..30c7515225d4b 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsPrewarmingIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/SearchableSnapshotsPrewarmingIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.cache.full; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.lucene.index.IndexFileNames; @@ -49,6 +49,9 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; +import org.elasticsearch.xpack.searchablesnapshots.LocalStateSearchableSnapshots; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; import org.junit.After; import java.io.FilterInputStream; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/PartiallyCachedShardAllocationIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/PartiallyCachedShardAllocationIntegTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java index 63531b70c89b3..64a3250422739 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/PartiallyCachedShardAllocationIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/PartiallyCachedShardAllocationIntegTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.cache.shared; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionFuture; @@ -32,6 +32,8 @@ import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; import org.elasticsearch.xpack.searchablesnapshots.action.cache.FrozenCacheInfoNodeAction; import java.io.IOException; @@ -49,7 +51,7 @@ import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING; import static org.elasticsearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING; +import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotRecoveryStateIntegrationTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryStateIntegrationTests.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotRecoveryStateIntegrationTests.java rename to x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryStateIntegrationTests.java index 336aa5ac2ca12..bbdd3c38fdc93 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotRecoveryStateIntegrationTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryStateIntegrationTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.recovery; import com.carrotsearch.hppc.ObjectContainer; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; @@ -39,7 +39,9 @@ import org.elasticsearch.snapshots.SnapshotInfo; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.BaseSearchableSnapshotsIntegTestCase; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; import java.io.File; import java.nio.file.Files; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java index 05cb5a61e438c..f268f24ab5cd9 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java @@ -11,7 +11,7 @@ import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.blobstore.cache.BlobStoreCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.BlobStoreCacheService; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; @@ -41,12 +41,12 @@ import org.elasticsearch.index.engine.EngineFactory; import org.elasticsearch.index.engine.FrozenEngine; import org.elasticsearch.index.engine.ReadOnlyEngine; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.index.store.Store; import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.TranslogStats; import org.elasticsearch.indices.SystemIndexDescriptor; -import org.elasticsearch.indices.recovery.SearchableSnapshotRecoveryState; +import org.elasticsearch.xpack.searchablesnapshots.recovery.SearchableSnapshotRecoveryState; import org.elasticsearch.license.LicenseUtils; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.plugins.ActionPlugin; @@ -74,17 +74,26 @@ import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; import org.elasticsearch.xpack.searchablesnapshots.action.ClearSearchableSnapshotsCacheAction; +import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsInfoTransportAction; import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsStatsAction; +import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsUsageTransportAction; import org.elasticsearch.xpack.searchablesnapshots.action.TransportClearSearchableSnapshotsCacheAction; import org.elasticsearch.xpack.searchablesnapshots.action.TransportMountSearchableSnapshotAction; import org.elasticsearch.xpack.searchablesnapshots.action.TransportSearchableSnapshotsStatsAction; import org.elasticsearch.xpack.searchablesnapshots.action.cache.FrozenCacheInfoAction; import org.elasticsearch.xpack.searchablesnapshots.action.cache.FrozenCacheInfoNodeAction; import org.elasticsearch.xpack.searchablesnapshots.action.cache.TransportSearchableSnapshotCacheStoresAction; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheInfoService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.PersistentCache; +import org.elasticsearch.xpack.searchablesnapshots.allocation.FailShardsOnInvalidLicenseClusterListener; +import org.elasticsearch.xpack.searchablesnapshots.allocation.SearchableSnapshotAllocator; +import org.elasticsearch.xpack.searchablesnapshots.allocation.SearchableSnapshotIndexEventListener; +import org.elasticsearch.xpack.searchablesnapshots.allocation.SearchableSnapshotIndexFoldersDeletionListener; +import org.elasticsearch.xpack.searchablesnapshots.allocation.decider.HasFrozenCacheAllocationDecider; +import org.elasticsearch.xpack.searchablesnapshots.allocation.decider.SearchableSnapshotAllocationDecider; +import org.elasticsearch.xpack.searchablesnapshots.allocation.decider.SearchableSnapshotEnableAllocationDecider; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheInfoService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.PersistentCache; import org.elasticsearch.xpack.searchablesnapshots.rest.RestClearSearchableSnapshotsCacheAction; import org.elasticsearch.xpack.searchablesnapshots.rest.RestMountSearchableSnapshotAction; import org.elasticsearch.xpack.searchablesnapshots.rest.RestSearchableSnapshotsStatsAction; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/AbstractTransportSearchableSnapshotsAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/AbstractTransportSearchableSnapshotsAction.java index 6a7ff48f12771..7fbac7dbd23a7 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/AbstractTransportSearchableSnapshotsAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/AbstractTransportSearchableSnapshotsAction.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.shard.IndexShard; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.tasks.Task; @@ -36,7 +36,7 @@ import java.util.List; import java.util.Objects; -import static org.elasticsearch.index.store.SearchableSnapshotDirectory.unwrapDirectory; +import static org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory.unwrapDirectory; public abstract class AbstractTransportSearchableSnapshotsAction< Request extends BroadcastRequest, diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsInfoTransportAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/SearchableSnapshotsInfoTransportAction.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsInfoTransportAction.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/SearchableSnapshotsInfoTransportAction.java index c4faaa90bd5c8..379550eaa8a68 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsInfoTransportAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/SearchableSnapshotsInfoTransportAction.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.action; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.common.inject.Inject; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsUsageTransportAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/SearchableSnapshotsUsageTransportAction.java similarity index 95% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsUsageTransportAction.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/SearchableSnapshotsUsageTransportAction.java index 9ff6e2083357d..cfeaf438ca170 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsUsageTransportAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/SearchableSnapshotsUsageTransportAction.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.action; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; @@ -23,6 +23,7 @@ import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse; import org.elasticsearch.xpack.core.action.XPackUsageFeatureTransportAction; import org.elasticsearch.xpack.core.searchablesnapshots.SearchableSnapshotFeatureSetUsage; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; public class SearchableSnapshotsUsageTransportAction extends XPackUsageFeatureTransportAction { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportClearSearchableSnapshotsCacheAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportClearSearchableSnapshotsCacheAction.java index baa8c034fdd2c..f8f854b6dd315 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportClearSearchableSnapshotsCacheAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportClearSearchableSnapshotsCacheAction.java @@ -15,7 +15,7 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.threadpool.ThreadPool; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java index 9488c63631263..3245136b4d1e2 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java @@ -39,7 +39,7 @@ import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction; import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest; -import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotAllocator; +import org.elasticsearch.xpack.searchablesnapshots.allocation.SearchableSnapshotAllocator; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportSearchableSnapshotsStatsAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportSearchableSnapshotsStatsAction.java index 391aeef7f4c95..9eb131c3e313e 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportSearchableSnapshotsStatsAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportSearchableSnapshotsStatsAction.java @@ -15,8 +15,8 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.threadpool.ThreadPool; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/FrozenCacheInfoNodeAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/FrozenCacheInfoNodeAction.java index e7437200a18ec..5a51df645f263 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/FrozenCacheInfoNodeAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/FrozenCacheInfoNodeAction.java @@ -21,7 +21,7 @@ import java.io.IOException; -import static org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING; +import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING; public class FrozenCacheInfoNodeAction extends ActionType { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java index 266fff8f37e29..b8a0ae7edd9fe 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java @@ -26,7 +26,7 @@ import org.elasticsearch.transport.TransportRequest; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; import java.io.IOException; import java.util.List; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/FailShardsOnInvalidLicenseClusterListener.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/FailShardsOnInvalidLicenseClusterListener.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/FailShardsOnInvalidLicenseClusterListener.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/FailShardsOnInvalidLicenseClusterListener.java index 9d3423ded1564..b6732b8160df4 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/FailShardsOnInvalidLicenseClusterListener.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/FailShardsOnInvalidLicenseClusterListener.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocator.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocator.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocator.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocator.java index 3e7b2aad942cd..75a1cda0e2e7c 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocator.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocator.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -41,10 +41,11 @@ import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.Snapshot; import org.elasticsearch.snapshots.SnapshotId; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; import org.elasticsearch.xpack.searchablesnapshots.action.cache.TransportSearchableSnapshotCacheStoresAction; import org.elasticsearch.xpack.searchablesnapshots.action.cache.TransportSearchableSnapshotCacheStoresAction.NodeCacheFilesMetadata; import org.elasticsearch.xpack.searchablesnapshots.action.cache.TransportSearchableSnapshotCacheStoresAction.NodesCacheFilesMetadata; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheInfoService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheInfoService; import java.util.ArrayList; import java.util.Collection; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotIndexEventListener.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotIndexEventListener.java similarity index 93% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotIndexEventListener.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotIndexEventListener.java index b60c94805232c..ded2accb2b753 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotIndexEventListener.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotIndexEventListener.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -22,17 +22,18 @@ import org.elasticsearch.index.shard.IndexEventListener; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.TranslogException; import org.elasticsearch.indices.cluster.IndicesClusterStateService.AllocatedIndices.IndexRemovalReason; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import java.nio.file.Path; -import static org.elasticsearch.index.store.SearchableSnapshotDirectory.unwrapDirectory; +import static org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory.unwrapDirectory; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_INDEX_NAME_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_SNAPSHOT_ID_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants.isSearchableSnapshotStore; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotIndexFoldersDeletionListener.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotIndexFoldersDeletionListener.java similarity index 92% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotIndexFoldersDeletionListener.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotIndexFoldersDeletionListener.java index dcef279ae851d..3833b4023648b 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotIndexFoldersDeletionListener.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotIndexFoldersDeletionListener.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -13,8 +13,9 @@ import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.plugins.IndexStorePlugin; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import java.nio.file.Path; import java.util.Objects; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/HasFrozenCacheAllocationDecider.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/HasFrozenCacheAllocationDecider.java similarity index 92% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/HasFrozenCacheAllocationDecider.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/HasFrozenCacheAllocationDecider.java index 50dae8203a8e1..76492e9cc2a5e 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/HasFrozenCacheAllocationDecider.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/HasFrozenCacheAllocationDecider.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation.decider; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.node.DiscoveryNode; @@ -15,10 +15,11 @@ import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.Decision; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheInfoService; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheInfoService; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants.SNAPSHOT_PARTIAL_SETTING; -import static org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING; +import static org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.SNAPSHOT_CACHE_SIZE_SETTING; public class HasFrozenCacheAllocationDecider extends AllocationDecider { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocationDecider.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotAllocationDecider.java similarity index 94% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocationDecider.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotAllocationDecider.java index 481bbe1dbf402..20e71c727fd31 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocationDecider.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotAllocationDecider.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation.decider; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.routing.RoutingNode; @@ -13,6 +13,7 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.Decision; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; import java.util.function.BooleanSupplier; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotEnableAllocationDecider.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotEnableAllocationDecider.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotEnableAllocationDecider.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotEnableAllocationDecider.java index 50d00276f37ed..0fa9f7d0d2d91 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotEnableAllocationDecider.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/allocation/decider/SearchableSnapshotEnableAllocationDecider.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation.decider; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.routing.RoutingNode; @@ -17,6 +17,7 @@ import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; public class SearchableSnapshotEnableAllocationDecider extends AllocationDecider { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/BlobStoreCacheService.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/BlobStoreCacheService.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/BlobStoreCacheService.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/BlobStoreCacheService.java index 9ca36b89dec03..5c2ed1e17d0f8 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/BlobStoreCacheService.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/BlobStoreCacheService.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.blobstore.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.blob; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,7 +39,7 @@ import org.elasticsearch.node.NodeClosedException; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.ConnectTransportException; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; import java.time.Instant; import java.util.Set; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/CachedBlob.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/CachedBlob.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/CachedBlob.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/CachedBlob.java index 323e60a9e91a6..fb9a565d4601d 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/CachedBlob.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/CachedBlob.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.blobstore.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.blob; import org.elasticsearch.Version; import org.elasticsearch.common.bytes.BytesArray; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/ByteRange.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ByteRange.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/ByteRange.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ByteRange.java index b8df989b03a75..6c7f6f3e5b30f 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/ByteRange.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ByteRange.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.elasticsearch.common.Nullable; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CacheFile.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFile.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CacheFile.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFile.java index 14d90ce798945..c35484fe5532b 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CacheFile.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFile.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.apache.lucene.store.AlreadyClosedException; import org.elasticsearch.action.ActionListener; @@ -15,7 +15,6 @@ import org.elasticsearch.common.util.concurrent.AbstractRefCounted; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.core.internal.io.IOUtils; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; import java.io.IOException; import java.io.UncheckedIOException; @@ -325,12 +324,12 @@ private static void throwAlreadyEvicted() { } @FunctionalInterface - interface RangeAvailableHandler { + public interface RangeAvailableHandler { int onRangeAvailable(FileChannel channel) throws IOException; } @FunctionalInterface - interface RangeMissingHandler { + public interface RangeMissingHandler { void fillCacheRange(FileChannel channel, long from, long to, Consumer progressUpdater) throws IOException; } @@ -342,7 +341,7 @@ interface RangeMissingHandler { * * @return a future which returns the result of the {@link RangeAvailableHandler} once it has completed. */ - Future populateAndRead( + public Future populateAndRead( final ByteRange rangeToWrite, final ByteRange rangeToRead, final RangeAvailableHandler reader, @@ -401,7 +400,7 @@ public void onFailure(Exception e) { * target range is neither available nor pending. */ @Nullable - Future readIfAvailableOrPending(final ByteRange rangeToRead, final RangeAvailableHandler reader) { + public Future readIfAvailableOrPending(final ByteRange rangeToRead, final RangeAvailableHandler reader) { final PlainActionFuture future = PlainActionFuture.newFuture(); Releasable decrementRef = null; try { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CacheKey.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheKey.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CacheKey.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheKey.java index d04db83ce0196..314ce8ef894fb 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CacheKey.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheKey.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.elasticsearch.index.shard.ShardId; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/ProgressListenableActionFuture.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ProgressListenableActionFuture.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/ProgressListenableActionFuture.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ProgressListenableActionFuture.java index c014204e90d93..78ea71e6f04a9 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/ProgressListenableActionFuture.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ProgressListenableActionFuture.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/SparseFileTracker.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/SparseFileTracker.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/SparseFileTracker.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/SparseFileTracker.java index 1a80bb7bb7d27..59794c0558a30 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/SparseFileTracker.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/SparseFileTracker.java @@ -4,13 +4,12 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.elasticsearch.Assertions; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.GroupedActionListener; import org.elasticsearch.common.Nullable; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; import java.util.ArrayList; import java.util.Collections; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/CacheService.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheService.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/CacheService.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheService.java index e2f017855e81c..819e5e7349094 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/CacheService.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheService.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.full; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,11 +28,13 @@ import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardPath; -import org.elasticsearch.index.store.cache.CacheFile; -import org.elasticsearch.index.store.cache.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import java.io.FileNotFoundException; import java.io.IOException; @@ -58,7 +60,7 @@ /** * {@link CacheService} maintains a cache entry for all files read from searchable snapshot directories (see - * {@link org.elasticsearch.index.store.SearchableSnapshotDirectory}). + * {@link SearchableSnapshotDirectory}). * * Cache files created by this service are periodically synchronized on disk in order to make the cached data durable * (see {@link #synchronizeCache()} for more information). diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/PersistentCache.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/PersistentCache.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/PersistentCache.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/PersistentCache.java index ceaa1fca4bcad..975fa2aabaa40 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/PersistentCache.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/PersistentCache.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.full; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,10 +49,11 @@ import org.elasticsearch.index.Index; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardPath; -import org.elasticsearch.index.store.cache.CacheFile; -import org.elasticsearch.index.store.cache.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.SnapshotId; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; import java.io.Closeable; import java.io.IOException; @@ -79,8 +80,8 @@ import static java.util.Collections.synchronizedMap; import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableSortedSet; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.getShardCachePath; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.resolveSnapshotCache; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.getShardCachePath; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.resolveSnapshotCache; public class PersistentCache implements Closeable { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheInfoService.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheInfoService.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheInfoService.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheInfoService.java index 1efea616fa461..0ffb03910f805 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheInfoService.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheInfoService.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.shared; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheService.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheService.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheService.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheService.java index 3342afe0ac370..9dbb3d10a73cc 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheService.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheService.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.shared; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -30,11 +30,12 @@ import org.elasticsearch.common.util.concurrent.KeyedLock; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.index.store.cache.CacheKey; -import org.elasticsearch.index.store.cache.SparseFileTracker; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.SparseFileTracker; import org.elasticsearch.node.NodeRoleSettings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.DataTier; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/SharedBytes.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/SharedBytes.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/SharedBytes.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/SharedBytes.java index 28a2914c89486..9c7aea401076a 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/SharedBytes.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/SharedBytes.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.shared; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/indices/recovery/SearchableSnapshotRecoveryState.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryState.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/indices/recovery/SearchableSnapshotRecoveryState.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryState.java index 9e236d6952770..cccdc759f3bcf 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/indices/recovery/SearchableSnapshotRecoveryState.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryState.java @@ -5,11 +5,12 @@ * 2.0. */ -package org.elasticsearch.indices.recovery; +package org.elasticsearch.xpack.searchablesnapshots.recovery; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Nullable; +import org.elasticsearch.indices.recovery.RecoveryState; import java.util.HashSet; import java.util.Set; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/InMemoryNoOpCommitDirectory.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/InMemoryNoOpCommitDirectory.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/InMemoryNoOpCommitDirectory.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/InMemoryNoOpCommitDirectory.java index 1bbeb71e12856..578bfbadf176a 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/InMemoryNoOpCommitDirectory.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/InMemoryNoOpCommitDirectory.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.apache.lucene.store.ByteBuffersDirectory; import org.apache.lucene.store.Directory; @@ -14,6 +14,7 @@ import org.apache.lucene.store.IndexOutput; import org.apache.lucene.store.NoLockFactory; import org.elasticsearch.core.internal.io.IOUtils; +import org.elasticsearch.index.store.ImmutableDirectoryException; import java.io.FileNotFoundException; import java.io.IOException; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/IndexInputStats.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/IndexInputStats.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/IndexInputStats.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/IndexInputStats.java index b9d3e9db399ee..b18c9e46adc16 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/IndexInputStats.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/IndexInputStats.java @@ -4,13 +4,13 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.index.store.cache.CachedBlobContainerIndexInput; +import org.elasticsearch.xpack.searchablesnapshots.store.input.CachedBlobContainerIndexInput; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.LongAdder; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/SearchableSnapshotDirectory.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectory.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/SearchableSnapshotDirectory.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectory.java index d7763865e051a..baec4e18a574d 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/SearchableSnapshotDirectory.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectory.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -22,8 +22,9 @@ import org.elasticsearch.action.ActionRunnable; import org.elasticsearch.action.StepListener; import org.elasticsearch.action.support.GroupedActionListener; -import org.elasticsearch.blobstore.cache.BlobStoreCacheService; -import org.elasticsearch.blobstore.cache.CachedBlob; +import org.elasticsearch.index.store.Store; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.BlobStoreCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.CachedBlob; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.routing.RecoverySource; import org.elasticsearch.common.CheckedRunnable; @@ -43,14 +44,12 @@ import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardPath; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot; -import org.elasticsearch.index.store.cache.CacheFile; -import org.elasticsearch.index.store.cache.CacheKey; -import org.elasticsearch.index.store.cache.CachedBlobContainerIndexInput; -import org.elasticsearch.index.store.cache.FrozenIndexInput; -import org.elasticsearch.index.store.checksum.ChecksumBlobContainerIndexInput; -import org.elasticsearch.index.store.direct.DirectBlobContainerIndexInput; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.store.input.CachedBlobContainerIndexInput; +import org.elasticsearch.xpack.searchablesnapshots.store.input.FrozenIndexInput; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.indices.recovery.SearchableSnapshotRecoveryState; +import org.elasticsearch.xpack.searchablesnapshots.recovery.SearchableSnapshotRecoveryState; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.repositories.RepositoriesService; import org.elasticsearch.repositories.Repository; @@ -60,10 +59,12 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService.FrozenCacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.FrozenCacheFile; +import org.elasticsearch.xpack.searchablesnapshots.store.input.ChecksumBlobContainerIndexInput; +import org.elasticsearch.xpack.searchablesnapshots.store.input.DirectBlobContainerIndexInput; import java.io.FileNotFoundException; import java.io.IOException; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/BaseSearchableSnapshotIndexInput.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/BaseSearchableSnapshotIndexInput.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/BaseSearchableSnapshotIndexInput.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/BaseSearchableSnapshotIndexInput.java index b654dc24785fc..551d1eba5f6b7 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/BaseSearchableSnapshotIndexInput.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/BaseSearchableSnapshotIndexInput.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.logging.log4j.Logger; import org.apache.lucene.codecs.CodecUtil; @@ -15,7 +15,9 @@ import org.elasticsearch.index.snapshots.blobstore.SlicedInputStream; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import java.io.IOException; import java.io.InputStream; @@ -24,7 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Predicate; -import static org.elasticsearch.index.store.checksum.ChecksumBlobContainerIndexInput.checksumToBytesArray; +import static org.elasticsearch.xpack.searchablesnapshots.store.input.ChecksumBlobContainerIndexInput.checksumToBytesArray; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsUtils.toIntBytes; public abstract class BaseSearchableSnapshotIndexInput extends BufferedIndexInput { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInput.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInput.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInput.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInput.java index 365bf5c6c2c75..5b80e342c6d17 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInput.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInput.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,9 +15,10 @@ import org.apache.lucene.store.IndexInput; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; import java.io.IOException; import java.io.InputStream; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/checksum/ChecksumBlobContainerIndexInput.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/ChecksumBlobContainerIndexInput.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/checksum/ChecksumBlobContainerIndexInput.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/ChecksumBlobContainerIndexInput.java index c58f60ae19289..aac42c81334e6 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/checksum/ChecksumBlobContainerIndexInput.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/ChecksumBlobContainerIndexInput.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.checksum; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.store.ByteArrayDataOutput; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/direct/DirectBlobContainerIndexInput.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/DirectBlobContainerIndexInput.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/direct/DirectBlobContainerIndexInput.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/DirectBlobContainerIndexInput.java index 6d308d97dcd3d..e8eb151bc84a9 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/direct/DirectBlobContainerIndexInput.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/DirectBlobContainerIndexInput.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.direct; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,10 +16,9 @@ import org.elasticsearch.common.blobstore.BlobContainer; import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; -import org.elasticsearch.index.store.BaseSearchableSnapshotIndexInput; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import java.io.Closeable; import java.io.EOFException; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/FrozenIndexInput.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInput.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/FrozenIndexInput.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInput.java index 776008c0965b9..be8be342def34 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/FrozenIndexInput.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInput.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,11 +16,11 @@ import org.apache.lucene.store.IndexInput; import org.elasticsearch.action.StepListener; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService.FrozenCacheFile; -import org.elasticsearch.xpack.searchablesnapshots.cache.SharedBytes; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.FrozenCacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.SharedBytes; import java.io.EOFException; import java.io.IOException; diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/MetadataCachingIndexInput.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/MetadataCachingIndexInput.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/MetadataCachingIndexInput.java rename to x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/MetadataCachingIndexInput.java index 181182f9c02b6..2a1acb95de6d8 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/MetadataCachingIndexInput.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/MetadataCachingIndexInput.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; @@ -14,18 +14,19 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefIterator; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.blobstore.cache.BlobStoreCacheService; -import org.elasticsearch.blobstore.cache.CachedBlob; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.BlobStoreCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.CachedBlob; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.Channels; import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot; -import org.elasticsearch.index.store.BaseSearchableSnapshotIndexInput; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; import java.io.EOFException; import java.io.IOException; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsTestCase.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsTestCase.java index 948ace58ddaea..f580ec6c3be7e 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsTestCase.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsTestCase.java @@ -35,10 +35,10 @@ import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.store.Store; -import org.elasticsearch.index.store.cache.CacheFile; -import org.elasticsearch.index.store.cache.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.indices.recovery.SearchableSnapshotRecoveryState; +import org.elasticsearch.xpack.searchablesnapshots.recovery.SearchableSnapshotRecoveryState; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.Snapshot; import org.elasticsearch.snapshots.SnapshotId; @@ -47,10 +47,10 @@ import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolStats; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.PersistentCache; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.PersistentCache; import org.junit.After; import org.junit.Before; @@ -69,7 +69,7 @@ import java.util.concurrent.TimeUnit; import static com.carrotsearch.randomizedtesting.RandomizedTest.randomAsciiLettersOfLengthBetween; -import static org.elasticsearch.index.store.cache.TestUtils.randomPopulateAndReads; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.randomPopulateAndReads; public abstract class AbstractSearchableSnapshotsTestCase extends ESIndexInputTestCase { diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocatorTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocatorTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocatorTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocatorTests.java index 50d209bbd2ec6..4c8b5c2ce1b33 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotAllocatorTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/allocation/SearchableSnapshotAllocatorTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots; +package org.elasticsearch.xpack.searchablesnapshots.allocation; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; @@ -39,8 +39,9 @@ import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.snapshots.SnapshotShardSizeInfo; import org.elasticsearch.test.client.NoOpNodeClient; +import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; import org.elasticsearch.xpack.searchablesnapshots.action.cache.TransportSearchableSnapshotCacheStoresAction; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheInfoService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheInfoService; import java.util.Collections; import java.util.List; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/blobstore/cache/BlobStoreCacheServiceTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/BlobStoreCacheServiceTests.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/blobstore/cache/BlobStoreCacheServiceTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/BlobStoreCacheServiceTests.java index 2c5bcf9e32cb5..b03fbe4e113a7 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/blobstore/cache/BlobStoreCacheServiceTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/BlobStoreCacheServiceTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.blobstore.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.blob; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.get.GetAction; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CacheFileTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFileTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CacheFileTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFileTests.java index d948fa630b568..74c710bbc617f 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CacheFileTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheFileTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.apache.lucene.store.AlreadyClosedException; import org.apache.lucene.util.SetOnce; @@ -13,11 +13,10 @@ import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.io.PathUtilsForTesting; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.index.store.cache.CacheFile.EvictionListener; -import org.elasticsearch.index.store.cache.TestUtils.FSyncTrackingFileSystemProvider; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile.EvictionListener; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.FSyncTrackingFileSystemProvider; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; import org.hamcrest.Matcher; import java.io.IOException; @@ -37,7 +36,7 @@ import java.util.concurrent.Future; import static org.elasticsearch.common.settings.Settings.builder; -import static org.elasticsearch.index.store.cache.TestUtils.randomPopulateAndReads; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.randomPopulateAndReads; import static org.elasticsearch.node.Node.NODE_NAME_SETTING; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CacheKeyTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheKeyTests.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CacheKeyTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheKeyTests.java index 4c389c287cbcd..3c3dfdf0bf687 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CacheKeyTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/CacheKeyTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.elasticsearch.common.UUIDs; import org.elasticsearch.index.Index; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/ProgressListenableActionFutureTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ProgressListenableActionFutureTests.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/ProgressListenableActionFutureTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ProgressListenableActionFutureTests.java index 3b74e908b73b1..82f287f236c1b 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/ProgressListenableActionFutureTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/ProgressListenableActionFutureTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.apache.lucene.util.SetOnce; import org.elasticsearch.ElasticsearchException; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/SparseFileTrackerTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/SparseFileTrackerTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/SparseFileTrackerTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/SparseFileTrackerTests.java index 97d541e342f77..a5a991a00f502 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/SparseFileTrackerTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/SparseFileTrackerTests.java @@ -4,14 +4,13 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.cluster.coordination.DeterministicTaskQueue; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; import java.util.Collections; import java.util.HashSet; @@ -25,8 +24,8 @@ import java.util.function.Consumer; import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentSet; -import static org.elasticsearch.index.store.cache.TestUtils.mergeContiguousRanges; -import static org.elasticsearch.index.store.cache.TestUtils.randomRanges; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.mergeContiguousRanges; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.randomRanges; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsUtils.toIntBytes; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/TestUtils.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/TestUtils.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/TestUtils.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/TestUtils.java index c032b91fa96b6..8847ca2b2a310 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/TestUtils.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/common/TestUtils.java @@ -4,15 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.common; import org.apache.lucene.mockfile.FilterFileChannel; import org.apache.lucene.mockfile.FilterFileSystemProvider; import org.apache.lucene.mockfile.FilterPath; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.blobstore.cache.BlobStoreCacheService; -import org.elasticsearch.blobstore.cache.CachedBlob; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.BlobStoreCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.CachedBlob; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.coordination.DeterministicTaskQueue; import org.elasticsearch.common.Nullable; @@ -26,8 +26,7 @@ import org.elasticsearch.common.io.PathUtilsForTesting; import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; import java.io.ByteArrayInputStream; import java.io.FileNotFoundException; @@ -200,7 +199,7 @@ public InputStream readBlob(String name, long position, long length) throws IOEx }; } - static BlobContainer singleSplitBlobContainer(final String blobName, final byte[] blobContent, final int partSize) { + public static BlobContainer singleSplitBlobContainer(final String blobName, final byte[] blobContent, final int partSize) { if (partSize >= blobContent.length) { return singleBlobContainer(blobName, blobContent); } else { diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/CacheServiceTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheServiceTests.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/CacheServiceTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheServiceTests.java index e2fed30beee35..7023af895c8c2 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/CacheServiceTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheServiceTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.full; import org.apache.lucene.util.Constants; import org.apache.lucene.util.LuceneTestCase; @@ -19,11 +19,12 @@ import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.index.Index; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.index.store.cache.CacheFile; -import org.elasticsearch.index.store.cache.CacheKey; -import org.elasticsearch.index.store.cache.TestUtils.FSyncTrackingFileSystemProvider; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.FSyncTrackingFileSystemProvider; import org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsTestCase; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.ShardEviction; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.ShardEviction; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -41,9 +42,9 @@ import java.util.stream.Collectors; import static java.util.Collections.emptySortedSet; -import static org.elasticsearch.index.store.cache.TestUtils.randomPopulateAndReads; -import static org.elasticsearch.index.store.cache.TestUtils.randomRanges; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.resolveSnapshotCache; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.randomPopulateAndReads; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.randomRanges; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.resolveSnapshotCache; import static org.hamcrest.Matchers.aMapWithSize; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/PersistentCacheTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/PersistentCacheTests.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/PersistentCacheTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/PersistentCacheTests.java index d75f727988f55..0f89ccb68768f 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/PersistentCacheTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/PersistentCacheTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.full; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -21,10 +21,11 @@ import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.env.Environment; import org.elasticsearch.env.NodeEnvironment; -import org.elasticsearch.index.store.cache.CacheFile; -import org.elasticsearch.index.store.cache.CacheKey; import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsTestCase; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFile; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; import java.io.IOException; import java.nio.channels.FileChannel; @@ -47,12 +48,12 @@ import static org.elasticsearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; import static org.elasticsearch.cluster.node.DiscoveryNodeRole.DATA_ROLE; -import static org.elasticsearch.index.store.cache.TestUtils.assertCacheFileEquals; -import static org.elasticsearch.index.store.cache.TestUtils.randomPopulateAndReads; -import static org.elasticsearch.index.store.cache.TestUtils.sumOfCompletedRangesLengths; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.assertCacheFileEquals; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.randomPopulateAndReads; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.sumOfCompletedRangesLengths; import static org.elasticsearch.node.NodeRoleSettings.NODE_ROLES_SETTING; -import static org.elasticsearch.xpack.searchablesnapshots.cache.PersistentCache.createCacheIndexWriter; -import static org.elasticsearch.xpack.searchablesnapshots.cache.PersistentCache.resolveCacheIndexFolder; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.PersistentCache.createCacheIndexWriter; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.PersistentCache.resolveCacheIndexFolder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.not; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheServiceTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheServiceTests.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheServiceTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheServiceTests.java index d44a089386efd..c8b78eada8d7b 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheServiceTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/cache/shared/FrozenCacheServiceTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.xpack.searchablesnapshots.cache; +package org.elasticsearch.xpack.searchablesnapshots.cache.shared; import org.elasticsearch.cluster.coordination.DeterministicTaskQueue; import org.elasticsearch.cluster.node.DiscoveryNode; @@ -13,12 +13,13 @@ import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.index.store.cache.CacheKey; import org.elasticsearch.node.NodeRoleSettings; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.DataTier; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService.CacheFileRegion; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheKey; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.CacheFileRegion; import java.io.IOException; import java.util.Set; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/indices/recovery/SearchableSnapshotsRecoveryStateTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotsRecoveryStateTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/indices/recovery/SearchableSnapshotsRecoveryStateTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotsRecoveryStateTests.java index 54da35887f1bd..c7defb8982adb 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/indices/recovery/SearchableSnapshotsRecoveryStateTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotsRecoveryStateTests.java @@ -5,13 +5,14 @@ * 2.0. */ -package org.elasticsearch.indices.recovery; +package org.elasticsearch.xpack.searchablesnapshots.recovery; import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.TestShardRouting; +import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.test.ESTestCase; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/InMemoryNoOpCommitDirectoryTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/InMemoryNoOpCommitDirectoryTests.java similarity index 99% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/InMemoryNoOpCommitDirectoryTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/InMemoryNoOpCommitDirectoryTests.java index 740fa094d3364..ea4c469ed94b4 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/InMemoryNoOpCommitDirectoryTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/InMemoryNoOpCommitDirectoryTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/IndexInputStatsTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/IndexInputStatsTests.java similarity index 95% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/IndexInputStatsTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/IndexInputStatsTests.java index 0df3fb3d1f349..98b93c926c2f1 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/IndexInputStatsTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/IndexInputStatsTests.java @@ -4,14 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.elasticsearch.test.ESTestCase; import java.util.function.LongSupplier; -import static org.elasticsearch.index.store.IndexInputStats.SEEKING_THRESHOLD; -import static org.elasticsearch.index.store.cache.TestUtils.assertCounter; +import static org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats.SEEKING_THRESHOLD; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.assertCounter; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsUtils.toIntBytes; public class IndexInputStatsTests extends ESTestCase { diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectoryStatsTests.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectoryStatsTests.java index 944860c25132c..6cd5eba0caafc 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryStatsTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectoryStatsTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.apache.lucene.store.BufferedIndexInput; import org.apache.lucene.store.IOContext; @@ -28,18 +28,19 @@ import org.elasticsearch.index.shard.ShardPath; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; -import org.elasticsearch.index.store.cache.TestUtils; -import org.elasticsearch.index.store.cache.TestUtils.NoopBlobStoreCacheService; +import org.elasticsearch.index.store.StoreFileMetadata; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.NoopBlobStoreCacheService; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.indices.recovery.SearchableSnapshotRecoveryState; +import org.elasticsearch.xpack.searchablesnapshots.recovery.SearchableSnapshotRecoveryState; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.Snapshot; import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsTestCase; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.SharedBytes; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.SharedBytes; import java.io.IOException; import java.nio.file.Files; @@ -48,13 +49,13 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.LongSupplier; -import static org.elasticsearch.index.store.cache.TestUtils.assertCounter; -import static org.elasticsearch.index.store.cache.TestUtils.singleBlobContainer; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.assertCounter; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.singleBlobContainer; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_UNCACHED_CHUNK_SIZE_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsUtils.toIntBytes; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.resolveSnapshotCache; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.resolveSnapshotCache; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectoryTests.java similarity index 98% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectoryTests.java index 1cc4fcc3b9ed6..bf449bd65045d 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotDirectoryTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectoryTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store; +package org.elasticsearch.xpack.searchablesnapshots.store; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.document.Document; @@ -73,12 +73,14 @@ import org.elasticsearch.index.shard.ShardPath; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot; -import org.elasticsearch.index.store.cache.TestUtils; -import org.elasticsearch.index.store.checksum.ChecksumBlobContainerIndexInput; +import org.elasticsearch.index.store.Store; +import org.elasticsearch.index.store.StoreFileMetadata; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils; +import org.elasticsearch.xpack.searchablesnapshots.store.input.ChecksumBlobContainerIndexInput; import org.elasticsearch.index.translog.Translog; import org.elasticsearch.indices.recovery.RecoverySettings; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.indices.recovery.SearchableSnapshotRecoveryState; +import org.elasticsearch.xpack.searchablesnapshots.recovery.SearchableSnapshotRecoveryState; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.repositories.blobstore.BlobStoreRepository; import org.elasticsearch.repositories.blobstore.BlobStoreTestUtil; @@ -87,8 +89,8 @@ import org.elasticsearch.test.DummyShardLock; import org.elasticsearch.test.IndexSettingsModule; import org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsTestCase; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import org.hamcrest.Matcher; import java.io.Closeable; @@ -117,7 +119,7 @@ import java.util.stream.Collectors; import static java.util.Collections.emptyMap; -import static org.elasticsearch.index.store.SearchableSnapshotDirectory.getNonNullFileExt; +import static org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory.getNonNullFileExt; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_EXCLUDED_FILE_TYPES_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING; @@ -127,7 +129,7 @@ import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_SNAPSHOT_ID_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_SNAPSHOT_NAME_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsUtils.toIntBytes; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.resolveSnapshotCache; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.resolveSnapshotCache; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInputTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInputTests.java similarity index 95% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInputTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInputTests.java index 3f342c5fd9dc3..0d374a549c10d 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInputTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInputTests.java @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.lucene.store.IndexInput; import org.elasticsearch.ExceptionsHelper; @@ -18,15 +18,16 @@ import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardPath; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.index.store.StoreFileMetadata; -import org.elasticsearch.index.store.cache.TestUtils.NoopBlobStoreCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.NoopBlobStoreCacheService; import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsTestCase; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; import java.io.EOFException; import java.io.FilterInputStream; @@ -41,11 +42,11 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.LongAdder; -import static org.elasticsearch.index.store.cache.TestUtils.singleBlobContainer; -import static org.elasticsearch.index.store.cache.TestUtils.singleSplitBlobContainer; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.singleBlobContainer; +import static org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils.singleSplitBlobContainer; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING; import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.resolveSnapshotCache; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.resolveSnapshotCache; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/checksum/ChecksumBlobContainerIndexInputTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/ChecksumBlobContainerIndexInputTests.java similarity index 96% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/checksum/ChecksumBlobContainerIndexInputTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/ChecksumBlobContainerIndexInputTests.java index 26b615a755b3e..d469887879cef 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/checksum/ChecksumBlobContainerIndexInputTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/ChecksumBlobContainerIndexInputTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.checksum; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.lucene.codecs.CodecUtil; import org.elasticsearch.common.collect.Tuple; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/direct/DirectBlobContainerIndexInputTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/DirectBlobContainerIndexInputTests.java similarity index 97% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/direct/DirectBlobContainerIndexInputTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/DirectBlobContainerIndexInputTests.java index 91a5d098298e9..8a08ed4459beb 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/direct/DirectBlobContainerIndexInputTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/DirectBlobContainerIndexInputTests.java @@ -4,21 +4,21 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -package org.elasticsearch.index.store.direct; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.lucene.store.BufferedIndexInput; import org.apache.lucene.util.Version; -import org.elasticsearch.blobstore.cache.CachedBlob; +import org.elasticsearch.xpack.searchablesnapshots.cache.blob.CachedBlob; import org.elasticsearch.common.blobstore.BlobContainer; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.store.ESIndexInputTestCase; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; -import org.elasticsearch.index.store.IndexInputStats; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.store.IndexInputStats; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.index.store.StoreFileMetadata; -import org.elasticsearch.xpack.searchablesnapshots.cache.ByteRange; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.ByteRange; import java.io.ByteArrayInputStream; import java.io.EOFException; diff --git a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/FrozenIndexInputTests.java b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInputTests.java similarity index 93% rename from x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/FrozenIndexInputTests.java rename to x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInputTests.java index 7b71c62a2abda..9d4f48d127c64 100644 --- a/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/cache/FrozenIndexInputTests.java +++ b/x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInputTests.java @@ -5,7 +5,7 @@ * 2.0. */ -package org.elasticsearch.index.store.cache; +package org.elasticsearch.xpack.searchablesnapshots.store.input; import org.apache.lucene.store.IndexInput; import org.elasticsearch.Version; @@ -21,23 +21,24 @@ import org.elasticsearch.index.shard.ShardPath; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; -import org.elasticsearch.index.store.SearchableSnapshotDirectory; +import org.elasticsearch.xpack.searchablesnapshots.cache.common.TestUtils; +import org.elasticsearch.xpack.searchablesnapshots.store.SearchableSnapshotDirectory; import org.elasticsearch.index.store.StoreFileMetadata; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.SnapshotId; import org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsTestCase; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots; import org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants; -import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.FrozenCacheService; -import org.elasticsearch.xpack.searchablesnapshots.cache.SharedBytes; +import org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService; +import org.elasticsearch.xpack.searchablesnapshots.cache.shared.SharedBytes; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; -import static org.elasticsearch.xpack.searchablesnapshots.cache.CacheService.resolveSnapshotCache; +import static org.elasticsearch.xpack.searchablesnapshots.cache.full.CacheService.resolveSnapshotCache; import static org.hamcrest.Matchers.instanceOf; public class FrozenIndexInputTests extends AbstractSearchableSnapshotsTestCase {