diff --git a/docs/app-engine-architecture.md b/docs/app-engine-architecture.md index 9b5045b46..535b924a0 100644 --- a/docs/app-engine-architecture.md +++ b/docs/app-engine-architecture.md @@ -343,8 +343,6 @@ registry codebase: * `Lock` -- Lock entities are used to control access to a shared resource such as an App Engine queue. Under ordinary circumstances, these locks will be cleaned up automatically, and should not accumulate. -* `LogsExportCursor` -- This is a single entity which maintains the state of - log export. * `MR-*` -- These entities are generated by the App Engine MapReduce library in the course of running MapReduces. * `Modification` -- A Modification is a special type of billing event which diff --git a/java/google/registry/model/EntityClasses.java b/java/google/registry/model/EntityClasses.java index 1e8f2e907..bfaf77eae 100644 --- a/java/google/registry/model/EntityClasses.java +++ b/java/google/registry/model/EntityClasses.java @@ -29,7 +29,6 @@ import google.registry.model.domain.DomainApplication; import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainResource; import google.registry.model.domain.LrpTokenEntity; -import google.registry.model.export.LogsExportCursor; import google.registry.model.host.HostResource; import google.registry.model.index.DomainApplicationIndex; import google.registry.model.index.EppResourceIndex; @@ -95,7 +94,6 @@ public final class EntityClasses { KmsSecret.class, KmsSecretRevision.class, Lock.class, - LogsExportCursor.class, LrpTokenEntity.class, PollMessage.class, PollMessage.Autorenew.class, diff --git a/java/google/registry/model/common/PersistedRangeLong.java b/java/google/registry/model/common/PersistedRangeLong.java deleted file mode 100644 index 2b4f92baa..000000000 --- a/java/google/registry/model/common/PersistedRangeLong.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.model.common; - -import com.google.common.collect.BoundType; -import com.google.common.collect.Range; -import com.googlecode.objectify.annotation.Embed; -import google.registry.model.ImmutableObject; - -/** An object that's equivalent to a {@code Range} that can be persisted to Datastore. */ -@Embed -public class PersistedRangeLong extends ImmutableObject { - - private Long lowerBound = null; - private BoundType lowerBoundType = null; - - private Long upperBound = null; - private BoundType upperBoundType = null; - - public Range asRange() { - Range range = Range.all(); - if (lowerBound != null) { - range = range.intersection(Range.downTo(lowerBound, lowerBoundType)); - } - if (upperBound != null) { - range = range.intersection(Range.upTo(upperBound, upperBoundType)); - } - return range; - } - - public static PersistedRangeLong create(Range range) { - PersistedRangeLong instance = new PersistedRangeLong(); - if (range.hasLowerBound()) { - instance.lowerBound = range.lowerEndpoint(); - instance.lowerBoundType = range.lowerBoundType(); - } - if (range.hasUpperBound()) { - instance.upperBound = range.upperEndpoint(); - instance.upperBoundType = range.upperBoundType(); - } - return instance; - } -} diff --git a/java/google/registry/model/export/LogsExportCursor.java b/java/google/registry/model/export/LogsExportCursor.java deleted file mode 100644 index f925cd8cb..000000000 --- a/java/google/registry/model/export/LogsExportCursor.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.model.export; - -import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.googlecode.objectify.annotation.Entity; -import google.registry.model.Buildable; -import google.registry.model.common.CrossTldSingleton; -import google.registry.model.common.PersistedRangeLong; -import java.util.List; -import java.util.Set; - -/** A saved cursor of exported log records so far. */ -@Entity -public class LogsExportCursor extends CrossTldSingleton implements Buildable { - - /** - * A set of timestamp ranges (expressesd in microseconds since the epoch) that have been exported - * to GCS. - */ - Set exportedRanges; - - /** - * A list of filenames that are pending import into bigquery. Files may not have been imported - * into bigquery on previous iterations if there are gaps in the exported ranges. - */ - List filesPendingImport; - - public ImmutableSet getExportedRanges() { - return nullToEmptyImmutableCopy(exportedRanges); - } - - public ImmutableList getFilesPendingImport() { - return nullToEmptyImmutableCopy(filesPendingImport); - } - - @Override - public Builder asBuilder() { - return new Builder(clone(this)); - } - - /** A builder for constructing {@link LogsExportCursor} objects, since they are immutable. */ - public static class Builder extends Buildable.Builder { - public Builder() {} - - private Builder(LogsExportCursor instance) { - super(instance); - } - - public Builder setExportedRanges(ImmutableSet exportedRanges) { - getInstance().exportedRanges = exportedRanges; - return this; - } - - public Builder setFilesPendingImport(ImmutableList filesPendingImport) { - getInstance().filesPendingImport = filesPendingImport; - return this; - } - - @Override - public LogsExportCursor build() { - return super.build(); - } - } -} diff --git a/javatests/google/registry/export/backup_kinds.txt b/javatests/google/registry/export/backup_kinds.txt index 5828e18c5..4f82771b1 100644 --- a/javatests/google/registry/export/backup_kinds.txt +++ b/javatests/google/registry/export/backup_kinds.txt @@ -12,7 +12,6 @@ HistoryEntry HostResource KmsSecret KmsSecretRevision -LogsExportCursor LrpTokenEntity Modification OneTime diff --git a/javatests/google/registry/model/common/PersistedRangeLongTest.java b/javatests/google/registry/model/common/PersistedRangeLongTest.java deleted file mode 100644 index 4b3e1d4e2..000000000 --- a/javatests/google/registry/model/common/PersistedRangeLongTest.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.model.common; - -import static com.google.common.truth.Truth.assertThat; - -import com.google.common.collect.Range; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Unit tests for {@link PersistedRangeLong}. */ -@RunWith(JUnit4.class) -public class PersistedRangeLongTest { - - private void doConversionTest(Range range) { - assertThat(PersistedRangeLong.create(range).asRange()).isEqualTo(range); - } - - @Test - public void all() { - doConversionTest(Range.all()); - } - - @Test - public void lessThan() { - doConversionTest(Range.lessThan(10L)); - } - - @Test - public void atMost() { - doConversionTest(Range.atMost(10L)); - } - - @Test - public void greaterThan() { - doConversionTest(Range.greaterThan(10L)); - } - - @Test - public void atLeast() { - doConversionTest(Range.atLeast(10L)); - } - - @Test - public void open() { - doConversionTest(Range.open(5L, 10L)); - } - - @Test - public void closed() { - doConversionTest(Range.closed(5L, 10L)); - } - - @Test - public void openClosed() { - doConversionTest(Range.openClosed(5L, 10L)); - } - - @Test - public void closedOpen() { - doConversionTest(Range.closedOpen(5L, 10L)); - } - - @Test - public void singleton() { - doConversionTest(Range.singleton(5L)); - } - - @Test - public void openClosedEmpty() { - doConversionTest(Range.openClosed(5L, 5L)); - } - - @Test - public void closedOpenEmpty() { - doConversionTest(Range.closedOpen(5L, 5L)); - } -} diff --git a/javatests/google/registry/model/export/LogsExportCursorTest.java b/javatests/google/registry/model/export/LogsExportCursorTest.java deleted file mode 100644 index 714642017..000000000 --- a/javatests/google/registry/model/export/LogsExportCursorTest.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.model.export; - -import static com.google.common.truth.Truth.assertThat; -import static google.registry.model.ofy.ObjectifyService.ofy; -import static google.registry.testing.DatastoreHelper.persistResource; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Range; -import google.registry.model.EntityTestCase; -import google.registry.model.common.PersistedRangeLong; -import org.junit.Before; -import org.junit.Test; - -/** Unit tests for {@link LogsExportCursor}. */ -public class LogsExportCursorTest extends EntityTestCase { - - LogsExportCursor logsExportCursor; - - @Before - public void setUp() throws Exception { - logsExportCursor = new LogsExportCursor.Builder() - .setExportedRanges(ImmutableSet.of( - PersistedRangeLong.create(Range.all()), - PersistedRangeLong.create(Range.lessThan(10L)), - PersistedRangeLong.create(Range.atMost(10L)), - PersistedRangeLong.create(Range.greaterThan(10L)), - PersistedRangeLong.create(Range.atLeast(10L)), - PersistedRangeLong.create(Range.open(5L, 10L)), - PersistedRangeLong.create(Range.closed(5L, 10L)), - PersistedRangeLong.create(Range.openClosed(5L, 10L)), - PersistedRangeLong.create(Range.closedOpen(5L, 10L)))) - .setFilesPendingImport(ImmutableList.of( - "gs://foo/bar", - "gs://foo/baz", - "gs://foo/bash")) - .build(); - persistResource(logsExportCursor); - } - - @Test - public void testPersistence() throws Exception { - assertThat(ofy().load().entity(logsExportCursor).now()).isEqualTo(logsExportCursor); - } - - @Test - public void testIndexing() throws Exception { - verifyIndexing(logsExportCursor); - } -} diff --git a/javatests/google/registry/model/schema.txt b/javatests/google/registry/model/schema.txt index 688a924dc..c2a92df44 100644 --- a/javatests/google/registry/model/schema.txt +++ b/javatests/google/registry/model/schema.txt @@ -117,12 +117,6 @@ class google.registry.model.common.GaeUserIdConverter { @Id long id; com.google.appengine.api.users.User user; } -class google.registry.model.common.PersistedRangeLong { - com.google.common.collect.BoundType lowerBoundType; - com.google.common.collect.BoundType upperBoundType; - java.lang.Long lowerBound; - java.lang.Long upperBound; -} class google.registry.model.common.TimeOfYear { java.lang.String timeString; } @@ -371,12 +365,6 @@ class google.registry.model.eppcommon.Trid { java.lang.String clientTransactionId; java.lang.String serverTransactionId; } -class google.registry.model.export.LogsExportCursor { - @Id long id; - @Parent com.googlecode.objectify.Key parent; - java.util.List filesPendingImport; - java.util.Set exportedRanges; -} class google.registry.model.host.HostResource { @Id java.lang.String repoId; com.google.common.collect.ImmutableSortedMap> revisions;