You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ke...@apache.org on 2016/07/25 19:11:46 UTC

[2/4] incubator-beam git commit: Introduce StateInternalsFactory

Introduce StateInternalsFactory

This class vends a StateInternals for a particular key.
Various DoFns that access StateInternals via ProcessContext
will be ported to instead accept a StateInternalsFactory.

The StateInternalsFatory must be provided by the runner
to enable provisioning of the appropriate run-time
StateInternals.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/d2594e0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/d2594e0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/d2594e0f

Branch: refs/heads/master
Commit: d2594e0fc588849dba905e168523deacd4f1f4dd
Parents: 20244ba
Author: Kenneth Knowles <kl...@google.com>
Authored: Mon Jul 18 13:56:22 2016 -0700
Committer: Kenneth Knowles <kl...@google.com>
Committed: Mon Jul 25 09:30:32 2016 -0700

----------------------------------------------------------------------
 .../sdk/util/state/StateInternalsFactory.java   | 36 ++++++++++++++++++++
 1 file changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/d2594e0f/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateInternalsFactory.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateInternalsFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateInternalsFactory.java
new file mode 100644
index 0000000..54355c7
--- /dev/null
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateInternalsFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.beam.sdk.util.state;
+
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.annotations.Experimental.Kind;
+
+import java.io.Serializable;
+
+/**
+ * A factory for providing {@link StateInternals} for a particular key.
+ *
+ * <p>Because it will generally be embedded in a {@link DoFn}, albeit at execution time,
+ * it is marked {@link Serializable}.
+ */
+@Experimental(Kind.STATE)
+public interface StateInternalsFactory<K> {
+
+  /** Returns {@link StateInternals} for the provided key. */
+  StateInternals<K> stateInternalsForKey(K key);
+}