// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.Kestrel.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Http
{
///
/// Operations performed for buffered socket output
///
public interface ISocketOutput
{
void Write(ArraySegment buffer, bool chunk = false);
Task WriteAsync(ArraySegment buffer, bool chunk = false, CancellationToken cancellationToken = default(CancellationToken));
///
/// Returns an iterator pointing to the tail of the response buffer. Response data can be appended
/// manually or by using .
/// Be careful to ensure all appended blocks are backed by a .
///
MemoryPoolIterator2 ProducingStart();
///
/// Commits the response data appended to the iterator returned from .
/// All the data up to will be included in the response.
/// A write operation isn't guaranteed to be scheduled unless
/// or is called afterwards.
///
/// Points to the end of the committed data.
void ProducingComplete(MemoryPoolIterator2 end);
}
}