Removed ClockService<K, V> and replaced its usage with a BiFunction<K, V, Timestamp>
Change-Id: Ide8d979f9361f1aff6727a83733747f4512ef8ff
diff --git a/core/api/src/main/java/org/onosproject/store/service/ClockService.java b/core/api/src/main/java/org/onosproject/store/service/ClockService.java
deleted file mode 100644
index 12ce688..0000000
--- a/core/api/src/main/java/org/onosproject/store/service/ClockService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.store.service;
-
-import org.onosproject.store.Timestamp;
-
-/**
- * Clock service that can generate timestamps based off of two input objects.
- * Implementations are free to only take one or none of the objects into account
- * when generating timestamps.
- */
-public interface ClockService<T, U> {
-
- /**
- * Gets a new timestamp for the given objects.
- *
- * @param object1 First object to use when generating timestamps
- * @param object2 Second object to use when generating timestamps
- * @return the new timestamp
- */
- Timestamp getTimestamp(T object1, U object2);
-}
diff --git a/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMap.java b/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMap.java
index 84b515c..b57cc5f 100644
--- a/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMap.java
+++ b/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMap.java
@@ -114,7 +114,7 @@
* Removes the given key-value mapping from the map, if it exists.
* <p>
* This actually means remove any values up to and including the timestamp
- * given by {@link org.onosproject.store.service.ClockService#getTimestamp(Object, Object)}.
+ * given by the map's timestampProvider.
* Any mappings that produce an earlier timestamp than this given key-value
* pair will be removed, and any mappings that produce a later timestamp
* will supersede this remove.
diff --git a/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMapBuilder.java b/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMapBuilder.java
index c3abb4e..9471321 100644
--- a/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMapBuilder.java
+++ b/core/api/src/main/java/org/onosproject/store/service/EventuallyConsistentMapBuilder.java
@@ -18,6 +18,7 @@
import org.onlab.util.KryoNamespace;
import org.onosproject.cluster.NodeId;
+import org.onosproject.store.Timestamp;
import java.util.Collection;
import java.util.concurrent.ExecutorService;
@@ -66,10 +67,10 @@
KryoNamespace.Builder serializerBuilder);
/**
- * Sets the clock service to use for generating timestamps for map updates.
+ * Sets the function to use for generating timestamps for map updates.
* <p>
- * The client must provide an {@link org.onosproject.store.service.ClockService}
- * which can generate timestamps for a given key. The clock service is free
+ * The client must provide an {@code BiFunction<K, V, Timestamp>}
+ * which can generate timestamps for a given key. The function is free
* to generate timestamps however it wishes, however these timestamps will
* be used to serialize updates to the map so they must be strict enough
* to ensure updates are properly ordered for the use case (i.e. in some
@@ -80,11 +81,11 @@
* Note: This is a mandatory parameter.
* </p>
*
- * @param clockService clock service
+ * @param timestampProvider provides a new timestamp
* @return this EventuallyConsistentMapBuilder
*/
- EventuallyConsistentMapBuilder<K, V> withClockService(
- ClockService<K, V> clockService);
+ EventuallyConsistentMapBuilder<K, V> withTimestampProvider(
+ BiFunction<K, V, Timestamp> timestampProvider);
/**
* Sets the executor to use for processing events coming in from peers.
diff --git a/core/api/src/main/java/org/onosproject/store/service/WallclockClockManager.java b/core/api/src/main/java/org/onosproject/store/service/WallclockClockManager.java
deleted file mode 100644
index c2b5ffb..0000000
--- a/core/api/src/main/java/org/onosproject/store/service/WallclockClockManager.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 org.onosproject.store.service;
-
-import org.onosproject.store.Timestamp;
-
-/**
- * A clock service which hands out wallclock-based timestamps.
- */
-public class WallclockClockManager<T, U> implements ClockService<T, U> {
- @Override
- public Timestamp getTimestamp(T object1, U object2) {
- return new WallClockTimestamp();
- }
-}