This project has retired. For details please refer to its
Attic page.
001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.oozie.dependency.hcat;
019
020 import java.util.Collection;
021 import java.util.Map;
022
023 import org.apache.hadoop.conf.Configuration;
024 import org.apache.oozie.util.HCatURI;
025
026 public interface HCatDependencyCache {
027
028 /**
029 * Initialize the cache with configuration
030 *
031 * @param conf configuration
032 */
033 public void init(Configuration conf);
034
035 /**
036 * Add a missing partition dependency and the actionID waiting on it
037 *
038 * @param hcatURI dependency URI
039 * @param actionID ID of action which is waiting for the dependency
040 */
041 public void addMissingDependency(HCatURI hcatURI, String actionID);
042
043 /**
044 * Remove a missing partition dependency associated with a actionID
045 *
046 * @param hcatURI dependency URI
047 * @param actionID ID of action which is waiting for the dependency
048 * @return true if successful, else false
049 */
050 public boolean removeMissingDependency(HCatURI hcatURI, String actionID);
051
052 /**
053 * Get the list of actionIDs waiting for a partition
054 *
055 * @param hcatURI dependency URI
056 * @return list of actionIDs
057 */
058 public Collection<String> getWaitingActions(HCatURI hcatURI);
059
060 /**
061 * Mark a partition dependency as available
062 *
063 * @param server host:port of the server
064 * @param db name of the database
065 * @param table name of the table
066 * @param partitions list of available partitions
067 * @return list of actionIDs for which the dependency is now available
068 */
069 public Collection<String> markDependencyAvailable(String server, String db, String table, Map<String, String> partitions);
070
071 /**
072 * Get a list of available dependency URIs for a actionID
073 *
074 * @param actionID action id
075 * @return list of available dependency URIs
076 */
077 public Collection<String> getAvailableDependencyURIs(String actionID);
078
079 /**
080 * Remove the list of available dependency URIs for a actionID once the missing dependencies are processed.
081 *
082 * @param actionID action id
083 * @param dependencyURIs set of dependency URIs
084 * @return true if successful, else false
085 */
086 public boolean removeAvailableDependencyURIs(String actionID, Collection<String> dependencyURIs);
087
088 /**
089 * Destroy the cache
090 */
091 public void destroy();
092 }