This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch swift-sdk
in repository https://gitbox.apache.org/repos/asf/beam.git

commit adfd8948ae38625ff423d4f321f9b84548802830
Author: Byron Ellis <[email protected]>
AuthorDate: Thu Aug 17 15:53:14 2023 -0700

    Turns out String interpolation breaks the #file and #line macros. Try a new 
approach with optional "real" names to get more stable transform names. Start 
adding "ObjectFn" for more complicated DoFn implementations.
---
 .../ApacheBeam/Core/DynamicProperties.swift        |  2 +-
 .../Sources/ApacheBeam/Core/Fn/ObjectFn.swift      | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/sdks/swift/Sources/ApacheBeam/Core/DynamicProperties.swift 
b/sdks/swift/Sources/ApacheBeam/Core/DynamicProperties.swift
index c084e371182..713661b7d8f 100644
--- a/sdks/swift/Sources/ApacheBeam/Core/DynamicProperties.swift
+++ b/sdks/swift/Sources/ApacheBeam/Core/DynamicProperties.swift
@@ -38,7 +38,7 @@ public struct POutput<Of> : DynamicProperty {
 }
 
 @propertyWrapper
-public struct Logger : DynamicProperty {
+public struct RemoteLog : DynamicProperty {
     public var wrappedValue: Logging.Logger
     public init(wrappedValue: Logging.Logger = Logging.Logger(label: "TEST")) {
         self.wrappedValue = wrappedValue
diff --git a/sdks/swift/Sources/ApacheBeam/Core/Fn/ObjectFn.swift 
b/sdks/swift/Sources/ApacheBeam/Core/Fn/ObjectFn.swift
new file mode 100644
index 00000000000..b5acf1df585
--- /dev/null
+++ b/sdks/swift/Sources/ApacheBeam/Core/Fn/ObjectFn.swift
@@ -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.
+ */
+
+/// Allows the user to define a DoFn struct. Input and output streams along 
with parameterized values are dynamically
+/// injected at bundle processing time. This allows for more complicated DoFns 
to be written.
+public final class ObjectFn : SerializableFn {
+    
+    var doFn : DoFn
+    
+    public init(_ doFn: DoFn) {
+        self.doFn = doFn
+    }
+    
+    public func process(context: SerializableFnBundleContext, inputs: 
[AnyPCollectionStream], outputs: [AnyPCollectionStream]) async throws -> 
(String, String) {
+        //TODO: Attach context to the doFn
+        try await doFn.process()
+        return (context.instruction,context.transform)
+    }
+    
+    
+}

Reply via email to