All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.flink.streaming.api.datastream.QueryableStateStream Maven / Gradle / Ivy

There is a newer version: 1.14.6
Show newest version
/*
 * 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.streaming.api.datastream;

import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.state.StateDescriptor;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.util.Preconditions;

/**
 * Queryable state stream instance.
 *
 * @param   State key type
 * @param   State value type
 */
@PublicEvolving
public class QueryableStateStream {

	/** Name under which the state is queryable. */
	private final String queryableStateName;

	/** Key serializer for the state instance. */
	private final TypeSerializer keySerializer;

	/** State descriptor for the state instance. */
	private final StateDescriptor stateDescriptor;

	/**
	 * Creates a queryable state stream.
	 *
	 * @param queryableStateName Name under which to publish the queryable state instance
	 * @param stateDescriptor The state descriptor for the state instance
	 * @param keySerializer Key serializer for the state instance
	 */
	public QueryableStateStream(
			String queryableStateName,
			StateDescriptor stateDescriptor,
			TypeSerializer keySerializer) {

		this.queryableStateName = Preconditions.checkNotNull(queryableStateName, "Queryable state name");
		this.stateDescriptor = Preconditions.checkNotNull(stateDescriptor, "State Descriptor");
		this.keySerializer = Preconditions.checkNotNull(keySerializer, "Key serializer");
	}

	/**
	 * Returns the name under which the state can be queried.
	 *
	 * @return Name under which state can be queried.
	 */
	public String getQueryableStateName() {
		return queryableStateName;
	}

	/**
	 * Returns the key serializer for the queryable state instance.
	 *
	 * @return Key serializer for the state instance.
	 */
	public TypeSerializer getKeySerializer() {
		return keySerializer;
	}

	/**
	 * Returns the state descriptor for the queryable state instance.
	 *
	 * @return State descriptor for the state instance
	 */
	public StateDescriptor getStateDescriptor() {
		return stateDescriptor;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy