001/*
002Copyright 2022 The OpenFunction Authors.
003
004Licensed under the Apache License, Version 2.0 (the "License");
005you may not use this file except in compliance with the License.
006You may obtain a copy of the License at
007
008    http://www.apache.org/licenses/LICENSE-2.0
009
010Unless required by applicable law or agreed to in writing, software
011distributed under the License is distributed on an "AS IS" BASIS,
012WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013See the License for the specific language governing permissions and
014limitations under the License.
015*/
016
017package dev.openfunction.functions;
018
019import java.util.Map;
020
021@Deprecated
022public interface Plugin {
023    /**
024     * name return the name of this plugin.
025     *
026     * @return Plugin name
027     */
028    String name();
029
030    /**
031     * version return the version of this plugin.
032     *
033     * @return Plugin name
034     */
035    String version();
036
037    /**
038     * init will create a new plugin, and execute hook in this calling.
039     * If you do not want to use a new plugin to execute hook, just return `this`.
040     *
041     * @return Plugin
042     */
043    Plugin init();
044
045
046    /**
047     * execPreHook executes a hook before the function called.
048     *
049     * @param ctx Runtime context
050     * @return error
051     */
052    Error execPreHook(Context ctx);
053
054    /**
055     * execPreHook executes a hook after the function called.
056     *
057     * @param ctx Runtime context
058     * @return error
059     */
060    Error execPostHook(Context ctx);
061
062    /**
063     * get return the value of the fieldName`
064     *
065     * @param fieldName Name of member
066     * @return Object
067     */
068    Object getField(String fieldName);
069
070    Boolean needToTracing();
071
072    Map<String, String> tagsAddToTracing();
073
074}