org.apache.flink.runtime.state.gemini.engine.GCommonKList Maven / Gradle / Ivy
/*
* 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.flink.runtime.state.gemini.engine;
import java.util.Collection;
/**
* GCommonKList.
* K is type of key.
* V is type of List.
*/
public interface GCommonKList {
/**
* Adds a new element into the list under the given key.
*
* @param key The key whose list is to be updated.
* @param element The element to be added.
*/
void add(K key, E element);
/**
* Adds all the elements in given list into the list under the given key.
* The addition of the elements is atomic, i.e., exceptions will be thrown
* if some of them fail to be added into the state.
*
* @param key The key whose list is to be updated.
* @param elements The elements to be added into the state.
*/
void addAll(K key, Collection elements);
/**
* Removes one occurrence of the given element from the list under the given
* key, if it is present.
*
* @param key The key whose list is to be updated.
* @param element The element to be removed from the state.
*/
void remove(K key, E element);
/**
* Removes all the elements in the given list from the list under the given
* key. If an element appears more than once in the list, all its
* occurrences will be removed. The removal of the elements is atomic, i.e.,
* exceptions will be thrown if some of them fail to be removed from the
* state.
*
* @param key The key whose list is to be updated.
* @param elements The element to be removed from the state.
*/
void removeAll(K key, Collection elements);
}