/*
* 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.hbase.cell;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hbase.Cell;
/**
* Accepts a stream of Cells and adds them to its internal data structure. This can be used to build
* a block of cells during compactions and flushes, or to build a byte[] to send to the client. This
* could be backed by a List<KeyValue>, but more efficient implementations will append results to a
* byte[] to eliminate overhead, and possibly encode the cells further.
*/
@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface CellOutputStream {
/**
* Implementation must copy the entire state of the Cell. If the appended Cell is modified
* immediately after the append method returns, the modifications must have absolutely no effect
* on the copy of the Cell that was added to the appender. For example, calling someList.add(cell)
* is not correct.
*/
void write(Cell cell);
/**
* Let the implementation decide what to do. Usually means writing accumulated data into a byte[]
* that can then be read from the implementation to be sent to disk, put in the block cache, or
* sent over the network.
*/
void flush();
}