Move cache serializers to dedicated subpackage

Change-Id: Ia6a9814529ed958ee76202cf9e299ad04d7922fc
This commit is contained in:
Dave Borowitz
2018-08-02 11:26:19 -07:00
parent f8a5896cc3
commit ea2e464368
44 changed files with 93 additions and 59 deletions

View File

@@ -20,6 +20,7 @@ import com.google.common.cache.LoadingCache;
import com.google.common.cache.Weigher;
import com.google.gerrit.extensions.annotations.Exports;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.server.cache.serialize.JavaCacheSerializer;
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.Scopes;

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.server.cache;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.Weigher;
import com.google.gerrit.server.cache.serialize.CacheSerializer;
import java.time.Duration;
/** Configure a persistent cache declared within a {@link CacheModule} instance. */

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.server.cache;
import com.google.gerrit.server.cache.serialize.CacheSerializer;
public interface PersistentCacheDef<K, V> extends CacheDef<K, V> {
long diskLimit();

View File

@@ -20,6 +20,8 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.Weigher;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.cache.serialize.CacheSerializer;
import com.google.gerrit.server.cache.serialize.JavaCacheSerializer;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.TypeLiteral;

View File

@@ -8,6 +8,7 @@ java_library(
"//java/com/google/gerrit/extensions:api",
"//java/com/google/gerrit/lifecycle",
"//java/com/google/gerrit/server",
"//java/com/google/gerrit/server/cache/serialize",
"//lib:guava",
"//lib:h2",
"//lib/flogger:api",

View File

@@ -17,9 +17,9 @@ package com.google.gerrit.server.cache.h2;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.Weigher;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.cache.CacheSerializer;
import com.google.gerrit.server.cache.PersistentCacheDef;
import com.google.gerrit.server.cache.h2.H2CacheImpl.ValueHolder;
import com.google.gerrit.server.cache.serialize.CacheSerializer;
import com.google.inject.TypeLiteral;
import java.time.Duration;

View File

@@ -25,8 +25,8 @@ import com.google.common.flogger.FluentLogger;
import com.google.common.hash.BloomFilter;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.server.cache.CacheSerializer;
import com.google.gerrit.server.cache.PersistentCache;
import com.google.gerrit.server.cache.serialize.CacheSerializer;
import com.google.inject.TypeLiteral;
import java.io.IOException;
import java.io.InvalidClassException;

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.server.cache.h2;
import com.google.common.hash.Funnel;
import com.google.common.hash.Funnels;
import com.google.common.hash.PrimitiveSink;
import com.google.gerrit.server.cache.CacheSerializer;
import com.google.gerrit.server.cache.serialize.CacheSerializer;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@@ -0,0 +1,12 @@
java_library(
name = "serialize",
srcs = glob(["*.java"]),
visibility = ["//visibility:public"],
deps = [
"//java/com/google/gerrit/common:annotations",
"//lib:guava",
"//lib:gwtorm",
"//lib:protobuf",
"//lib/jgit/org.eclipse.jgit:jgit",
],
)

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
/**
* Interface for serializing/deserializing a type to/from a persistent cache.

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import static com.google.common.base.Preconditions.checkNotNull;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import static com.google.common.base.Preconditions.checkNotNull;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import com.google.gerrit.common.Nullable;
import java.io.ByteArrayInputStream;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import static com.google.common.base.Preconditions.checkArgument;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.cache;
package com.google.gerrit.server.cache.serialize;
import static java.nio.charset.StandardCharsets.UTF_8;

View File

@@ -5,6 +5,7 @@ java_library(
srcs = glob(["*.java"]),
visibility = ["//visibility:public"],
deps = [
"//java/com/google/gerrit/server/cache/serialize",
"//lib:guava",
"//lib:protobuf",
"//lib/commons:lang3",