/*
* 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
*
* https://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.
*/
using System;
namespace Avro.File
{
///
/// Defines the interface for an object that stores in a file a sequence of data conforming to
/// a schema.
///
/// Type that we will serialize to the file.
public interface IFileWriter : IDisposable
{
///
/// Append datum to a file or stream.
///
/// Datum to append.
void Append(T datum);
///
/// Closes the file or stream.
///
void Close();
///
/// Flush out any buffered data.
///
void Flush();
///
/// Returns true if parameter is a reserved Avro metadata value.
///
/// Metadata key.
///
/// True if parameter is a reserved Avro metadata value, false otherwise.
///
bool IsReservedMeta(string key);
///
/// Set metadata pair.
///
/// Metadata key.
/// Metadata value.
void SetMeta(string key, byte[] value);
///
/// Set metadata pair (long value).
///
/// Metadata key.
/// Metadata value.
void SetMeta(string key, long value);
///
/// Set metadata pair (string value).
///
/// Metadata key.
/// Metadata value.
void SetMeta(string key, string value);
///
/// Set the synchronization interval for this file or stream, in bytes. Valid values range
/// from 32 to 2^30. Suggested values are between 2K and 2M.
///
///
/// Approximate number of uncompressed bytes to write in each block.
///
void SetSyncInterval(int syncInterval);
///
/// Forces the end of the current block, emitting a synchronization marker.
///
///
/// Current position as a value that may be passed to
/// .
///
long Sync();
}
}