folly/folly/io/IOBufIovecBuilder.h

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed 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.
 */

#pragma once

#include <deque>
#include <folly/io/IOBuf.h>
#include <folly/memory/Malloc.h>

namespace folly {
/**
 * IOBufIovecBuilder exists to help allocate and fill IOBuf chains using
 * iovec-based scatter/gather APIs.
 *
 * It provides APIs to allocate buffers for use with iovec-based system calls,
 * and then construct IOBuf chains pointing to the buffer data that has been
 * populated.
 *
 * This class allows performing repeated vectored reads and minimizing the
 * number of separate allocations if data is received in small chunks, while
 * still generating unshared IOBuf instances.  For instance, this helps support
 * in place decryption mechanisms which require unshared IOBuf instances.
 */

class IOBufIovecBuilder {};
} // namespace folly